Wednesday, 4 January 2012

Invoking a Web Service as a Process

You can invoke a Web service as a process on the page. The process is created for you if you run one of the Create Form wizards for Web services. Running the process submits the request to the service provider. You can then display the request results in report.
To invoke a Web service as a process:
  1. Create a Web Service Reference. See "Creating a Web Service Reference Based on a WSDL", "Creating a Web Service Reference Manually", and"Creating a RESTful Web Service Reference".
  2. Create a page.
    In the Create Page Wizard:
    1. Select Blank Page.
    2. When prompted to use tabs, select No.
  3. Navigate to the Page Definition.
  4. Under Page Rendering or Page Processing, locate the Processes section and click Create.
    The Create Page Processes Wizard appears.
  5. For Process Type, select Web Services and click Next.
  6. For Process Attributes, specify the following:
    1. Name - Enter the process name.
    2. Sequence - Enter the sequence for this component. This specifies the order of evaluation.
    3. Point - Select the processing point.
    4. Click Next.
  7. For Process, specify the following:
    1. Web Service Reference - Select the Web service reference for this process.
      If the Web reference was created from a WSDL or is RESTful style, the Operation selection appears.
    2. Operation (WSDL or RESTful style Web service references only) - Select the Web service operation this process executes.
      The Web Service Input Parameters and Web Service Output Parameters appear.
    3. Under Web Service Input Parameters, specify inputs to the Web service process:
      • Source - Select the source type.
      • Value - Select the source value.
    4. Under Web Service Output Parameters, specify where the results are stored:
      To store the results in a collection:
      • Store Result in - Select Collection.
      • Value - Enter a name for the collection.
      To store the results in items on the page:
      • Store Result in - Select Items.
      • Value - Enter the appropriate item value.
    5. Click Next.
  8. For Messages:
    1. Success Message - Enter the message that displays on the next page when the process runs successfully.
    2. Failure Message - Enter the message that displays when an unhandled exception is raised. After any error processing stops, a rollback is issued and an error message displays.
  9. For Process Conditions:
    1. When Button Pressed - Select that button that causes the process to run.
    2. Condition Type - Select a condition type that must be met in order for this component to be processed. If the condition type requires expressions for comparison, the Expression 1 and possibly Expression 2 fields display. Enter expressions into these fields as required.
  10. Click Create Process.

Displaying Web Service Results in a Report

To create a report in which to display Web Service request results:
  1. Navigate to the Page Definition.
  2. Under Regions, click the Create icon.
    The Create Region Wizard appears.
  3. For the region type, select Report.
  4. For the report implementation, select Report on collection containing Web service result.
  5. On Identify Region Attributes, enter a region title and optionally edit the region attributes.
  6. Choose whether the Web reference was created manually, from a WSDL, or is RESTful style.
  7. If the Web service reference was created from a WSDL:
    1. For Web Service Reference and Operation, select a Web service reference and an operation (that is, the method to be executed).
    2. For Result Tree to Report On, select the portion of the resulting XML document that contains the information you want to include in the report.
    3. For Result Parameters:
      • In Temporary Result Set Name, enter a name for the collection that stores the Web service result.
      • Select and deselect the appropriate parameters.
  8. If the Web service reference was created manually:
    1. Select the Web service reference.
    2. Choose the SOAP style.
    3. Choose the message format.
    4. Enter the XPath expression to the node to report on.
    5. Enter the namespace for the SOAP response envelope and click Next.
    6. Enter the name of the collection where the response message is stored.
    7. Enter the names of the parameters that you want to be included in the report.
  9. If the Web service reference is REST style:
    1. Select the Web service reference.
    2. Enter the name of the collection where the response message is stored.
    3. Choose the report template and the number of rows to display per page.
    4. Select the parameters to be included in the report.
  10. Click Create SQL Report.

No comments:

Post a Comment