Table of Contents

Search

  1. Preface
  2. Web Services
  3. SOAP Web Services
  4. WSDL Data Object
  5. Schema Object
  6. How to Create a SOAP Web Service
  7. Operation Mappings
  8. Parsing Web Service SOAP Messages
  9. Generating Web Service SOAP Messages
  10. Web Service Consumer Transformation
  11. REST Web Services
  12. How to Create a REST Web Service
  13. REST Web Service Consumer Transformation
  14. REST Web Service Consumer Transformation Use Cases
  15. REST and SOAP Web Service Administration
  16. Datatype Compatibility

Web Services Guide

Web Services Guide

How to Receive Parsed Data from the Web Service

How to Receive Parsed Data from the Web Service

You can parse a message that you receive from the web service. When you parse the message, the REST Web Service Consume transformation receives data according to the structure that you specify for the response message in the method output definition.
For example, you might want to parse the following JSON response message:
{"name":"infa","message":"hello"}
To parse this response message, complete the following steps when you configure the transformation:
  1. In the Developer tool mapping editor, scroll down in the mapping palette to locate the REST Web Service Consumer transformation and drag it to the mapping.
    The
    New REST Web Service Consumer Transformation
    wizard appears.
    This image shows the wizard for the REST Web Service Consumer transformation. In this dialog box, you can configure the transformation name, the location, and the HTTP method.
  2. Enter a name for the transformation.
  3. Next to
    HTTP Method
    , select
    Get
    .
    When you use the Get method, you do not configure an input mapping.
  4. Click
    Next
    .
    The wizard displays a message that input is not applicable when using the Get method.
  5. Click
    Next
    .
  6. Select
    Create as empty
    .
  7. Next to
    Show
    , select
    Output mapping
    .
  8. Design the method output definition based on the response message that you expect to receive.
    The following image shows how the method output definition might appear:
    This image shows a sample method output definition. In this example, the parent element is xmlRoot. The child elements are name and message.
    Although the transformation receives a JSON response from the web service, the Data Integration Service automatically adds a root element named xmlRoot to the JSON response. When you configure the method output definition for a JSON response, configure the same root element xmlRoot.
  9. Select
    Output mapping
    .
  10. Configure the output mapping by dragging ports from the
    Method output definition
    area to the
    Ports
    area.
    The following image shows an example of the output mapping:
    This image shows a sample output mapping. The elements in the Method output definition area are linked to the elements in the Ports area.
  11. Click
    Finish
    .
  12. Select the transformation and navigate to the
    Advanced
    tab.
  13. Configure the
    Output Format
    with
    JSON
    .
    The following image shows how the transformation might appear when it is integrated in a mapping:
    This image shows a sample mapping in the Developer tool. The mapping contains a Read transformation, a REST Web Service Consumer transformation, and a Write transformation. The ports in the Read transformation are linked as input ports in the downstream REST Web Service Consumer transformation. To parse the response that the transformation receives, the name output port in the REST Web Service Consumer transformation is linked to the downstream Write transformation.
    The following image shows the response that might appear when you run the mapping:
    This image shows a sample response that you might receive. In this example, the response shows "infa" in the name port and "hello" in the message port.

0 COMMENTS

We’d like to hear from you!