Calling web service from c# code in Infopath 2003 - InfoPath Dev
in

InfoPath Dev

Calling web service from c# code in Infopath 2003

Last post 01-05-2009 08:57 AM by rkgadige. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-19-2008 06:44 AM

    Calling web service from c# code in Infopath 2003

    Hi,

    I created a application with IP2003 ,web services and sql database. I am newbie to Infopath. I used data connections to submit and retrieve the data from webservice.

    I need to write custom code in c# where I can call webserve and check for exceptions and return to the user. I searched over net for the code but in vain. Can anyone send the link or code how I can call web service to save and retreive the data from web service?

    Can I do the same call with script?

    Thanks in advance

    Ravi

    Filed under: ,
  • 12-19-2008 10:08 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Calling web service from c# code in Infopath 2003

    Hello,

    Can you go through below link,

    http://www.infopathdev.com/forums/p/9519/33711.aspx#33711

    In above link code in C#. We can call the web service in script also.

  • 12-22-2008 07:23 AM In reply to

    Re: Calling web service from c# code in Infopath 2003

    Hi Shiva,

    I didn't get the information in the link which you have sent. Can you point to some code snippets where there is a call to web service. If possible, can you give me snippets with managed code and also script. 

    And Also I need to call submit (submitting data to the web service) when user selects "Save" menu. Let me know how can I do in sript and managed code?

    Thanks a lot for responding to my mail.

    Ravi

  • 12-30-2008 01:01 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Calling web service from c# code in Infopath 2003

     

    Hello,

    After taking the web service connection you have to write the below code to submit the form,

    try

    {

    IXMLDOMDocument2 submitDocument = (IXMLDOMDocument2)GetDom("Connection Name", "Web Service Namespace");

    setDocumentWithPIDom.selectSingleNode("XPath of xml node in your web service", xmlString);

    WebServiceAdapter2 webServiceAdapter = (WebServiceAdapter2)thisXDocument.DataAdapters[("Connection Name"];

    webServiceAdapter.Query();

    }

    catch(Exception ex)

    {

    string str = ex.Message;

    }

     

    Note: The above code in 2003 C#.

  • 01-05-2009 08:57 AM In reply to

    Re: Calling web service from c# code in Infopath 2003

    Thanks Shiva. Happy new Year

    Now I have one more issue.  How do I publish the form to shared folder with managed code dll.

    Am using IP2003 and VS 2005. I got the code compiled on my developing machine. When I try to publish the form to Shared Path and open it from there I get the error

    "Form template: file:///\\HERA.cephalon.net\DATA\PDRC_Forms\Test%20Forms--PLEASE%20DO%20NOT%20USE\TestForms\trackingform.xsn
    InfoPath cannot open the selected form because of an error in the form's code.One or more required components of InfoPath or the form template cannot run because of a security restriction.

    Contact your system administrator or run Setup again to confirm that .NET Programmability Support is installed on your computer.Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

     Do I need to sign the assembly? I added this code in class file[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = true)]

    Can you give me the steps to publish the IP 2003 on to share network drive?

    Thanks

    Ravi

     

     

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.