WebSphere WebSphere Application Server Network Deployment, Version 6.1.x Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows, z/OS

Serializing the content of SIMessage

Use this task to convert an SIMessage object to a byte array.

About this task
If you want to save an SIMessage object in your local file system or in a database, you must first convert the object to a byte array and format string. You can reconstruct the message from the byte array and format string. To do this, take the following steps:

Procedure

  1. In your application program, record the format string associated with the SIMessage instance. For example:
    String savedFormat=message.getFormat();
  2. Call the getDataGraphAsBytes. For example:
    Bytes newDataGraph = message.getNewDataGraph(newFormat);
    This method returns a copy of the payload as a byte stream. You can store the bytes and the associated format string, as you require.
  3. To reconstruct the message, call the method createDataGraph provided by the SIDataGraphFactory API. This method requires a byte array and a format string. For example:
    DataGraph newDataGraph = SIDataGraphFactory.getInstance().createDataGraph(byteArray, newFormat);
    This method creates a new data graph by parsing the bytes according to the format passed to the method.
What to do next
You can use the newly created datagraph as the payload of an SIMessage instance by using the SIMessage setDataGraph() method. For example:
newMessage.setDataGraph(newDataGraph, savedFormat);
Related concepts
Coding considerations for mediations
Related reference
Message properties support for mediations

Task topic

Terms of use | Feedback


Timestamp icon Last updated: 26 February 2009
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.pmc.nd.multiplatform.doc/tasks/tjy1520_.html

Copyright IBM Corporation 2004, 2009. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)