How to quickly edit multiple Web Service urls inside an InfoPath form

November 10, 2007   20:06


How to quickly edit multiple Web Service urls inside a InfoPath formA good way to communicate with SharePoint from within a InfoPath form is to use Web Services. Normally you will manage the data source type Web Service with the help of the Data Connection Wizard. To investigate the web service you often have to supply the wizard with some example parameters, especially when the web service doesn’t return any result with empty parameters. Providing those parameters can take quite some time if you have to update more as one web service.

One of my current projects included 5 InfoPath forms with each 6 web services. Clicking through the Data Connection Wizard to update the url would take quite some time and I only needed to change the location. My test environment used the same web service as in production, but because of the different server name I had to update the urls to make the InfoPath forms work.

I found some interesting instructions in the InfoPath documentation and I decided to take it to the test. It turned out to be a good and quick way to update the urls. If you are facing the same situation as me follow these steps:

(more…)

Tags: , , , , , .





InfoPath IXMLDOMDocument: Reference to undeclared namespace prefix

October 30, 2007   12:00


InfoPath IXMLDOMDocument Reference to undeclared namespace prefixBy making use of the Microsoft Office Interop libraries it is possible to fill an InfoPath form automatically. This can be useful when you would like to run a large batch of initial settings.

Trying to set a query property in the DOM of a data source I received the error “Reference to undeclared namespace prefix: ‘tns’”. The reason of this error is that the xml contains multiple namespaces and that you have to explicitly define the namespace to use.

By default the DOM property you can access from the XDocument are of the type IXMLDOMDocument. But working with this type, does not allow you to set the required namespace for your selections. To get around the issue convert the IXMLDOMDocument to a IXMLDOMDocument2 which makes it possible to define a “SelectionNamespaces” property. If you fill this property with the required documentElement’s namespace, the xpath selection of your node will succeed and the error is gone.

Below is an example of the Data source’s IXMLDOMDocument2 content (xml) and some demo code to select the required node.

(more…)

Tags: , , , , , , .









The content expressed in this blog are those of Edwin Vriethoff and do not represent his employer's view in anyway. The contents of this blog has been carefully put together, but Edwin Vriethoff is not responsible in any way for any direct or indirect harm caused by individuals or organizations using the content of this blog in any way.