Use the Data Handler mediation primitive to transform part of a message. The Data Handler primitive is used to convert an element of a message from a physical format to a logical structure, or from a logical structure to a physical format.
The Data Handler mediation primitive transforms a targeted section of a message. The starting point of a transformation is indicated by an XPath expression.
The Data Handler mediation primitive can be used when you are trying to integrate services, and parts of the message are in a format that is not easy to manipulate with existing mediation primitives. The Data Handler primitive can also be used to transform the data in a message into a business object (BO) that can be manipulated by other mediation primitives. The part of the message not referenced by the XPath expression is left unmodified.
The Data Handler primitive has one input terminal (in), one output terminal (out), and a fail terminal (fail). The in terminal is wired to accept a message and the other terminals are wired to propagate a message. The input message triggers a transformation and if the transformation is successful, the out terminal propagates the modified message. If an exception occurs during the transformation, the fail terminal propagates the input message, together with any exception information contained in the failInfo element.
The Data Handler primitive gives you a simple mechanism for manipulating messages, using the data handler framework in the run time. You can change any section of the service message objects (SMO) using the Data Handler primitive.
You need to configure a data handler for this primitive. You can generate a configuration file using the Binding Resource Configuration panel. You must ensure that the data handler is compatible with the source and target elements identified by the XPath expressions.
You can use the Data Handler primitive to convert a physical format, such as a Text string inside a JMS Text Message object, into a logical BO structure and back again. This allows the transformation of the physical format into the specific BO to be completed in the mediation flow component, instead of the export and import.
Property | Valid values | Default | ||
---|---|---|---|---|
Data handler configuration | String | |||
Output message field refinements | Weakly typed field | XPath | ||
Actual field type | ||||
Action | Convert from native data format to a business object or Convert from a business object to native data format | Convert from native data format to a business object | ||
Source XPath | XPath | |||
Target XPath | XPath |
Source XPATH: /body/message/value Target XPATH: /body Data handler configuration: Point to a configuration of the XML DataHandler without any values specified for the root name or namespace Action: Convert from native data format to a business objectConfigure the response flow as detailed below:
Source XPATH: /body Target XPATH: /body/message/value Binding resources configuration: Point to a configuration of the XML DataHandler without any values specified for the root name or namespace Action: Convert from a business object to native data format Weakly typed field /body/message Actual field type: textBody