Sun Java System Message Queue 3.7 UR1 Technical Overview

Working with SOAP Messages

SOAP (see SOAP Support for Java Clients) allows for the exchange of structured data (specified by an XML scheme) between two peers in a distributed environment. Sun’s implementation of SOAP does not currently support reliable SOAP messaging nor does it support publishing SOAP messages. However, you can use the Message Queue service to obtain reliable SOAP messaging and, if desired, to publish SOAP messages. The Message Queue service does not deliver SOAP messages directly, but it allows you to wrap SOAP messages into JMS messages, to produce and consume these messages like normal JMS messages, and to extract the SOAP message from the JMS message.

Message Queue provides SOAP support through two packages: javax.xml.messaging and com.sun.messaging.xml. You can use classes implemented in these libraries to receive a SOAP message, to wrap a SOAP message into a JMS message, and to extract a SOAP message from a JMS message. The J2EE platform provides the package java.xml.soap, which you can use to assemble and disassemble a SOAP message.

ProcedureTo Get Reliable SOAP Messaging

  1. Use the objects defined in the java.xml.soap package to construct a SOAP message, or use the servlet defined in thejavax.xml.messaging package to receive a SOAP message, or use a web service like JAX-RPC to receive a SOAP message.

  2. Use the Message Transformer utility to convert the SOAP message into a JMS message.

  3. Send the JMS message to the desired destination.

  4. Consume the JMS message asynchronously or synchronously.

  5. After the JMS message is consumed, use the Message Transformer utility to convert it into a SOAP message.

  6. Use the SAAJ API (defined in the java.xml.soap package) to disassemble the SOAP message.

    For detailed information about SOAP messages and their processing, see Chapter 5, Working with SOAP Messages, in Sun Java System Message Queue 3.7 UR1 Developer’s Guide for Java Clients.