public abstract class MessageFactory extends Object
A factory for creating
A JAXM client performs the following steps to create a message.
MessageFactoryobject from a
conin the following line of code). The
Stringpassed to the
createMessageFactorymethod is the name of of a messaging profile, which must be the URL for the schema.
MessageFactory mf = con.createMessageFactory(schemaURL);
MessageFactoryobject. All messages produced by this
MessageFactoryobject will have the header information appropriate for the messaging profile that was specified when the
MessageFactoryobject was created.
SOAPMessage m = mf.createMessage();
MessageFactoryobject 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
newInstancemethod to create a
MessageFactory objects, regardless of how
they are created, will produce
that have the following elements by default:
MessageFactoryobject was created using a
ProviderConnectionobject, which means that it was initialized with a specified profile, it will produce messages that also come prepopulated with additional entries in the
SOAPHeaderobject and the
SOAPBodyobject. The content of a new
SOAPMessageobject depends on which of the two
MessageFactorymethods is used to create it.
createMessage()-- message has no content
createMessage(MimeHeaders, java.io.InputStream)-- message has content from the
InputStreamobject and headers from the
|Constructor and Description|
Create a new MessageFactory.
|Modifier and Type||Method and Description|
Creates a new
Internalizes the contents of the given
Creates a new
public static MessageFactory newInstance() throws SOAPException
MessageFactoryobject that is an instance of the default implementation.
SOAPException- if there was an error in creating the default implementation of the
public abstract SOAPMessage createMessage() throws SOAPException
SOAPMessageobject with the default
SOAPHeaderobjects. Profile-specific message factories can choose to prepopulate the
SOAPMessageobject with profile-specific headers.
Content can be added to this message's
SOAPPart object, and the message can be sent "as is"
when a message containing only a SOAP part is sufficient.
SOAPMessage object needs to
create one or more
AttachmentPart objects and
add them to itself. Any content that is not in XML format
must be in an
SOAPException- if a SOAP error occurs
public abstract SOAPMessage createMessage(MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException
InputStreamobject into a new
SOAPMessageobject and returns the
mimeheaders- the transport-specific headers passed to the message in a transport-independent fashion for creation of the message
InputStreamobject that contains the data for a message
SOAPMessageobject containing the data from the given
IOException- if there is a problem in reading data from the input stream
SOAPException- if the message is invalid