A JAXM client performs the following steps to create a
message.
Creates a MessageFactory object from a
ProviderConnection object (con in the
following line of code). The String passed to
the createMessageFactory method is the name of
of a messaging profile, which must be the URL for the
schema.
Calls the method createMessage on the
MessageFactory object. All messages produced by this
MessageFactory object will have the header
information appropriate for the messaging profile that was
specified when the MessageFactory object was
created.
SOAPMessage m = mf.createMessage();
It is also possible to create a MessageFactory
object using the method newInstance, as shown in
the following line of code.
MessageFactory mf = MessageFactory.newInstance();
A standalone client (a client that is not running in a
container) can use the newInstance method to
create a MessageFactory object.
All MessageFactory objects, regardless of how
they are created, will produce SOAPMessage objects
that have the following elements by default:
A SOAPPart object
A SOAPEnvelope object
A SOAPBody object
A SOAPHeader object
If a MessageFactory object was created using a
ProviderConnection object, which means that it was
initialized with a specified profile, it will produce messages
that also come prepopulated with additional entries in the
SOAPHeader object and the SOAPBody
object. The content of a new SOAPMessage object
depends on which of the two MessageFactory methods
is used to create it.
createMessage() -- message has no
content
This is the method clients would normally use to create a
request message.
createMessage(MimeHeaders,
java.io.InputStream) -- message has content from the
InputStream object and headers from the
MimeHeaders object
This method can be used internally by a service
implementation to create a message that is a response to a
request.
A factory for creating
SOAPMessageobjects.A JAXM client performs the following steps to create a message.
-
Creates a
-
Calls the method
It is also possible to create aMessageFactoryobject from aProviderConnectionobject (conin the following line of code). TheStringpassed to thecreateMessageFactorymethod is the name of of a messaging profile, which must be the URL for the schema.MessageFactory mf = con.createMessageFactory(schemaURL);createMessageon theMessageFactoryobject. All messages produced by thisMessageFactoryobject will have the header information appropriate for the messaging profile that was specified when theMessageFactoryobject was created.SOAPMessage m = mf.createMessage();MessageFactoryobject using the methodnewInstance, as shown in the following line of code.MessageFactory mf = MessageFactory.newInstance();A standalone client (a client that is not running in a container) can use thenewInstancemethod to create aMessageFactoryobject.All
MessageFactoryobjects, regardless of how they are created, will produceSOAPMessageobjects that have the following elements by default:- A
- A
- A
- A
If aSOAPPartobjectSOAPEnvelopeobjectSOAPBodyobjectSOAPHeaderobjectMessageFactoryobject was created using aProviderConnectionobject, which means that it was initialized with a specified profile, it will produce messages that also come prepopulated with additional entries in theSOAPHeaderobject and theSOAPBodyobject. The content of a newSOAPMessageobject depends on which of the twoMessageFactorymethods is used to create it.createMessage()-- message has no contentThis is the method clients would normally use to create a request message.
createMessage(MimeHeaders, java.io.InputStream)-- message has content from theInputStreamobject and headers from theMimeHeadersobjectThis method can be used internally by a service implementation to create a message that is a response to a request.