A factory for creating SOAPMessage objects.
A JAXM client performs the following steps to create a message.
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.