REST Web Service Consumer Transformation Input Mapping
When you view the transformation ports, show the input mapping to view the method input hierarchy. When you show the input mapping, you can define input groups, define input ports, and map input ports to method input elements.
The input mapping includes the following areas:
- Ports
- Create the transformation input groups and input ports in the Ports area.
- Method Input
- The Method Input area shows the elements in the request message that the REST Web Service Consumer transformation sends to the web service. If you use a schema object to create the transformation, the schema object defines the method input hierarchy.
After you create input ports, map the input ports from the Ports area to the elements in the Method Input area. When you map an input port to an element in the method input, the location of the port appears in the Location column in the Method Input area.
The Developer tool maps elements in the first level of the method input to input ports when you choose to map the first level of the input hierarchy. The Developer tool also creates the ports to perform the mapping. If the first level of the hierarchy contains a multiple occurring parent element with one or more multiple occurring child elements, the Developer tool does not map the first level of the hierarchy.
You can choose to view the lines that connect the input ports to the elements in the method input.
Rules and Guidelines to Map Input Ports to Elements
Review the following rules when you map input ports to elements in the method input hierarchy:
- •You can map an input port to one element in the hierarchy. You can map the same port to any number of keys in the hierarchy.
- •The input port and the element must have compatible datatypes.
- •You can map ports from one input group to multiple hierarchy levels in the method input.
- •You must map input ports to the keys in the method input. Any port that you map to a key must be of string, integer, or bigint datatype. Map data to the keys in all levels in the method input above the hierarchy level that you are including in the request message. Include the foreign keys for all levels above and including the level you are mapping.
Note: You do not have to map input ports to keys if you are mapping only the lowest level of the method input hierarchy.
- •You must map the RequestInput root element to the child element of Rest_Consumer_input group for method input definition.
- •You can map multiple string, bigint, or integer input ports to a key in the Method Input area to create a composite key. When you click the Location field for a composite key, you can reorder the input ports or remove one of the ports.
- •If the web service produces a JSON document, ensure that xmlRoot is the first node in the response hierarchy. If xmlRoot is not the first node for a web service with JSON response, null values may appear.
Mapping Input Ports to the Method Input
When you show the transformation input mapping, you can define input groups, define input ports, and map input ports to method input elements.
1. Open a REST Web Service Consumer transformation.
2. In the Ports view, show the input mapping.
3. Define a primary key for the root input group.
4. To add an input group or port to the Ports area, use one of the following methods:
Method | Description |
---|
Drag an element. | Drag a group or a child element from the Method Input area to an empty column in the Ports area. If you drag a group to the Ports area, the Developer tool adds a group without ports. |
Manually add a group or port. | To add a group, click the arrow next to the New button, and then click Group. To add a port, click the arrow next to the New button, and then click Field. |
Drag a port from another transformation. | In the editor, drag a port from another transformation to the REST Web Service Consumer transformation. |
Copy a port. | Select ports from another transformation and copy them to the Ports area. To copy ports, you can use keyboard shortcuts or you can use the Copy and Paste buttons in the Developer tool. |
Select Map first level of hierarchy. | The Developer tool maps elements in the first level of the method input to input ports and groups. The Developer tool also creates the input ports and groups to perform the mapping. |
5. If you manually create a port or you copy a port from another transformation, click the Location column in the Method Input area and choose a port from the list.
6. To map input ports as a composite key, use one of the following methods:
Method | Description |
---|
Drag input ports. | Select two or more input ports, and drag them to a key in the method input hierarchy. |
Select input ports from the Select Location dialog box. | Click the Location column of a key in the method input hierarchy and then select the input ports. |
7. To clear the locations of elements, use one of the following methods:
Method | Description |
---|
Click Clear. | Select one or more elements in the Method Input area and click Clear. |
Delete the lines that connect ports to elements. | Select one or more lines that connect the input ports to the elements in the method input, and press Delete. |