Developer Transformation Guide > REST Web Service Consumer Transformation > REST Web Service Consumer Transformation Configuration
  

REST Web Service Consumer Transformation Configuration

When you create a REST Web Service Consumer transformation, you select the HTTP method and define the method input and output. If you select the Get method, you do not define method input.
The input elements in the HTTP request message map to input ports. The output elements in the HTTP response message map to output ports. The Developer tool creates ports for the first level elements.
When you configure the transformation, you complete the following tasks:
  1. 1. Select the HTTP method.
  2. 2. Configure ports to represent elements in the header and body of the request and response messages.
  3. 3. Configure the input mapping.
  4. 4. Configure the output mapping.
  5. 5. Configure advanced properties such as the connection and the base URL for the web service.
If the REST web service requires authentication, create an HTTP connection object.

Message Configuration

The Data Integration Service generates request messages and interprets response messages based on the method input and output and on the ports that you configure in the REST Web Service Consumer transformation.
Input ports represent different parts of the request message. You can add input ports that identify the resource that you want to retrieve or change. You can also add input ports that represent HTTP headers, cookie information, and elements in the request message.
Output ports represent elements in the response message that you want to send to downstream transformations or to the target in a mapping. You can add output ports that represent HTTP headers, cookie information, the response code, and elements in the response message.

Resource Identification

To identify the resource in an HTTP request, the Data Integration Service appends values in specific input ports to the base URL. You define the base URL in the HTTP connection or in the transformation properties. Use URL or argument ports to identify a particular resource.
Use URL ports when the web service identifies a resource through a unique string of characters.
For example, the HypoStores REST web service identifies parts by the part number through the following URL:
http://www.HypoStores.com/products/ProductDetails/<Part_No>
To identify a part, define the following transformation details:
  1. 1. Set the base URL to the following URL:
  2. http://www.HypoStores.com/products/ProductDetails
  3. 2. Define a URL port, and pass the part number to the transformation through the URL port.
If the mapping passes part number 500 to the URL port, the Data Integration Service uses the following URL in the request message:
http://www.HypoStores.com/products/ProductDetails/500
Use argument ports when the web service identifies the location of a resource through arguments.
For example, you want to pass a part number to the HypoStores REST web service through the "Part_No" argument.
To identify a part, define the following transformation details:
  1. 1. Set the base URL to the following URL:
  2. http://www.HypoStores.com/products/ProductDetails
  3. 2. Create an argument port with argument name "Part_No," and pass the part number to the transformation through the argument port.
If the mapping passes part number 600 to the argument port, the Data Integration Service uses the following URL in the request message:
http://www.HypoStores.com/products/ProductDetails?Part_No=600
Create multiple argument ports to define multiple arguments. The Data Integration Service separates each argument with an ampersand character (&).
For example, you want to retrieve employee details from a REST web service and pass the employee first name and last name through the "First_Name" and "Last_Name" arguments. Create argument ports with the argument names "First_Name" and "Last_Name." If the mapping passes the name "John Smith" to the transformation, the Data Integration Service uses a URL like the following in the request message:
http://www.HypoStores.com/employees/EmpDetails?First_Name=John&Last_Name=Smith
If you do not specify a URL or an argument port, the Data Integration Service uses the base URL from the transformation properties or HTTP connection to identify the resource. The base URL in the HTTP connection overrides the base URL in the transformation.