Microsoft KB Archive/827003

= How to change the URL of a Web service in InfoPath 2003 =

Article ID: 827003

Article Last Modified on 7/28/2006

-

APPLIES TO


 * Microsoft Office InfoPath 2003
 * Microsoft Office InfoPath 2003, Service Pack 1 (SP1)
 * Microsoft Visual Studio .NET 2003 Enterprise Developer

-



IN THIS TASK

 * SUMMARY
 * Introduction
 * Create a Simple Web Service
 * Create a New Form from the Web Service
 * Change the URL of the Web Service



SUMMARY
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.

back to the top

Introduction
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.

back to the top

Create a Simple Web Service
 Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project. Under Project Types, select Visual Basic Projects. Under Templates, select ASP .NET Web Service. In the Location text box, type http:// /SimpleWebService (where  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 &quot;Hello World&quot; End Function  On the Build menu, click Build Solution. Close Visual Studio .NET.</li></ol>

back to the top

Create a New Form from the Web Service
<ol> Start InfoPath.</li> On the File menu, click Design a Form.</li> In the Design a Form task pane, click New from Data Source. The Data Source Setup Wizard begins.</li> Set up the data source as follows: <ol style="list-style-type: lower-alpha;"> Select Web Service for the data source, and then click Next.</li> Select Receive data, and then click Next.</li> Type http://<SERVER>/SimpleWebService/Service1.asmx for the location of the Web service, and then click Next.</li> In the Select an Operation list, select Hello World, and then click Next.</li> Select Design data view first, and then click Finish.</li></ol> </li> Switch to the Data Source task pane, and then expand dataFields.</li> Expand HelloWorldResponse, and then drag the HelloWorldResult element to the view. InfoPath adds a Text Box control to the view.</li> Test the form as follows: <ol style="list-style-type: lower-alpha;"> On the Task Pane menu, click Views.</li> In the Views list, select Query. Right-click Query, and then click Set as Default.</li> On the File menu, point to Preview Form, and then click Default.</li> <li>When the Query view of the form opens, click Run Query.</li> <li>On the View menu, click Data Entry. Verify the value that the Web service returns.</li></ol> </li></ol>

back to the top

Change the URL of the Web Service
<ol> <li>Rename the service to change its URL, as follows: <ol style="list-style-type: lower-alpha;"> <li>In Windows Explorer, locate C:\Inetpub\Wwwroot\SimpleWebService.</li> <li>Locate the Service1.asmx file, and then rename the file as Service2.asmx.</li></ol> </li> <li>Return to InfoPath and test the form as follows: <ol style="list-style-type: lower-alpha;"> <li>Follow steps 7a through 7d in the &quot;Create a New Form from the Web Service&quot; 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.

</li> <li>Click OK to dismiss the dialog box.</li> <li>Click Close Preview to return to design mode.</li></ol> </li> <li>Change the URL of the Web service in the InfoPath form as follows: <ol style="list-style-type: lower-alpha;"> <li>On the File menu, click Extract Form Files.</li> <li>In the Browse for Folder dialog box, select a folder that will contain the extracted files, and then click OK.</li> <li>Close InfoPath.</li> <li>In Windows Explorer, locate the folder where you extracted the files.</li> <li>Open the Manifest.xsf file in a text editor such as Notepad or an XML editor such as Visual Studio .NET 2003.</li> <li>Locate the <xsf:webServiceAdapter> tag. Change the wsdlUrl attribute from http://localhost/simplewebservice/service1.asmx?WSDL to http://localhost/simplewebservice/service2.asmx?WSDL .</li> <li>Locate the <xsf:operation> tag. Change the serviceUrl attribute from http://localhost/simplewebservice/service1.asmx to http://localhost/simplewebservice/service2.asmx .</li> <li>Save your changes to Manifest.xsf, and then close the file.</li></ol> </li> <li>Test the form as follows: <ol style="list-style-type: lower-alpha;"> <li>In Windows Explorer, right-click Manifest.xsf, and then click Design. This opens the form in InfoPath.</li> <li>Follow step 7 in the &quot;Create a New Form from the Web Service&quot; section to test the form.</li> <li>Verify the value that the Web service returns.</li></ol> </li></ol>

back to the top

Keywords: kbhowto KB827003

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.