REST Web Service Consumer Transformation Output Mapping
When you view the transformation ports, show the output mapping to view the method output hierarchy. When you show the output mapping, you can define output groups, define output ports, and map method output elements to output ports.
The output mapping includes the following areas:
- Method Output
- The Method Output area shows the elements in the response message that the web service returns to the REST Web Service Consumer transformation. If you use a schema object to create the transformation, the schema object defines the method output hierarchy.
- Ports
- Create the transformation output groups and ports in the Ports area.
After you create output ports, map the elements from the Method Output area to the ports in the Ports area. When you map an element from the method output to an output port, the location of the element appears in the Location column in the Ports area.
The Developer tool maps elements in the first level of the method output to output ports when you choose to map the first level of the output 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 display the output ports in a hierarchy. Each child group appears under the parent group. You can also choose to view the lines that connect the elements in the method output to the output ports.
If the associated schema object is deleted from the repository, the Developer tool retains the location of the method elements in the output mapping. When you show the output mapping, the Ports area still displays the location of the method elements in the Location column for the output ports. If you associate another schema with the transformation, the Developer tool checks whether each location is valid. The Developer tool clears the location of method elements in the Ports area of the output mapping if the location is no longer valid.
Rules and Guidelines to Map Elements to Output Ports
Review the following rules when you map elements in the method output hierarchy to output ports:
- •The method output element and the output port must have compatible datatypes.
- •You cannot map an element to more than one output port in a group.
- •Each output port must have a valid location, unless the port is a pass-through port.
- •If you drag a multiple-occurring child element to an empty output port, you must relate the group to other output groups. When you select a group, the Developer tool creates keys to relate the groups.
- •When you drag a multiple-occurring element into a group that contains the parent element, you can configure the number of child element occurrences to include. Or, you can replace the parent group with the multiple-occurring child group in the transformation output.
- •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 in the output ports.
Customize View Options
You can change the method output hierarchy to show the cookie ports, pass-through ports, and keys in the Method Output area. You can also show grouping constructs that define how to order elements.
Click Customize View in the Method Output area. Enable any of the following options:
- Sequence, Choice, and All
Show a line that indicates whether an element definition is sequence, choice, or all.
Elements in a sequence group must be in the order specified in the hierarchy.
At least one element in a choice group must appear in the response message.
Elements in an all group must all be included in the response message.
- Keys
- View the keys in the Method Output area. The Method Output area includes keys for each group. You can add a key to an output port in the Ports area.
- Pass-through Ports
- The Method Output area shows the pass-through ports. Pass-through ports are ports that pass data through the transformation without changing the data. You can project pass-through ports from the method output to any of the REST Web Service Consumer transformation output groups. A pass-through port receives data one time, so the port is at the root level in the response messages.
Mapping the Method Output to Output Ports
When you show the transformation output mapping, you can define output groups, define output ports, and map method output elements to output ports.
1. Open a REST Web Service Consumer transformation.
2. In the Ports view, show the output mapping.
3. To add an output 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 in the Method Output 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. |
4. If you manually create a port or you copy a port from another transformation, click the Location column in the Ports area, and choose an element from the list.
5. To clear the locations of ports, use one of the following methods:
Method | Description |
---|
Click Clear. | Select one or more ports in the Ports area, and click Clear. |
Delete the lines that connect elements to ports. | Select one or more lines that connect the elements in the method output to the output ports, and press Delete. |