Easy deployment?

T

TJ

Hi,

Here is the question that I have...
Suppose that I created info path form using web service...
Some dropdown list data will be retrieved from the web service...
(Suppose that web service url is http://A/test.asmx)...

In info path, is there any way I can create configuration file?
For example...something like..
Test.xsn file is created with the http://A/test.asmx...
If there is something like Test.xsn.config....
<WebServiceURL>
http://A/test.asmx
</WebServiceURL>
When Test.xsn and Test.xsn.config files are deployed, end-user doesn't have
modify the xsn file again to set different web server...Only thing they need
to change the WebServiceURL in Test.xns.config....

Could it be possibe?...

I just try to find some easy for configuration such as web service url or
database connection string without modifying info path template file
itself.....

Thanks.

..................................................................TJ
 
F

Franck Dauché

Hi TJ,

Yes you can store your new URL in a secondary data source document and use
code to update the URL. The code below will get you started:

function XDocument::OnLoad(eventObj)
{

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

//var firstAdapter = XDocument.DataAdapters[0]; or the 2 next lines:
var theDataObject = XDocument.DataObjects.Item("GetCities");
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();
}

Hope that it helps.

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