Sun Java System Message Queue 3.7 UR1 Developer's Guide for Java Clients

Destination, Message Factory, and Connection Objects

SOAP messaging occurs when a SOAP message, produced by a message factory , is sent to an endpoint by way of a connection .

If you are working without a provider, you must do the following:

If you are working with a provider, you must do the following:

The following three sections describe endpoint, message factory, and connection objects in greater detail.

Endpoint

An endpoint identifies the final destination of a message. An endpoint is defined either by the Endpoint class (if you use a provider) or by the URLEndpoint class (if you don’t use a provider).)

Constructing an Endpoint

You can initialize an endpoint either by calling its constructor or by looking it up in a naming service. For information about creating administered objects for endpoints, see Using SOAP Administered Objects.

The following code uses a constructor to create a URLEndpoint:

myEndpoint = new URLEndpoint("http://somehost/myServlet");

Using the Endpoint to Address a Message

If you are using a provider, the Message Factory creating the message includes the endpoint specification in the message header.

If you do not use a provider, you can specify the endpoint as a parameter to the SOAPConnection.call method, which you use to send a SOAP message.

Sending a Message to Multiple Endpoints

If you are using an administered object to define an endpoint, note that it is possible to associate that administered object with multiple URLs--each URL, is capable of processing incoming SOAP messages. The code sample below associates the endpoint whose lookup name is myEndpoint with two URLs: http://www.myServlet1/ and http://www.myServlet2/.


imqobjmgr add
    -t e
    -l "cn=myEndpoint"
    -o "imqSOAPEndpointList=http://www.myServlet1/
                                     http://www.myServlet2/" 

This syntax allows you to use a SOAP connection to publish a SOAP message to multiple endpoints. For additional information about the endpoint administered object, see Using SOAP Administered Objects.

Message Factory

You use a Message Factory to create a SOAP message.

To instantiate a message factory directly, use a statement like the following:

MessageFactory mf = MessageFactory.newInstance();

Connection

To send a SOAP message using SAAJ, you must obtain a SOAPConnection . You can also transport a SOAP message using Message Queue; for more information, see Integrating SOAP and Message Queue.

SOAP Connection

A SOAPConnection allows you to send messages directly to a remote party. You can obtain a SOAPConnection object simply by calling the static method SOAPConnectionFactory.newInstance(). Neither reliability nor security are guaranteed over this type of connection.