Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.client
Class Service  view Service download Service.java

java.lang.Object
  extended byorg.apache.axis.client.Service
All Implemented Interfaces:
javax.naming.Referenceable, java.io.Serializable, javax.xml.rpc.Service

public class Service
extends java.lang.Object
implements javax.xml.rpc.Service, 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.


Nested Class Summary
protected static class Service.HandlerRegistryImpl
           
 
Field Summary
protected  Call _call
           
private static java.util.HashMap cachedWSDL
           
private static boolean cachingWSDL
           
private  org.apache.axis.EngineConfiguration config
           
private  org.apache.axis.AxisEngine engine
           
private  boolean maintainSession
           
private  Service.HandlerRegistryImpl registry
           
private  javax.xml.namespace.QName serviceName
           
private  java.util.Hashtable transportImpls
          A Hashtable mapping addresses (URLs) to Transports (objects)
private  java.lang.String wsdlLocation
           
private  org.apache.axis.wsdl.gen.Parser wsdlParser
           
private  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(org.apache.axis.EngineConfiguration config)
          Constructs a new Service object as above, but also passing in the EngineConfiguration which should be used to set up the AxisClient.
Service(org.apache.axis.EngineConfiguration engineConfiguration, AxisClient axisClient)
          Constructs a Service using the supplied configuration and engine directly.
Service(java.io.InputStream wsdlInputStream, javax.xml.namespace.QName serviceName)
          Constructs a new Service object for the service in the WSDL document in the wsdlInputStream and serviceName parameters.
Service(org.apache.axis.wsdl.gen.Parser parser, javax.xml.namespace.QName serviceName)
          Constructs a new Service object for the service in the WSDL document
Service(javax.xml.namespace.QName 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, javax.xml.namespace.QName 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, javax.xml.namespace.QName serviceName)
          Constructs a new Service object for the service in the WSDL document pointed to by the wsdlDoc URL and serviceName parameters.
 
Method Summary
 javax.xml.rpc.Call createCall()
          Creates a new Call object with no prefilled data.
 javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
 javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName, javax.xml.namespace.QName operationName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
 javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName, java.lang.String operationName)
          Creates a new Call object - will prefill as much info from the WSDL as it can.
protected  AxisClient getAxisClient()
           
 boolean getCacheWSDL()
          Tells whether or not we're caching WSDL
 Call getCall()
          Deprecated. please use Stub._getCall
 javax.xml.rpc.Call[] getCalls(javax.xml.namespace.QName portName)
          Gets an array of preconfigured Call objects for invoking operations on the specified port.
 org.apache.axis.AxisEngine getEngine()
          Returns the current AxisEngine used by this Service and all of the Call objects created from this Service object.
protected  org.apache.axis.EngineConfiguration getEngineConfiguration()
          Constructs a EngineConfig if one is not available.
private  java.rmi.Remote getGeneratedStub(javax.xml.namespace.QName portName, java.lang.Class proxyInterface)
          With the proxyInterface and the service's portName, we have ALMOST enough info to find a generated stub.
 javax.xml.rpc.handler.HandlerRegistry getHandlerRegistry()
          Returns the configured HandlerRegistry instance for this Service instance.
 boolean getMaintainSession()
          If true, this service wants to track sessions.
 java.rmi.Remote getPort(java.lang.Class proxyInterface)
          Return a dynamic proxy for the given proxy interface.
 java.rmi.Remote getPort(javax.xml.namespace.QName 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.
private  java.rmi.Remote getPort(java.lang.String endpoint, javax.xml.namespace.QName 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.
 javax.xml.namespace.QName getServiceName()
          Returns the qualified name of the service (if one is set).
(package private)  Transport getTransportForURL(java.net.URL url)
          Get any registered Transport object for a given URL.
 javax.xml.rpc.encoding.TypeMappingRegistry 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).
 org.apache.axis.wsdl.gen.Parser getWSDLParser()
           
protected  javax.wsdl.Service getWSDLService()
           
private  void initService(org.apache.axis.wsdl.gen.Parser parser, javax.xml.namespace.QName serviceName)
          Code for building up the Service from a Parser
private  void initService(java.lang.String context, org.w3c.dom.Document doc, javax.xml.namespace.QName serviceName)
          Common code for building up the Service from a WSDL document
private  void initService(java.lang.String url, javax.xml.namespace.QName serviceName)
          Common code for building up the Service from a WSDL document
(package private)  void registerTransportForURL(java.net.URL url, Transport transport)
          Register a Transport for a particular URL.
 void setCacheWSDL(boolean flag)
          Allows users to turn caching of WSDL documents on or off.
 void setEngine(org.apache.axis.AxisEngine engine)
          Sets this Service's AxisEngine.
 void setEngineConfiguration(org.apache.axis.EngineConfiguration config)
          Set this Service's engine configuration.
 void setMaintainSession(boolean yesno)
          Determine whether we'd like to track sessions or not.
 void setTypeMappingRegistry(javax.xml.rpc.encoding.TypeMappingRegistry registry)
          Defines the current Type Mappig Registry.
 void setTypeMappingVersion(java.lang.String version)
          Set the typemapping version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine

private transient org.apache.axis.AxisEngine engine

config

private transient org.apache.axis.EngineConfiguration config

serviceName

private javax.xml.namespace.QName serviceName

wsdlLocation

private java.lang.String wsdlLocation

wsdlService

private javax.wsdl.Service wsdlService

maintainSession

private boolean maintainSession

registry

private Service.HandlerRegistryImpl registry

wsdlParser

private org.apache.axis.wsdl.gen.Parser wsdlParser

cachedWSDL

private static java.util.HashMap cachedWSDL

cachingWSDL

private static boolean cachingWSDL

_call

protected Call _call

transportImpls

private java.util.Hashtable transportImpls
A Hashtable mapping addresses (URLs) to Transports (objects)

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(javax.xml.namespace.QName 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(org.apache.axis.EngineConfiguration engineConfiguration,
               AxisClient axisClient)
Constructs a Service using the supplied configuration and engine directly.


Service

public Service(org.apache.axis.EngineConfiguration 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,
               javax.xml.namespace.QName serviceName)
        throws javax.xml.rpc.ServiceException
Constructs a new Service object for the service in the WSDL document pointed to by the wsdlDoc URL and serviceName parameters.


Service

public Service(org.apache.axis.wsdl.gen.Parser parser,
               javax.xml.namespace.QName serviceName)
        throws javax.xml.rpc.ServiceException
Constructs a new Service object for the service in the WSDL document


Service

public Service(java.lang.String wsdlLocation,
               javax.xml.namespace.QName serviceName)
        throws javax.xml.rpc.ServiceException
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.


Service

public Service(java.io.InputStream wsdlInputStream,
               javax.xml.namespace.QName serviceName)
        throws javax.xml.rpc.ServiceException
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.

Method Detail

getWSDLService

protected javax.wsdl.Service getWSDLService()

getWSDLParser

public org.apache.axis.wsdl.gen.Parser getWSDLParser()

getAxisClient

protected AxisClient getAxisClient()

initService

private void initService(java.lang.String url,
                         javax.xml.namespace.QName serviceName)
                  throws javax.xml.rpc.ServiceException
Common code for building up the Service from a WSDL document


initService

private void initService(java.lang.String context,
                         org.w3c.dom.Document doc,
                         javax.xml.namespace.QName serviceName)
                  throws javax.xml.rpc.ServiceException
Common code for building up the Service from a WSDL document


initService

private void initService(org.apache.axis.wsdl.gen.Parser parser,
                         javax.xml.namespace.QName serviceName)
                  throws javax.xml.rpc.ServiceException
Code for building up the Service from a Parser


getPort

public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
                               java.lang.Class proxyInterface)
                        throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

getGeneratedStub

private java.rmi.Remote getGeneratedStub(javax.xml.namespace.QName portName,
                                         java.lang.Class proxyInterface)
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.


getPort

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

Specified by:
getPort in interface javax.xml.rpc.Service

getPort

public java.rmi.Remote getPort(java.lang.String endpoint,
                               java.lang.Class proxyInterface)
                        throws javax.xml.rpc.ServiceException
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.


getPort

private java.rmi.Remote getPort(java.lang.String endpoint,
                                javax.xml.namespace.QName portName,
                                java.lang.Class proxyInterface)
                         throws javax.xml.rpc.ServiceException

createCall

public javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName)
                              throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

createCall

public javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName,
                                     java.lang.String operationName)
                              throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

createCall

public javax.xml.rpc.Call createCall(javax.xml.namespace.QName portName,
                                     javax.xml.namespace.QName operationName)
                              throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

createCall

public javax.xml.rpc.Call createCall()
                              throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

getCalls

public javax.xml.rpc.Call[] getCalls(javax.xml.namespace.QName portName)
                              throws javax.xml.rpc.ServiceException
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 javax.xml.rpc.Service

getHandlerRegistry

public javax.xml.rpc.handler.HandlerRegistry 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 javax.xml.rpc.Service

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 javax.xml.rpc.Service

getServiceName

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

Specified by:
getServiceName in interface javax.xml.rpc.Service

getPorts

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

Specified by:
getPorts in interface javax.xml.rpc.Service

setTypeMappingRegistry

public void setTypeMappingRegistry(javax.xml.rpc.encoding.TypeMappingRegistry registry)
                            throws javax.xml.rpc.ServiceException
Defines the current Type Mappig Registry.


getTypeMappingRegistry

public javax.xml.rpc.encoding.TypeMappingRegistry getTypeMappingRegistry()
Returns the current TypeMappingRegistry or null.

Specified by:
getTypeMappingRegistry in interface javax.xml.rpc.Service

getReference

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

Specified by:
getReference in interface javax.naming.Referenceable

setEngine

public void setEngine(org.apache.axis.AxisEngine 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.


getEngine

public org.apache.axis.AxisEngine 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.


setEngineConfiguration

public void setEngineConfiguration(org.apache.axis.EngineConfiguration 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.


getEngineConfiguration

protected org.apache.axis.EngineConfiguration 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.


getMaintainSession

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


getCall

public Call getCall()
             throws javax.xml.rpc.ServiceException
Deprecated. please use Stub._getCall

Returns last Call object associated with this service. Note that since the Service is not thread-safe, you may not get the last call object that you created on this thread. please use Stub._getCall


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).


registerTransportForURL

void registerTransportForURL(java.net.URL url,
                             Transport transport)
Register a Transport for a particular URL.


getTransportForURL

Transport getTransportForURL(java.net.URL url)
Get any registered Transport object for a given URL.


setTypeMappingVersion

public void setTypeMappingVersion(java.lang.String version)
Set the typemapping version