Sun GlassFish Message Queue 4.4 Developer's Guide for Java Clients

Example 2: Publishing SOAP Messages

In the next example, illustrated in Figure 5–10, an incoming SOAP message is received by a servlet. The servlet packages the SOAP message as a JMS message and (reliably) forwards it to a topic. Each application that subscribes to this topic, receives the JMS message, turns it back into a SOAP message, and processes its contents.

Figure 5–10 Publishing a SOAP Message

Diagram showing how a SOAP message is transformed into
a JMS message, published to listeners, and reconverted into SOAP.

The code that accomplishes this is exactly the same as in the previous example, except that instead of sending the JMS message to a queue, you send it to a topic. For an example of publishing a SOAP message using Message Queue, see Example 5–5.