Connect an existing form to a Web service
You can create a data connection in your Microsoft Office InfoPath 2003 form that receives data from a Web service, or submits part or all of your form to a Web service.
Note For the primary data source to receive data from a Web service, the structure of the form must match the structure of the Web service. To do this, you must design a form based on that Web service.
Receive data from a Web service
When you add a data connection that receives data from a Web service or other type of data source to your form, InfoPath creates a secondary data source for your form. This data source lets you populate list boxes with values from the Web service, and bind controls to the fields and groups associated with the Web service. In general, you can work with the secondary data source in many of the same ways that you work with your form's primary data source.
Note The values associated with a secondary data source cannot be saved when a user fills out a form, although they can be submitted to a Web service using a submit data connection. In addition, you cannot edit the properties or structure of the fields and groups associated with a secondary data source, nor can you specify default values or custom, noncode-based data validation for those fields.
- In design mode, click Data Connections on the Tools menu.
- In the Data Connections dialog box, click Add.
- In the Data Connection Wizard, click Receive data, and then click Next.
- On the next page of the wizard, click Web service, and then click Next.
- On the next page of the wizard, type the location of the Web service, and then click Next.
Note If you want to search a Universal Description, Discovery, and Integration (UDDI) server for the Web service, click Search UDDI, enter the UDDI server you want to search, specify whether you want to search by provider or by the services that are provided, and then enter a keyword to search for.
- On the next page of the wizard, specify the Web service operation that you want to receive data from, and then click Next.
- If the next page of the wizard requests that you specify values or sample values, select each parameter in the Parameters table, click Set Value or Set Sample Value, and then specify the appropriate value.
Note Depending on the structure of the Web service, these parameters may be necessary in order to query the Web service correctly. If you are specifying values, these values will be used whenever the Web service is queried. If you are specifying sample values, these values will be used to identify the definition of the Web service so that InfoPath can receive data from it.
- Click Next.
- On the next page of the wizard, type a name for the data connection.
- If you want to automatically receive data whenever the form is opened by a user, select the Automatically retrieve data when form is opened check box, and then click Finish.
Note If the form does not automatically receive data, you may want to insert a button that retrieves the data when clicked.
- In design mode, click Data Connections on the Tools menu.
- In the Data Connections dialog box, click Add.
- In the Data Connection Wizard, click Submit data, and then click Next.
- On the next page of the wizard, click To a Web service, and then click Next.
- On the next page of the wizard, type the location of the Web service, and then click Next.
Note If you want to search a Universal Description, Discovery, and Integration (UDDI) server for the Web service, click Search UDDI, enter the UDDI server you want to search, specify whether you want to search by provider or by the services that are provided, and then enter a keyword to search for.
- On the next page of the wizard, specify the Web service operation that you want to submit your form data to, and then click Next.
- On the next page of the wizard, select a parameter in the Parameters table, and then do one of the following:
Submit data from a specific part of the form
- To submit data from a specific part of the form, click Field or group under Submit the following data for the selected parameter, click Modify, and then, in the Select a Field or Group dialog box, click the field or group whose data you want to submit.
- In the Include box, click Text and child elements only to submit just the content of the field or group, or click XML subtree, including selected element to submit both the content and the selected group or field.
- To submit the entire form, including the root element and any processing instructions, click Entire form (XML document, including processing instructions).
- Repeat for each parameter.
- To submit the data as a string, select the Submit data as a string check box.
Note This is necessary for digitally signed data because it preserves white spaces in the data. In most other cases, this check box should be left clear.
- Click Next.
- On the next page of the wizard, type a name for the data connection, and then click Finish.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more