Sun Java System Message Queue 4.2 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.


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 by calling its constructor. The following code uses a constructor to create a URLEndpoint.

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

Using the Endpoint to Address a Message

To address a message to an endpoint, specify the endpoint as a parameter to the method, which you use to send a SOAP message.

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();


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.