Name

MessageFactory

Synopsis

public abstract class MessageFactory {
// Public Constructors
    public MessageFactory(  ); 
// Public Class Methods
    public static MessageFactory newInstance(  ) throws SOAPException; 
// Public Instance Methods
    public abstract SOAPMessage createMessage(  ) throws SOAPException; 
    public abstract SOAPMessage createMessage(MimeHeaders headers, 
    java.io.InputStream in) throws java.io.IOExceptionSOAPException; 
}

MessageFactory is an abstract base class that provides the methods used by application code to construct SOAP messages. A SAAJ application obtains an instance of this class by calling the static newInstance( ) method, which looks for a suitable concrete implementation using the following algorithm:

  • Looks in the system properties for a property called javax.xml.soap.MessageFactory. If this property is defined, its value is assumed to be the class name of a concrete implementation of MessageFactory.

  • Looks for the same property in a file called ${JAVA_HOME}/lib/jaxm.properties. If the property is found, its value is assumed to be the required class name.

  • Looks for a resource called META-INF/services/javax.xml.soap.MessageFactory in the classpath. If such a resource exists, it is opened and a single line is read from it. If the line is not empty, it is used as the class name.

  • Finally, an implementation-dependent default class is used. In the case of the reference implementation, this class is called com.sun.xml.messaging.saaj.soap.MessageFactoryImpl.

Once you have a ...

Get Java Web Services in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.