updating data connections during deployment - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

updating data connections during deployment

Last post 09-28-2011 12:14 PM by CassimY. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-19-2005 01:46 PM

    updating data connections during deployment

    I have created several data connections in my InfoPath form, pointed to web services running on the development box. Now, I need to deploy the form and need to update the data connections to use corresponding web services on the production server. I am having to do this manually, and it is quite cumbersome. Is there an equivalent of app.config like an easily updateable configuration file, so I could simply change the location of the web services all together as opposed to doing them one by one in the InfoPath interface?

    Thanks!
  • 05-20-2005 12:45 AM In reply to

    Re: updating data connections during deployment

    You need not do it in the User Interface. You can directly edit manifest.xsf file and search for your dataconnection path and replace the exesting webservice URL with your new URL.
    File save manifest.xsf and publish it.

    PS. Be careful when you edit manifest.xsf, any small mistake might screwup your solution. It would be better if you make a copy of your solution before doing this.

    Agni
    InfoPathDev India
  • 05-20-2005 07:59 AM In reply to

    Re: updating data connections during deployment

    Thanks for your reply, Agni. Your solution entails extracting the files from the InfoPath XSN file, modifying the manifest.xsf file and repackaging the InfoPath form, right?

    Is there anyway we can programmatically alter the URLs of the data connection references? I suppose we could do that if the references are dynamic, and I am not sure if InfoPath only works with static references.
  • 05-20-2005 09:53 AM In reply to

    Re: updating data connections during deployment

    Till now I dint see any programatical way of doing this.
    There is a property called "WSDLURL" in "WebServiceAdapter" class but this is a readonly property.
    You can do further investigations on this and let us know if you find anything interesting.

    Agni
    InfoPathDev India
  • 11-09-2005 11:53 PM In reply to

    Re: updating data connections during deployment

    I've got a fairly ugly solution to your problem but it's the best I've got to offer at the moment (C# code):

    //
    // Set the web service URL based upon environment...
    //
    WebServiceAdapterObject adapterWeb; // used to reference web service data adapter
    // 'GetUserData' web service...
    adapterWeb = (WebServiceAdapterObject)thisXDocument.DataAdapters["GetUserData"];
    // Load the xsf:operation element into an temporary XML DOM...
    IXMLDOMDocument3 tempDOM = thisXDocument.CreateDOM() as IXMLDOMDocument3;
    tempDOM.loadXML( adapterWeb.Operation );
    tempDOM.documentElement.attributes.getNamedItem( "serviceUrl" ).text = thisXDocument.DOM.selectSingleNode("my:Form/my:InfoPathFormData/my:WebServiceURL").text;
    adapterWeb.Operation = tempDOM.xml;

    Basically this modifies the ServiceURL property of the WebAdaptor to point at the URL you wish to use. I've stored that URL within my schema at "my:Form/my:InfoPathFormData/my:WebServiceURL".

    I'm not sure if all of this is accessible using script but hopefully this can point you in the right direction.
  • 02-03-2006 08:17 AM In reply to

    Re: updating data connections during deployment

    Just for reference on future forms, for web development in general I usually switch my hosts file "C:\WINDOWS\system32\drivers\etc" to point to my development server(local or otherwise) using the same domain name etc that is used on the production servers. That way the forms remain consistent with the same url, just change your host file to point to a server of your choosing. Non public domain and client systems, either change their hosts file or run a local DNS if they have it and regardless of the machine where the host service is, you can redirect the client on the same universal URL. One form, one url, works for everyone scenario. This is more of a network/hardware solution and may not work for everyone. I just got tired of changing the data connections on the forms, too time consuming and did not like tracking multiple versions of the same form just with different data connections.
  • 03-24-2006 11:32 PM In reply to

    • CGlover
    • Top 500 Contributor
    • Joined on 01-21-2006
    • United Kingdom
    • Posts 34

    Re: updating data connections during deployment

    John,

    Thanks - this works perfectly. For anyone unfamiliar with this file: add the line
    127.0.0.1
  • 03-24-2006 11:37 PM In reply to

    • CGlover
    • Top 500 Contributor
    • Joined on 01-21-2006
    • United Kingdom
    • Posts 34

    Re: updating data connections during deployment

    Oops - wrong button...

    What I was about to say was,

    127.0.0.1 nameofyourproductionserver

    When you are not doing IP development you will have to delete this line. A bit of vb script should allow you to have two hosts files and swap them using a shortcut.

    Clive
  • 03-25-2006 07:59 AM In reply to

    Re: updating data connections during deployment

    Also, we have this tool in our webstore that can update data connections and deploy mutliple versions of the form to all different places. All you have to do is setup a configuration file one time, and when you are ready to publish, run the program. It will update all data connections that you specify and save to one or several new places.

    Check it out:
    http://infopathdev.com/webstore/detail.aspx?itemid=21
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-28-2011 12:14 PM In reply to

    Re: updating data connections during deployment

    Hi,

    We have a dev, QA, Authoring, Staging and Production environment and each environment has its own url.  I'm developing an InfoPath form that has data connections to lists in the host site.  When I deploy to QA, I have to modify each data connection to point to the QA url, and likewise for Authoring, Staging and Production.

    How can I set the data connection to read the url of the host site dynamically?\

    Thanx

    Yusuf

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