org.jboss.axis.client
Class Service

java.lang.Object
  extended byorg.jboss.axis.client.Service
All Implemented Interfaces:
javax.naming.Referenceable, java.io.Serializable, Service (src)
Direct Known Subclasses:
ServiceImpl (src)

public class Service
extends java.lang.Object
implements Service (src) , java.io.Serializable, javax.naming.Referenceable

Axis' JAXRPC Dynamic Invoation Interface implementation of the Service interface.

The Service class should be used a the starting point for access SOAP Web Services. Typically, a Service will be created with a WSDL document and along with a serviceName you can then ask for a Call object that will allow you to invoke a Web Service.

See Also:
Serialized Form

Nested Class Summary
protected static class Service.HandlerRegistryImpl (src)
           
 
Field Summary
protected static java.util.HashMap cachedWSDL
           
protected static boolean cachingWSDL
           
protected  EngineConfiguration (src) config
           
protected  AxisEngine (src) engine
           
protected  QName (src) serviceName
           
protected  java.lang.String wsdlLocation
           
protected  javax.wsdl.Service wsdlService
           
 
Constructor Summary
Service()
          Constructs a new Service object - this assumes the caller will set the appropriate fields by hand rather than getting them from the WSDL.
Service(EngineConfiguration (src)  config)
          Constructs a new Service object as above, but also passing in the EngineConfiguration which should be used to set up the AxisClient.
Service(java.io.InputStream wsdlInputStream, QName (src)  serviceName)
          Constructs a new Service object for the service in the WSDL document in the wsdlInputStream and serviceName parameters.
Service(Parser (src)  parser, QName (src)  serviceName)
          Constructs a new Service object for the service in the WSDL document
Service(QName (src)  serviceName)
          Constructs a new Service object - this assumes the caller will set the appropriate fields by hand rather than getting them from the WSDL.
Service(java.lang.String wsdlLocation, QName (src)  serviceName)
          Constructs a new Service object for the service in the WSDL document pointed to by the wsdlLocation and serviceName parameters.
Service(java.net.URL wsdlDoc, QName (src)  serviceName)
          Constructs a new Service object for the service in the WSDL document pointed to by the wsdlDoc URL and serviceName parameters.
 
Method Summary
 Call (src) createCall()
          Creates a new Call object with no prefilled data.
 Call (src) createCall(QName (src)  portName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
 Call (src) createCall(QName (src)  portName, QName (src)  operationName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
 Call (src) createCall(QName (src)  portName, java.lang.String operationName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
protected  AxisClient (src) getAxisClient()
           
 boolean getCacheWSDL()
          Tells whether or not we're caching WSDL
 Call (src) [] getCalls(QName (src)  portName)
          Gets an array of preconfigured Call objects for invoking operations on the specified port.
 AxisEngine (src) getEngine()
          Returns the current AxisEngine used by this Service and all of the Call objects created from this Service object.
protected  EngineConfiguration (src) getEngineConfiguration()
          Constructs a EngineConfig if one is not available.
protected  java.rmi.Remote getGeneratedStub(QName (src)  portName, java.lang.Class proxyInterface)
          With the proxyInterface and the service's portName, we have ALMOST enough info to find a generated stub.
 HandlerRegistry (src) getHandlerRegistry()
          Returns the configured HandlerRegistry instance for this Service instance.
 boolean getMaintainSession()
          If true, this service wants to track sessions.
protected  Parser (src) getParser()
          Stub out, to give clients the cahnce to modify parser properties TDI 15-Jun-2004
 java.rmi.Remote getPort(java.lang.Class proxyInterface)
          Return a dynamic proxy for the given proxy interface.
 java.rmi.Remote getPort(QName (src)  portName, java.lang.Class proxyInterface)
          Return either an instance of a generated stub, if it can be found, or a dynamic proxy for the given proxy interface.
 java.rmi.Remote getPort(java.lang.String endpoint, java.lang.Class proxyInterface)
          Return an object which acts as a dynamic proxy for the passed interface class.
protected  java.rmi.Remote getPort(java.lang.String endpoint, QName (src)  portName, java.lang.Class proxyInterface)
           
 java.util.Iterator getPorts()
          Returns an Iterator for the list of QNames of service endpoints grouped by this service
 javax.naming.Reference getReference()
          Returns a reference to this object.
 QName (src) getServiceName()
          Returns the qualified name of the service (if one is set).
protected  java.lang.String getTargetEnpointAddress()
          The service may provide the target endpoint address, in case the client wsdl port does not contain a valid address.
 TypeMappingRegistry (src) getTypeMappingRegistry()
          Returns the current TypeMappingRegistry or null.
 java.net.URL getWSDLDocumentLocation()
          Returns the location of the WSDL document used to prefill the data (if one was used at all).
 Parser (src) getWSDLParser()
           
protected  Port getWSDLPort(java.lang.Class seiClass)
          Get the WSDL Port for a given service endpoint interface

This implementation gets the wsdl port that corresponds to the class name, if not found it just get the first one we have.

protected  javax.wsdl.Service getWSDLService()
           
 void setCacheWSDL(boolean flag)
          Allows users to turn caching of WSDL documents on or off.
 void setEngine(AxisEngine (src)  engine)
          Sets this Service's AxisEngine.
 void setEngineConfiguration(EngineConfiguration (src)  config)
          Set this Service's engine configuration.
 void setMaintainSession(boolean yesno)
          Determine whether we'd like to track sessions or not.
 void setTypeMappingRegistry(TypeMappingRegistry (src)  registry)
          Defines the current Type Mappig Registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine

protected transient AxisEngine (src)  engine

config

protected transient EngineConfiguration (src)  config

serviceName

protected QName (src)  serviceName

wsdlLocation

protected java.lang.String wsdlLocation

wsdlService

protected javax.wsdl.Service wsdlService

cachedWSDL

protected static java.util.HashMap cachedWSDL

cachingWSDL

protected static boolean cachingWSDL
Constructor Detail

Service

public Service()
Constructs a new Service object - this assumes the caller will set the appropriate fields by hand rather than getting them from the WSDL.


Service

public Service(QName (src)  serviceName)
Constructs a new Service object - this assumes the caller will set the appropriate fields by hand rather than getting them from the WSDL.


Service

public Service(EngineConfiguration (src)  config)
Constructs a new Service object as above, but also passing in the EngineConfiguration which should be used to set up the AxisClient.


Service

public Service(java.net.URL wsdlDoc,
               QName (src)  serviceName)
        throws ServiceException (src) 
Constructs a new Service object for the service in the WSDL document pointed to by the wsdlDoc URL and serviceName parameters.

Parameters:
wsdlDoc - URL of the WSDL document
serviceName - Qualified name of the desired service
Throws:
ServiceException (src) - If there's an error finding or parsing the WSDL

Service

public Service(Parser (src)  parser,
               QName (src)  serviceName)
        throws ServiceException (src) 
Constructs a new Service object for the service in the WSDL document

Parameters:
parser - Parser for this service
serviceName - Qualified name of the desired service
Throws:
ServiceException (src) - If there's an error

Service

public Service(java.lang.String wsdlLocation,
               QName (src)  serviceName)
        throws ServiceException (src) 
Constructs a new Service object for the service in the WSDL document pointed to by the wsdlLocation and serviceName parameters. This is just like the previous constructor but instead of URL the wsdlLocation parameter points to a file on the filesystem relative to the current directory.

Parameters:
wsdlLocation - Location of the WSDL relative to the current dir
serviceName - Qualified name of the desired service
Throws:
ServiceException (src) - If there's an error finding or parsing the WSDL

Service

public Service(java.io.InputStream wsdlInputStream,
               QName (src)  serviceName)
        throws ServiceException (src) 
Constructs a new Service object for the service in the WSDL document in the wsdlInputStream and serviceName parameters. This is just like the previous constructor but instead of reading the WSDL from a file (or from a URL) it is in the passed in InputStream.

Parameters:
wsdlInputStream - InputStream containing the WSDL
serviceName - Qualified name of the desired service
Throws:
ServiceException (src) - If there's an error finding or parsing the WSDL
Method Detail

getParser

protected Parser (src)  getParser()
Stub out, to give clients the cahnce to modify parser properties TDI 15-Jun-2004


getWSDLService

protected javax.wsdl.Service getWSDLService()

getWSDLParser

public Parser (src)  getWSDLParser()

getAxisClient

protected AxisClient (src)  getAxisClient()

getPort

public java.rmi.Remote getPort(QName (src)  portName,
                               java.lang.Class proxyInterface)
                        throws ServiceException (src) 
Return either an instance of a generated stub, if it can be found, or a dynamic proxy for the given proxy interface.

Specified by:
getPort in interface Service (src)
Parameters:
portName - The name of the service port
proxyInterface - The Remote object returned by this method will also implement the given proxyInterface
Returns:
java.rmi.Remote The stub implementation.
Throws:
ServiceException (src) - If there's an error

getGeneratedStub

protected java.rmi.Remote getGeneratedStub(QName (src)  portName,
                                           java.lang.Class proxyInterface)
                                    throws ServiceException (src) 
With the proxyInterface and the service's portName, we have ALMOST enough info to find a generated stub. The generated stub is named after the binding, which we can get from the service's port. This binding is likely in the same namespace (ie, package) that the proxyInterface is in. So try to find and instantiate .Stub. If it doesn't exist, return null.

Throws:
ServiceException (src)

getPort

public java.rmi.Remote getPort(java.lang.Class proxyInterface)
                        throws ServiceException (src) 
Return a dynamic proxy for the given proxy interface.

Specified by:
getPort in interface Service (src)
Parameters:
proxyInterface - The Remote object returned by this method will also implement the given proxyInterface
Returns:
java.rmi.Remote The stub implementation
Throws:
ServiceException (src) - If there's an error

getWSDLPort

protected Port getWSDLPort(java.lang.Class seiClass)
                    throws ServiceException (src) 
Get the WSDL Port for a given service endpoint interface

This implementation gets the wsdl port that corresponds to the class name, if not found it just get the first one we have.

Parameters:
seiClass - The service endpoint interface class
Returns:
A wsdl Port
Throws:
ServiceException (src) - If there's an error

getPort

public java.rmi.Remote getPort(java.lang.String endpoint,
                               java.lang.Class proxyInterface)
                        throws ServiceException (src) 
Return an object which acts as a dynamic proxy for the passed interface class. This is a more "dynamic" version in that it doesn't actually require WSDL, simply an endpoint address.

Note: Not part of the JAX-RPC spec.

Parameters:
endpoint - the URL which will be used as the SOAP endpoint
proxyInterface - the interface class which we wish to mimic via a dynamic proxy
Throws:
ServiceException (src)

getPort

protected java.rmi.Remote getPort(java.lang.String endpoint,
                                  QName (src)  portName,
                                  java.lang.Class proxyInterface)
                           throws ServiceException (src) 
Throws:
ServiceException (src)

createCall

public Call (src)  createCall(QName (src)  portName)
                throws ServiceException (src) 
Creates a new Call object - will prefill as much info from the WSDL as it can. Right now it's just the target URL of the Web Service.

Specified by:
createCall in interface Service (src)
Parameters:
portName - PortName in the WSDL doc to search for
Returns:
Call Used for invoking the Web Service
Throws:
ServiceException (src) - If there's an error

getTargetEnpointAddress

protected java.lang.String getTargetEnpointAddress()
The service may provide the target endpoint address, in case the client wsdl port does not contain a valid address. This maybe the case for ws4ee clients that use a port-component-link element.


createCall

public Call (src)  createCall(QName (src)  portName,
                       java.lang.String operationName)
                throws ServiceException (src) 
Creates a new Call object - will prefill as much info from the WSDL as it can. Right now it's target URL, SOAPAction, Parameter types, and return type of the Web Service.

Specified by:
createCall in interface Service (src)
Parameters:
portName - PortName in the WSDL doc to search for
operationName - Operation(method) that's going to be invoked
Returns:
Call Used for invoking the Web Service
Throws:
ServiceException (src) - If there's an error

createCall

public Call (src)  createCall(QName (src)  portName,
                       QName (src)  operationName)
                throws ServiceException (src) 
Creates a new Call object - will prefill as much info from the WSDL as it can. Right now it's target URL, SOAPAction, Parameter types, and return type of the Web Service.

Specified by:
createCall in interface Service (src)
Parameters:
portName - PortName in the WSDL doc to search for
operationName - Operation(method) that's going to be invoked
Returns:
Call Used for invoking the Web Service
Throws:
ServiceException (src) - If there's an error

createCall

public Call (src)  createCall()
                throws ServiceException (src) 
Creates a new Call object with no prefilled data. This assumes that the caller will set everything manually - no checking of any kind will be done against the WSDL.

Specified by:
createCall in interface Service (src)
Returns:
Call Used for invoking the Web Service
Throws:
ServiceException (src) - If there's an error

getCalls

public Call (src) [] getCalls(QName (src)  portName)
                throws ServiceException (src) 
Gets an array of preconfigured Call objects for invoking operations on the specified port. There is one Call object per operation that can be invoked on the specified port. Each Call object is pre-configured and does not need to be configured using the setter methods on Call interface.

This method requires the Service implementation class to have access to the WSDL related metadata.

Specified by:
getCalls in interface Service (src)
Parameters:
portName - Qualified name for the target service endpoint
Returns:
Call[] Array of pre-configured Call objects
Throws:
ServiceException (src) - - If this Service class does not have access to the required WSDL metadata or if an illegal portName is specified.

getHandlerRegistry

public HandlerRegistry (src)  getHandlerRegistry()
Returns the configured HandlerRegistry instance for this Service instance.

NOTE: This Service currently does not support the configuration of a HandlerRegistry! It will throw a java.lang.UnsupportedOperationException.

Specified by:
getHandlerRegistry in interface Service (src)
Returns:
HandlerRegistry
Throws:
java.lang.UnsupportedOperationException - - if the Service class does not support the configuration of a HandlerRegistry.

getWSDLDocumentLocation

public java.net.URL getWSDLDocumentLocation()
Returns the location of the WSDL document used to prefill the data (if one was used at all).

Specified by:
getWSDLDocumentLocation in interface Service (src)
Returns:
URL URL pointing to the WSDL doc

getServiceName

public QName (src)  getServiceName()
Returns the qualified name of the service (if one is set).

Specified by:
getServiceName in interface Service (src)
Returns:
QName Fully qualified name of this service.

getPorts

public java.util.Iterator getPorts()
                            throws ServiceException (src) 
Returns an Iterator for the list of QNames of service endpoints grouped by this service

Specified by:
getPorts in interface Service (src)
Returns:
Returns java.util.Iterator with elements of type javax.xml.namespace.QName
Throws:
ServiceException (src) - If this Service class does not have access to the required WSDL metadata

setTypeMappingRegistry

public void setTypeMappingRegistry(TypeMappingRegistry (src)  registry)
                            throws ServiceException (src) 
Defines the current Type Mappig Registry.

Parameters:
registry - The TypeMappingRegistry
Throws:
ServiceException (src) - if there's an error

getTypeMappingRegistry

public TypeMappingRegistry (src)  getTypeMappingRegistry()
Returns the current TypeMappingRegistry or null.

Specified by:
getTypeMappingRegistry in interface Service (src)
Returns:
TypeMappingRegistry The registry

getReference

public javax.naming.Reference getReference()
Returns a reference to this object.

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
Reference ...

setEngine

public void setEngine(AxisEngine (src)  engine)
Sets this Service's AxisEngine. This engine will be shared by all Call objects created from this Service object.

Note: Not part of the JAX-RPC spec.

Parameters:
engine - Sets this Service's AxisEngine to the passed in one

getEngine

public AxisEngine (src)  getEngine()
Returns the current AxisEngine used by this Service and all of the Call objects created from this Service object.

Note: Not part of the JAX-RPC spec.

Returns:
AxisEngine the engine

setEngineConfiguration

public void setEngineConfiguration(EngineConfiguration (src)  config)
Set this Service's engine configuration.

Note that since all of the constructors create the AxisClient right now, this is basically a no-op. Putting it in now so that we can make lazy engine instantiation work, and not have to duplicate every single Service constructor with a EngineConfiguration argument.

If you need to use a non-default EngineConfiguration, do the following before calling the Service constructor:

AxisProperties.setProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME, "classname.of.new.EngineConfigurationFactory");

Where the second parameter is the name of your new class that implements EngineConfigurationFactory and a
public static EngineConfigurationFactory newFactory(Object param)
method. See EngineConfigurationFactoryDefault for an example of how to do this.

This way, when the Service class constructor calls

EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig() the getClientEngineConfig() of your own EngineConfigurationFactory will be called, and your configuration will be used in the constructed Service object.

Another way is to use the "discovery" method of EngineConfigurationFactoryFinder.

Parameters:
config - the EngineConfiguration we want to use.

getEngineConfiguration

protected EngineConfiguration (src)  getEngineConfiguration()
Constructs a EngineConfig if one is not available.


setMaintainSession

public void setMaintainSession(boolean yesno)
Determine whether we'd like to track sessions or not. This information is passed to all Call objects created from this service. Calling setMaintainSession will only affect future instantiations of the Call object, not those that already exist.

Note: Not part of JAX-RPC specification.

Parameters:
yesno - true if session state is desired, false if not.

getMaintainSession

public boolean getMaintainSession()
If true, this service wants to track sessions.


getCacheWSDL

public boolean getCacheWSDL()
Tells whether or not we're caching WSDL


setCacheWSDL

public void setCacheWSDL(boolean flag)
Allows users to turn caching of WSDL documents on or off. Default is 'true' (on).