Network Deployment (Distributed operating systems), v8.0 > Reference > Developer best practices


Transcoding a message payload into a byte array

We can transcode the message payload into a byte array.


Example

For example, you might want to write a mediation handler that logs a message as a simple byte stream. We can retrieve the message payload as a byte array by using the method getDataGraphAsBytes. The table below describes the rules for transcoding an SIMessage data graph into a byte array.

Rules for transcoding a message payload into a byte array . The first column of the table contains the datagraph formats used for transcoding a message into a byte array. The second column provides the preconditions for the datagraph format if available. The third column provides the result of the transcode. The fourth column contains the character set encodings if they are applicable for the messages.

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


Related


Transcoding between message formats

+

Search Tips   |   Advanced Search