Transcoding a message payload into a byte array
You can transcode the message payload into a byte array.
For example, you might want to write a mediation handler
that logs a message as a simple byte stream. You can retrieve the
message payload as a byte array by using the method getDataGraphAsBytes.
The following table describes the rules for transcoding an SIMessage
data graph into a byte array.
Datagraph format | Pre-conditions | Outcome | Character set encoding |
---|---|---|---|
JMS: | None | Returns null. | Not applicable. |
JMS:text | None | Returns the result of java.lang.String:getBytes(String charSetName) when applied to the data/value element of the graph, where charSetName = "UTF-8" | UTF-8 |
JMS:bytes | None | Returns a copy of the value of the data/value element of the data graph for the message. | Not applicable. |
JMS:stream | None | Returns a byte buffer containing an XML serialization of the stream message according to the XML schema for stream messages. | UTF-8 |
JMS:object | None | Returns a copy of the value of the data/value element of the data graph for the message. | Not applicable. |
SOAP: | If the byte array must be generated by this operation (instead of using an existing byte array available through lazy parsing) then the data graph must be valid with respect to the WSDL model. | Returns a byte buffer containing a SOAP serialization of the data graph. If the SOAP message contains an attachment, the buffer has the multipart MIME format. | Either UTF-8, or that of the source message for the graph, where logically equivalent to the graph state. |
Bean: | The data graph must be valid with respect to the WSDL model. In the absence of a SOAP binding the serialization will be performed using RPC/literal encoding. | Returns a byte buffer containing a SOAP serialization of the data graph. If the Bean contains attachments then the buffer will be in multipart MIME format. | UTF-8 |