Dynamically Set Location of Web Service

J

Jay W

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
 
F

Franck Dauché

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é
 
Top