Design a form based on a Web service
When you design a new form that is connected to a Web service, Microsoft Office InfoPath 2003 builds a data structure for your form based on that Web service. The resulting form can then be used to submit data to and query the Web service. You can work with the form in many of the same ways as when you design a new, blank form
You can design forms that receive data from a Web service, submit data to a Web service, or do both. If you are designing a form that does both, you can specify different Web services for receiving and submitting data.
Note InfoPath cannot connect to a Web service that uses remote procedure call (RPC) encoding. Only document literal encoding is supported.
Design a form that submits data to a Web service
- On the File menu, click Design a Form.
- In the Design a Form task pane, click New from Data Connection.
- In the Data Connection Wizard, click Web service, and then click Next.
- On the next page of the wizard, click Submit data, 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, type a name for the data connection, and then click Finish.
Design a form that receives data from a Web service
- On the File menu, click Design a Form.
- In the Design a Form task pane, click New from Data Connection.
- In the Data Connection Wizard, click Web service, and then click Next.
- On the next page of the wizard, click Receive data, 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 sample values, select each parameter in the Parameters table, click 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. Sample values are used to identify the definition of the Web service so that InfoPath can receive data from the operation.
- Click Next.
- On the next page of the wizard, type a name for the data connection, and then click Finish.
Design a form that receives data from and submits data to a Web service
- On the File menu, click Design a Form.
- In the Design a Form task pane, click New from Data Connection.
- In the Data Connection Wizard, click Web service, and then click Next.
- On the next page of the wizard, click Receive and submit data, 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 sample values, select each parameter in the Parameters table, click Set Sample Value, and then specify the appropriate value. When finished, click Next.
Note Depending on the structure of the Web service, these parameters may be necessary in order to query the Web service correctly. Sample values are used to identify the definition of the Web service so that InfoPath can receive data from the operation.
- On the next page of the wizard, type a name for the data connection that receives data, and then click Next.
- On the next page of the wizard, type the location of the Web service that you want to submit your form data to, 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 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.
Submit the entire form (complete XML document)
- 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 that submits data, and then click Finish.
- To add controls to the form, right-click a field or group in the Data Source task pane, and then click the control that you want to insert on the shortcut menu.
Notes
- When you design a form that is connected to a Web service, the resulting data source consists of query fields and data fields. Query fields should be used to create controls that allow users to enter values that they can query the Web service for. Data fields are filled in with the query results, and also allow users to edit existing data and add new data.
- By default, InfoPath adds a Run Query button to a form that receives data from a Web service. When clicked, this button queries the Web service based on the values in the form's query fields.
- By default, InfoPath enables the Submit command on the File menu for a form that can submit data to a Web service. Clicking the command allows users to submit the data in their completed form to the Web service.
- Because the data structure for the form must match the data structure of the Web service it is connected to, you cannot automatically create the data source for the form when inserting controls. In addition, you cannot modify existing fields or groups in the form's data source, and you can only add fields or groups to the root group in the form's data source.
- 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