public abstract class ServiceFactory {
// Protected Constructors
protected ServiceFactory( );
// Public Constants
public static final String SERVICEFACTORY_PROPERTY;
// ="javax.xml.rpc.ServiceFactory"
// Public Class Methods
public static ServiceFactory newInstance( ) throws ServiceException;
// Public Instance Methods
public abstract javax.xml.rpc.Service createService(javax.xml.namespace.QName serviceName)
throws ServiceException;
public abstract javax.xml.rpc.Service createService(java.net.URL wsdlDocumentLocation,
javax.xml.namespace.QName serviceName) throws ServiceException;
}
ServiceFactory is a factory object used to create
Service objects. To obtain an instance of
this abstract class, use the static newInstance( )
method, which attempts to locate a suitable concrete implementation
as follows:
Looks in the system properties for a property called
javax.xml.rpc.ServiceFactory. If this property is
defined, its value is assumed to be the class name of a concrete
implementation of ServiceFactory.
Looks for the same property in a file called
${JAVA_HOME}/lib/jaxrpc.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.rpc.ServiceFactory 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
required class name.
Uses an implementation-dependent default class. In the case of the
reference implementation, this class is called
com.sun.xml.rpc.client.ServiceFactoryImpl.
The two createService( ) methods return
Service objects that are intended to be used in
different ways. The two-argument variant requires the location of a
WSDL document and the fully qualified name of a service defined
within that document. The Service object that it
returns has access to all of the service information in the WSDL
document and can be used to make calls on the remote methods of the
service using either dynamic proxies or the DII, both of which are
covered in Chapter 6. The single-argument variant
accepts only a service name and therefore has no information at all
about the service (including whether it exists). A
Service object created using this latter method
can only be used to construct a service endpoint interface call using
the DII and is not able to validate the correctness of these calls
before they are made. Refer to the description of the
Call interface earlier in this chapter for further
information.
ServiceFactory is intended to be used by J2SE
clients that have no container support. Container-resident JAX-RPC
clients, such as servlets or JSP pages, are not expected to use
ServiceFactory. Instead, they typically obtain a
reference to a Service object that has been
configured into their JNDI environment.