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

ProcedureTo Transform the SOAP Message into a JMS Message and Send the JMS Message

  1. Instantiate a ConnectionFactory object and set its attribute values, for example:

    QueueConnectionFactory myQConnFact =
            new com.sun.messaging.QueueConnectionFactory();
  2. Use the ConnectionFactory object to create a Connection object.

    QueueConnection myQConn =
  3. Use the Connection object to create a Session object.

    QueueSession myQSess = myQConn.createQueueSession(false,
  4. Instantiate a Message Queue Destination administered object corresponding to a physical destination in the Message Queue message service. In this example, the administered object is mySOAPQueue and the physical destination to which it refers is myPSOAPQ.

    Queue mySOAPQueue = new com.sun.messaging.Queue("myPSOAPQ");
  5. Use the MessageTransformer utility, as shown, to transform the SOAP message into a JMS message. For example, given a SOAP message named MySOAPMsg,

    Message MyJMS = MessageTransformer.SOAPMessageIntoJMSMessage
                                         (MySOAPMsg, MyQSess);
  6. Create a QueueSender message producer.

    This message producer, associated with mySOAPQueue, is used to send messages to the queue destination named myPSOAPQ.

    QueueSender myQueueSender = myQSess.createSender(mySOAPQueue);
  7. Send a message to the queue.