This step-by-step article describes how to modify the URL of a Web service that is used as a data source for a Microsoft Office InfoPath form.
The InfoPath user interface does not provide a way for you to change the URL for the Web service that is used as a data source. However, you can change the URL by first extracting the files for your form and then manually modifying Manifest.xsf.
Create a Simple Web Service
Start Microsoft Visual Studio .NET. On the File menu, point to New, and then
Under Project Types, select Visual Basic Projects. Under Templates, select ASP .NET Web
In the Location text box, type http://<SERVER>/SimpleWebService (where
<SERVER> is the name of your Web server), and then click OK.
Right-click Service1.asmx.vb, and then click View Code.
Add the following Web service method to the Service1 class:
Public Function HelloWorld() As String
Return "Hello World"
On the Build menu, click Build Solution.
Close Visual Studio .NET.
Create a New Form from the Web Service
On the File menu, click Design a Form.
In the Design a Form task pane, click New from Data Source. The
Data Source Setup Wizard begins.
Set up the data source as follows:
Select Web Service for the data source, and then click Next.
Select Receive data, and then click Next.
Type http://<SERVER>/SimpleWebService/Service1.asmx for the location of the Web service, and then click Next.
In the Select an Operation list, select Hello World, and then click Next.
Select Design data view first, and then click Finish.
Switch to the Data Source task pane, and then expand dataFields.
Expand HelloWorldResponse, and then drag the HelloWorldResult element to the view. InfoPath adds a Text Box control to the view.
Test the form as follows:
On the Task Pane menu, click Views.
In the Views list, select Query. Right-click Query, and then click Set as Default.
On the File menu, point to Preview Form, and then click Default.
When the Query view of the form opens, click Run Query.
On the View menu, click Data Entry. Verify the value that the Web service returns.
Change the URL of the Web Service
Rename the service to change its URL, as follows:
In Windows Explorer, locate C:\Inetpub\Wwwroot\SimpleWebService.
Locate the Service1.asmx file, and then rename the file as Service2.asmx.
Return to InfoPath and test the form as follows:
Follow steps 7a through 7d in the "Create a New Form from the Web Service" section. InfoPath generates the following error message when you click Run Query:
InfoPath cannot run the specified query.
InfoPath either cannot connect to the data source or the service has timed out.
Click OK to dismiss the dialog box.
Click Close Preview to return to design mode.
Change the URL of the Web service in the InfoPath form as follows:
On the File menu, click Extract Form Files.
In the Browse for Folder dialog box, select a folder that will contain the extracted files, and then click OK.
In Windows Explorer, locate the folder where you extracted the files.
Open the Manifest.xsf file in a text editor such as Notepad or an XML editor such as Visual Studio .NET 2003.
Locate the <xsf:webServiceAdapter> tag. Change the wsdlUrl attribute from http://localhost/simplewebservice/service1.asmx?WSDL to
Locate the <xsf:operation> tag. Change the serviceUrl attribute from http://localhost/simplewebservice/service1.asmx to
Save your changes to Manifest.xsf, and then close the file.
Test the form as follows:
In Windows Explorer, right-click Manifest.xsf, and then click Design. This opens the form in InfoPath.
Follow step 7 in the "Create a New Form from the Web Service" section to test the form.