Transcoding a byte array into a message payload
A mediation can transcode a byte array into a message payload without changing the meaning of the message.
A mediation can reconstruct the message payload from a byte
array, for example after logging a message. To reconstruct the message,
call the method
createDataGraph
provided by the SIDataGraphFactory
API. This method requires a byte array and a format string and creates
a new data graph by parsing the bytes according to the format passed
to the method, as shown in the following example:DataGraph newDataGraph = SIDataGraphFactory.getInstance().createDataGraph(byteArray, newFormat);
The following table describes the rules for transcoding a
byte array into an SIMessage data graph.
Format argument | Pre-conditions | Outcome |
---|---|---|
JMS: | None | Returns null |
JMS:text | java.lang.String(inputBytes, "UTF-8") does
not result in an exception. |
Returns new data graph instance of format JMS:text.
Value of graph at path data/value has
value equal to java.lang.String(inputBytes, "UTF-8") . |
JMS:bytes | inputBytes is not null. |
Returns new data graph instance of format JMS:bytes.
Value of graph at path data/value is
a copy of the inputBytes byte array. |
JMS:stream | Byte array is XML, and is valid with respect
to the JmsStreamBody type of the XML schema definition. |
Returns new data graph instance of format JMS:stream. Value of graph at path data/value has type List, containing a sequence of simple typed values according to the types and values of each of the elements in the XML document. |
JMS:object | Not null Note: You must ensure that the byte
array is a valid serialized object.
|
Returns new data graph instance of format JMS:object.
Value of graph at path data/value is
a copy of the inputBytes byte array. |
SOAP: | The byte buffer contains valid SOAP with respect to the associated WSDL model. | Returns new data graph with type system defined by the WSDL referenced by the byte buffer, and values of the graph defined by the SOAP payload. |
Bean: | The byte buffer contains valid Bean with respect to the associated WSDL model. | Returns new data graph with type system defined by the WSDL referenced by the byte buffer, and values of the graph defined by the Bean payload. |