Dynamic WSDL URL in managed code - InfoPath Dev
in

InfoPath Dev

Dynamic WSDL URL in managed code

Last post 11-06-2006 05:27 AM by Abhishek. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-24-2006 06:07 PM

    • adamw
    • Not Ranked
    • Joined on 11-14-2005
    • Posts 12

    Dynamic WSDL URL in managed code

    Hi

    I am writing an Infopath Form that uses managed code. I have added a web reference to the managed code and use it extensively.

    Now, in VB.NET in a normal app I can set the WSDL URL as dynamic which puts it in a file called app.config. This makes it easy for me to provide one copy of my application to testers and they can switch between our testing environments easily by just changing the WSDL URL in app.config.

    However with InfoPath, I have checked inside the deployed XSN file and there is no app.config in it. The managed code also appears to be compiled into a DLL.

    So what I want to know is, is the above possible in InfoPath? Can I provide a form to people and have them change the WSDL url themselves somewhere? I can't see where they can do this inside the XSN (CAB file) as the app.config is not there like it is in development :(

    Adam
  • 10-25-2006 01:44 AM In reply to

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

    Re: Dynamic WSDL URL in managed code

    Hi Adam,

    You can change the service url by using below method. For this you should pass the ‘adapter name#%92 and ‘wsdl url#%92.

    private void PutServiceURL(string dataAdapterName, string url)
    {
    WebServiceAdapter2 da;
    IXMLDOMDocument xmlOperation;
    //Get the web service adapter
    da = (WebServiceAdapter2)thisXDocument.DataAdapters[dataAdapterName];

    xmlOperation = thisXDocument.CreateDOM();
    //Load the xml of data adapter operation node
    xmlOperation.loadXML(da.Operation);
    //Set the your wsdl url to ‘serviceUrl#%92 attribute
    xmlOperation.documentElement.selectSingleNode("@serviceUrl").text = url;
    da.Operation = xmlOperation.xml;
    }

    Note: Above Code in C#.
  • 11-01-2006 05:13 PM In reply to

    • adamw
    • Not Ranked
    • Joined on 11-14-2005
    • Posts 12

    Re: Dynamic WSDL URL in managed code

    It is not an web service added as a data adapter in Infopath.. it is actually a normal web reference in the managed code.
  • 11-06-2006 05:27 AM In reply to

    Re: Dynamic WSDL URL in managed code

    Hi Adam,
    Adding a web reference as u do in a web application is not a good idea to access a web service in InfoPath.

    Instead u create secondary data connections to ur web service and query it whenever needed.

    The advantage of this method is that data fetched using secondary dataconnections are not saved with the form.They are lost as soon as u close the form. It ensures that the data from these secondary data connections are not unnecessarily stored as XML along with form and hence considerably reduces the form's bulk.

    For more info on this,there are lot of posts in this forum.Please check it out.

    Regards,
    Abhishek Keshav
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.