Webservices

G

gnana

When you design the InfoPath form we will give the webservices URL for
creating the webservices connection.

Is there a way to give the URL of webservices at run time?

The reason I am asking is, I am developing my form based on staging
webservices. When I deploy the InfoPath forms, I want to point it to my
production URL. Is there a way I can just use my XSN without republishing it?

Thank!
 
F

Franck Dauché

Hi,

You can use something along the lines of:

function XDocument::OnLoad(eventObj)
{

var myURL = "http://localhost/.............../Service1.asmx";

//var firstAdapter = XDocument.DataAdapters[0]; or the 2 next lines:
var theDataObject = XDocument.DataObjects.Item("MyWS");
var firstAdapter = theDataObject.QueryAdapter;
//XDocument.UI.Alert(firstAdapter.WSDLURL);

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");
XDocument.UI.Alert("Before: " + serviceUrlNode.text);
serviceUrlNode.text = myURL;
XDocument.UI.Alert("After: " + serviceUrlNode.text);
firstAdapter.Operation = tmpXmlDoc.xml
// Run a query with the changed serviceUrl
firstAdapter.Query();
}

Regards,

Franck Dauché
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top