Tuesday, October 9, 2018

Change the Web service used in your form template's main data connection

Change the Web service used in your form template's main data connection

In this article

Overview

Before you begin

Change the query data connection

Change the submit data connection

Overview

When you first design a form template with a main data connection to a Web service, you may be using a test environment where the Web service is being developed. When the Web service is ready to be deployed, you will have to change the main data connection in your form template from the test environment to the location of the deployed Web service.

When you change the Web service in the main data connection, Microsoft Office InfoPath creates a main data source with fields and groups that correspond to the XML Schema in the new Web service. If the schemas in the old and new Web services are the same, InfoPath automatically binds the existing controls on the form template to the fields in the new data source. If the fields and groups in the new data source do not match the fields and groups in the old data source, InfoPath removes the data source binding from the controls. If InfoPath removes the binding from the controls, you need to remove the controls from the form template or bind them to other fields in the new data source.

Depending on the design of your form template, the main data connection may have a query data connection, a submit data connection, or both. If the main data connection has both a query data connection and a submit data connection and the Web service has changed locations, you need to change both connections.

Note: Find links to information on changing secondary data connections to other external data sources in the See Also section.

After you change the main data connection, you should publish and test the form template to make sure that the data connection to the Web service works as expected when users fill out forms that are based on your form template. You should also test to make sure that existing forms that are based on your form template still work as expected. When you complete your tests, you can allow users to start filling out forms that are based on this form template. Find links to more information about publishing a form template in the See Also section.

Top of Page

Before you begin

Before you change the main data connection, you need the following information from the Web service administrator:

  • The location of the new Web service.

  • Verification that the new Web service uses document/literal style encoding. InfoPath can consume only document/literal style Web services.

  • The names of the operations in the Web service that you will use.

  • Verification that the schemas in the old and new Web services are the same.

Top of Page

Change the query data connection

  1. On the Tools menu, click Convert Main Data Source.

  2. In the Data Connection Wizard, click Create a new connection to, click Receive data, and then click Next.

  3. Under Select the type of data connection you want to use for your form template, click Web service, and then click Next.

  4. On the next page of the wizard, type the location of the Web service, and then click Next.

    Note: If you want to search for a Web service by using a Universal Description Discovery and Integration (UDDI) server, click Search UDDI, enter the URL of the UDDI server that you want to search, specify whether you want to search by provider or by a service that is provided, enter a search keyword, and then click Search. Web services that match your search keyword will appear in the Search result list. Select the Web service that you want to use, and then click OK.

  5. In the Select an operation list, click the Web service operation that returns data to the form, and then click Next.

  6. If the Data Connection Wizard encounters an unknown element in the schema of the Web service, the next page of the wizard may ask you to specify sample values for each parameter to determine what fields or groups to add to the main data source.

    How?

    1. Select a parameter in the Parameters table, and then click Set Sample Value.

    2. In the Sample value box, type a value that your user might use for this field, and then click OK.

    3. Repeat these steps for each parameter in the Parameters table, and then click Next.

    Technical details

    When you configure a data connection to a Web service in the Data Connection Wizard, Microsoft Office InfoPath connects to the Web service and requests the Web Service Description Language (WSDL) file. The WSDL file contains the schema used by the Web service. The Web service responds to the request by sending this file to InfoPath. InfoPath uses the information in this file to add the appropriate fields and groups to the secondary data source in the form template. If InfoPath finds an unknown element type in the WSDL file, InfoPath uses sample data to determine the definition of the unknown element type and then adds the appropriate fields and groups to the secondary data source.

  7. If the Web service accepts change information, the next page of the wizard asks if you want to include change information in the query data. In most cases, leave the Include change information when submitting data check box selected, and then click Next. If you do not want to include change information, clear the Include change information when submitting data check box, and then click Next.

    Technical details

    This page in the wizard appears only if the Web Services Description Language (WSDL) file for the Web service indicates that the Web service returns a Microsoft ADO.NET DataSet.

  8. On the next page of the wizard, type a name for the data connection, and then click Finish.

  9. To test your changes, click Preview on the Standard toolbar, or press CTRL+SHIFT+B.

  10. To publish the form template, on the File menu, click Publish.

  11. Test the form template thoroughly by opening a form that is based on this form template and filling it out. Verify that the form works as expected.

Top of Page

Change the submit data connection

  1. On the Tools menu, click Data Connections.

  2. In the Data connections for the form template list, click the submit data connection in the main data connection, and then click Modify.

  3. In the Data Connection Wizard, type the location of the new Web service where your users will submit their forms, and then click Next.

    Note: If you want to search for a Web service by using a Universal Description Discovery and Integration (UDDI) server, click Search UDDI, enter the URL of the UDDI server that you want to search, specify whether you want to search by provider or by a service that is provided, enter a search keyword, and then click Search. Web services that match your search keyword will appear in the Search result list. Select the Web service that you want to use, and then click OK.

  4. On the next page of the wizard, in the Select an operation list, click the Web service operation that takes the submitted data, and then click Next.

  5. On the next page of the wizard, to select what data in the form to submit for each parameter in the Web service, do one of the following:

    Submit the data in a field or group

    1. In the Parameters list, click the Web service parameter that will receive the data from the form.

    2. Under Parameter options, click Field or group.

    3. Click Modify Data Source button .

    4. In the Select a Field or Group dialog box, click the field or group whose data you want to submit, and then click OK.

    5. In the Include box, click Text and child elements only to submit just the data in this field and the child elements of the field or group, or click XML subtree, including selected element to submit the field name, the data in the field, and the child elements in the selected group or field.

    Submit all of the data in the form

    1. In the Parameters list, click the Web service parameter that will receive the data from the form.

    2. Under Parameter options, click Entire form (XML document, including processing instructions).

    Submit the data as a string

    1. In the Parameters list, click the Web service parameter that will receive the data from the form.

    2. Under Parameter options, click Entire form (XML document, including processing instructions).

    3. Select the Submit data as a string check box.

      Note: Typically, you select this check box to submit digitally signed data. In most cases, clear this check box.

    Technical details about ADO.NET DataSet objects

    If the Web service requires an ADO.NET DataSet object, select a dataset node when you configure this data connection. If you use any other type of node for a data connection to a Web service that requires an ADO.NET DataSet, the submit action will fail.

  6. Click Next.

  7. On the next page of the wizard, type a name for the submit data connection, and then click Finish.

Top of Page

No comments:

Post a Comment