Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

Dynamically Set Location of Web Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay W - 08 Nov 2005 20:09 GMT
Is there a way to set the location of a web service data connection in code?  
The requirement is to have the web service that is used by the form be a
configurable parameter of the application.  The initial intent is to use this
to switch between production and test versions of the web service the form is
submitted to.  

Any help is appreciated.

Jay
Franck Dauché - 08 Nov 2005 21:12 GMT
Hi Jay,

What about something along the lines of:

var myURL = "http://localhost/........./Service1.asmx";
   
var theDataObject = XDocument.DataObjects.Item("WSName");
var firstAdapter = theDataObject.QueryAdapter;
   
var tmpXmlDoc = new ActiveXObject("msxml2.domdocument.5.0");
tmpXmlDoc.setProperty("SelectionNamespaces",
"xmlns:xsf='http://schemas.microsoft.com/office/infopath/2003/solutionDefinition'");
tmpXmlDoc.loadXML(firstAdapter.Operation);
var serviceUrlNode
=tmpXmlDoc.documentElement.selectSingleNode("@serviceUrl");
serviceUrlNode.text = myURL;
firstAdapter.Operation = tmpXmlDoc.xml
firstAdapter.Query();   

Hope that it helps.

Regards,

Franck Dauché

> Is there a way to set the location of a web service data connection in code?  
> The requirement is to have the web service that is used by the form be a
[quoted text clipped - 5 lines]
>
> Jay
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.