org.apache.axis.client
Class Call

java.lang.Object
  |
  +--org.apache.axis.client.Call
All Implemented Interfaces:
Call

public class Call
extends java.lang.Object
implements Call

Axis' JAXRPC Dynamic Invocation Interface implementation of the Call interface. This class should be used to actually invoke the Web Service. It can be prefilled by a WSDL document (on the constructor to the Service object) or you can fill in the data yourself.

 Properties:
     NAMESPACE        - Namespace URI of RPC Body
     SEND_TYPE_ATTR   - Should we send the XSI type attributes (true/false)
     TIMEOUT          - Timeout used by transport sender in seconds
     TRANSPORT_NAME   - Name of transport handler to use
 

Author:
Doug Davis (dug@us.ibm.com)

Field Summary
protected  java.util.Vector attachmentParts
           
static java.lang.String NAMESPACE
           
static java.lang.String SEND_TYPE_ATTR
           
static java.lang.String TIMEOUT
           
static java.lang.String TRANSPORT_NAME
           
static java.lang.String TRANSPORT_PROPERTY
           
 
Fields inherited from interface javax.xml.rpc.Call
PARAM_MODE_IN, PARAM_MODE_INOUT, PARAM_MODE_OUT
 
Constructor Summary
Call(Service service)
          Default constructor - not much else to say.
Call(java.lang.String url)
          Build a call from a URL string
Call(java.net.URL url)
          Build a call from a URL
 
Method Summary
 void addAttachmentPart(java.lang.Object attachment)
          This method adds an attachment.
 void addDeserializerFactory(QName qName, java.lang.Class _class, DeserializerFactory deserFactory)
          Map a type for deserialization.
 void addHeader(SOAPHeader header)
          Add a header which should be inserted into each outgoing message we generate.
 void addOption(java.lang.String name, java.lang.Object value)
          Deprecated. replaced with setOption()
 void addParameter(java.lang.String paramName, XMLType paramType, int parameterMode)
          Adds the specified parameter to the list of parameters for the operation associated with this Call object.
 void addSerializer(java.lang.Class _class, QName qName, Serializer serializer)
          Map a type for serialization.
static void addTransportPackage(java.lang.String packageName)
          Add a package to the system protocol handler search path.
 void clearHeaders()
          Clear the list of headers which we insert into each message Note: Not part of JAX-RPC specification.
 java.lang.String getEncodingStyle()
          Returns the encoding style as a URI that should be used for the SOAP message.
 MessageContext getMessageContext()
          Obtain a reference to our MessageContext.
 java.lang.String getOperationName()
          Returns the operation name associated with this Call object.
 java.util.Vector getOutputParams()
          Get the output parameters (if any) from the last invocation.
 XMLType getParameterTypeByName(java.lang.String paramName)
          Return the XMLType of the parameters with the given name.
 QName getPortTypeName()
          Returns the fully qualified name of the port for this Call object (if there is one).
 java.lang.Object getProperty(java.lang.String name)
          Returns the value associated with the named property - or null if not defined/set.
 Message getResponseMessage()
          Directly get the response message in our MessageContext.
 XMLType getReturnType()
          Returns the XMLType of the return value of this Call - or null if not set.
 Service getService()
          Get the Service object associated with this Call object.
 java.net.URL getTargetEndpointAddress()
          Returns the URL of the target Web Service.
 Transport getTransportForProtocol(java.lang.String protocol)
          Get the Transport registered for the given protocol.
static void initialize()
          Set up the default transport URL mappings.
 void invoke()
          Invoke this Call with its established MessageContext (perhaps because you called this.setRequestMessage()) Note: Not part of JAX-RPC specification.
 java.lang.Object invoke(java.lang.Object[] params)
          Invokes the operation associated with this Call object using the passed in parameters as the arguments to the method.
 java.lang.Object invoke(RPCElement body)
          Invoke an RPC service with a pre-constructed RPCElement.
 SOAPEnvelope invoke(SOAPEnvelope env)
          Invoke the service with a custom SOAPEnvelope.
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] args)
          Convenience method to invoke a method with a default (empty) namespace.
 java.lang.Object invoke(java.lang.String namespace, java.lang.String method, java.lang.Object[] args)
          Invoke an RPC service with a method name and arguments.
 void invokeOneWay(java.lang.Object[] params)
          Invokes the operation associated with this Call object using the passed in parameters as the arguments to the method.
 void removeAllParameters()
          Clears the list of parameters.
 void removeProperty(java.lang.String name)
          Removes (if set) the named property.
 void setEncodingStyle(java.lang.String namespaceURI)
          Sets the encoding style to the URL passed in.
 void setMaintainSession(boolean yesno)
          Determine whether we'd like to track sessions or not.
 void setOperation(QName portName, java.lang.String opName)
           
 void setOperationName(java.lang.String opName)
          Sets the operation name associated with this Call object.
 void setOption(java.lang.String name, java.lang.Object value)
          Set engine option.
 void setPortTypeName(QName portType)
          Sets the port type of this Call object.
 void setProperty(java.lang.String name, java.lang.Object value)
          Allows you to set a named property to the passed in value.
 void setRequestMessage(Message msg)
          Directly set the request message in our MessageContext.
 void setReturnType(XMLType type)
          Sets the return type of the operation associated with this Call object.
 void setTargetEndpointAddress(java.net.URL address)
          Sets the URL of the target Web Service.
 void setTransport(Transport trans)
          Set the Transport Note: Not part of JAX-RPC specification.
static void setTransportForProtocol(java.lang.String protocol, java.lang.Class transportClass)
          Register a Transport that should be used for URLs of the specified protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final java.lang.String NAMESPACE

SEND_TYPE_ATTR

public static final java.lang.String SEND_TYPE_ATTR

TIMEOUT

public static final java.lang.String TIMEOUT

TRANSPORT_NAME

public static final java.lang.String TRANSPORT_NAME

TRANSPORT_PROPERTY

public static final java.lang.String TRANSPORT_PROPERTY

attachmentParts

protected java.util.Vector attachmentParts
Constructor Detail

Call

public Call(Service service)
Default constructor - not much else to say.

Call

public Call(java.lang.String url)
     throws java.net.MalformedURLException,
            JAXRPCException
Build a call from a URL string
Parameters:
url - the target endpoint URL
Throws:
java.net.MalformedURLException -  

Call

public Call(java.net.URL url)
     throws JAXRPCException
Build a call from a URL
Parameters:
url - the target endpoint URL
Method Detail

getEncodingStyle

public java.lang.String getEncodingStyle()
Returns the encoding style as a URI that should be used for the SOAP message.
Specified by:
getEncodingStyle in interface Call
Returns:
String URI of the encoding style to use

setEncodingStyle

public void setEncodingStyle(java.lang.String namespaceURI)
Sets the encoding style to the URL passed in.
Specified by:
setEncodingStyle in interface Call
Parameters:
namespaceURI - URI of the encoding to use.

addParameter

public void addParameter(java.lang.String paramName,
                         XMLType paramType,
                         int parameterMode)
Adds the specified parameter to the list of parameters for the operation associated with this Call object.
Specified by:
addParameter in interface Call
Parameters:
paramName - Name that will be used for the parameter in the XML
paramType - XMLType of the parameter
parameterMode - one of PARAM_MODE_IN, PARAM_MODE_OUT or PARAM_MODE_INOUT

getParameterTypeByName

public XMLType getParameterTypeByName(java.lang.String paramName)
Return the XMLType of the parameters with the given name. Note: Not part of JAX-RPC specification.
Parameters:
paramName - name of the parameter to return
Returns:
XMLType XMLType of paramName, or null if not found.

setReturnType

public void setReturnType(XMLType type)
Sets the return type of the operation associated with this Call object.
Specified by:
setReturnType in interface Call
Parameters:
type - XMLType of the return value.

getReturnType

public XMLType getReturnType()
Returns the XMLType of the return value of this Call - or null if not set. Note: Not part of JAX-RPC specification.
Returns:
the XMLType specified for this Call (or null).

removeAllParameters

public void removeAllParameters()
Clears the list of parameters.
Specified by:
removeAllParameters in interface Call

getOperationName

public java.lang.String getOperationName()
Returns the operation name associated with this Call object.
Specified by:
getOperationName in interface Call
Returns:
String Name of the operation or null if not set.

setOperationName

public void setOperationName(java.lang.String opName)
Sets the operation name associated with this Call object. This will not check the WSDL (if there is WSDL) to make sure that it's a valid operation name.
Specified by:
setOperationName in interface Call
Parameters:
opName - Name of the operation.

setOperation

public void setOperation(QName portName,
                         java.lang.String opName)
                  throws JAXRPCException

getPortTypeName

public QName getPortTypeName()
Returns the fully qualified name of the port for this Call object (if there is one).
Specified by:
getPortTypeName in interface Call
Returns:
QName Fully qualified name of the port (or null if not set)

setPortTypeName

public void setPortTypeName(QName portType)
Sets the port type of this Call object. This call will not set any additional fields, nor will it do any checking to verify that this port type is actually defined in the WSDL - for now anyway.
Specified by:
setPortTypeName in interface Call
Parameters:
portType - Fully qualified name of the portType

setTargetEndpointAddress

public void setTargetEndpointAddress(java.net.URL address)
Sets the URL of the target Web Service.
Specified by:
setTargetEndpointAddress in interface Call
Parameters:
address - URL of the target Web Service

getTargetEndpointAddress

public java.net.URL getTargetEndpointAddress()
Returns the URL of the target Web Service.
Specified by:
getTargetEndpointAddress in interface Call
Returns:
URL URL of the target Web Service

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Allows you to set a named property to the passed in value. This will just be stored in a Hashtable - it's then up to one of the Handler (or the Axis engine itself) to go looking for one of them.
Specified by:
setProperty in interface Call
Parameters:
name - Name of the property
value - Value of the property

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns the value associated with the named property - or null if not defined/set.
Specified by:
getProperty in interface Call
Returns:
Object value of the property - or null

removeProperty

public void removeProperty(java.lang.String name)
Removes (if set) the named property.
Specified by:
removeProperty in interface Call
Parameters:
name - name of the property to remove

invoke

public java.lang.Object invoke(java.lang.Object[] params)
                        throws java.rmi.RemoteException
Invokes the operation associated with this Call object using the passed in parameters as the arguments to the method. For Messaging (ie. non-RPC) the params argument should be an array of SOAPBodyElements. All of them need to be SOAPBodyElements, if any of them are not this method will default back to RPC. In the Messaging case the return value will be a vector of SOAPBodyElements.
Specified by:
invoke in interface Call
Parameters:
params - Array of parameters to invoke the Web Service with
Returns:
Object Return value of the operation/method - or null
Throws:
RemoteException - if there's an error

invokeOneWay

public void invokeOneWay(java.lang.Object[] params)
                  throws JAXRPCException
Invokes the operation associated with this Call object using the passed in parameters as the arguments to the method. This will return immediately rather than waiting for the server to complete its processing. NOTE: the return immediately part isn't implemented yet
Specified by:
invokeOneWay in interface Call
Parameters:
params - Array of parameters to invoke the Web Service with
Throws:
JAXRPCException - is there's an error

invoke

public SOAPEnvelope invoke(SOAPEnvelope env)
                    throws java.rmi.RemoteException
Invoke the service with a custom SOAPEnvelope. Note: Not part of JAX-RPC specification.
Parameters:
env - a SOAPEnvelope to send.
Throws:
AxisFault -  

setTransportForProtocol

public static void setTransportForProtocol(java.lang.String protocol,
                                           java.lang.Class transportClass)
Register a Transport that should be used for URLs of the specified protocol. Note: Not part of JAX-RPC specification.
Parameters:
protocol - the URL protocol (i.e. "tcp" for "tcp://" urls)
transportClass - the class of a Transport type which will be used for matching URLs.

initialize

public static void initialize()
Set up the default transport URL mappings. This must be called BEFORE doing non-standard URL parsing (i.e. if you want the system to accept a "local:" URL). This is why the Options class calls it before parsing the command-line URL argument. Note: Not part of JAX-RPC specification.

addTransportPackage

public static void addTransportPackage(java.lang.String packageName)
Add a package to the system protocol handler search path. This enables users to create their own URLStreamHandler classes, and thus allow custom protocols to be used in Axis (typically on the client command line). For instance, if you add "samples.transport" to the packages property, and have a class samples.transport.tcp.Handler, the system will be able to parse URLs of the form "tcp://host:port..." Note: Not part of JAX-RPC specification.
Parameters:
packageName - the package in which to search for protocol names.

setTransport

public void setTransport(Transport trans)
Set the Transport Note: Not part of JAX-RPC specification.
Parameters:
transport - the Transport object we'll use to set up MessageContext properties.

getTransportForProtocol

public Transport getTransportForProtocol(java.lang.String protocol)
Get the Transport registered for the given protocol. Note: Not part of JAX-RPC specification.
Parameters:
protocol - a protocol such as "http" or "local" which may have a Transport object associated with it.
Returns:
the Transport registered for this protocol, or null if none.

setRequestMessage

public void setRequestMessage(Message msg)
Directly set the request message in our MessageContext. This allows custom message creation. Note: Not part of JAX-RPC specification.
Parameters:
msg - the new request message.

getResponseMessage

public Message getResponseMessage()
Directly get the response message in our MessageContext. Shortcut for having to go thru the msgContext Note: Not part of JAX-RPC specification.
Returns:
the response Message object in the msgContext

setMaintainSession

public void setMaintainSession(boolean yesno)
Determine whether we'd like to track sessions or not. This just passes through the value into the MessageContext. Note: Not part of JAX-RPC specification.
Parameters:
yesno - true if session state is desired, false if not.

getMessageContext

public MessageContext getMessageContext()
Obtain a reference to our MessageContext. Note: Not part of JAX-RPC specification.
Returns:
the MessageContext.

addHeader

public void addHeader(SOAPHeader header)
Add a header which should be inserted into each outgoing message we generate. Note: Not part of JAX-RPC specification.
Parameters:
header - a SOAPHeader to be inserted into messages

clearHeaders

public void clearHeaders()
Clear the list of headers which we insert into each message Note: Not part of JAX-RPC specification.

addSerializer

public void addSerializer(java.lang.Class _class,
                          QName qName,
                          Serializer serializer)
Map a type for serialization. Note: Not part of JAX-RPC specification.
Parameters:
_class - the Java class of the data type.
qName - the xsi:type QName of the associated XML type.
serializer - a Serializer which will be used to write the XML.

addDeserializerFactory

public void addDeserializerFactory(QName qName,
                                   java.lang.Class _class,
                                   DeserializerFactory deserFactory)
Map a type for deserialization. Note: Not part of JAX-RPC specification.
Parameters:
qName - the xsi:type QName of an XML Schema type.
_class - the class of the associated Java data type.
deserializerFactory - a factory which can create deserializer instances for this type.

invoke

public java.lang.Object invoke(java.lang.String namespace,
                               java.lang.String method,
                               java.lang.Object[] args)
                        throws AxisFault
Invoke an RPC service with a method name and arguments. This will call the service, serializing all the arguments, and then deserialize the return value. Note: Not part of JAX-RPC specification.
Parameters:
namespace - the desired namespace URI of the method element
method - the method name
args - an array of Objects representing the arguments to the invoked method. If any of these objects are RPCParams, Axis will use the embedded name of the RPCParam as the name of the parameter. Otherwise, we will serialize each argument as an XML element called "arg".
Returns:
a deserialized Java Object containing the return value
Throws:
AxisFault -  

invoke

public java.lang.Object invoke(java.lang.String method,
                               java.lang.Object[] args)
                        throws AxisFault
Convenience method to invoke a method with a default (empty) namespace. Calls invoke() above. Note: Not part of JAX-RPC specification.
Parameters:
method - the method name
args - an array of Objects representing the arguments to the invoked method. If any of these objects are RPCParams, Axis will use the embedded name of the RPCParam as the name of the parameter. Otherwise, we will serialize each argument as an XML element called "arg".
Returns:
a deserialized Java Object containing the return value
Throws:
AxisFault -  

invoke

public java.lang.Object invoke(RPCElement body)
                        throws AxisFault
Invoke an RPC service with a pre-constructed RPCElement. Note: Not part of JAX-RPC specification.
Parameters:
body - an RPCElement containing all the information about this call.
Returns:
a deserialized Java Object containing the return value
Throws:
AxisFault -  

setOption

public void setOption(java.lang.String name,
                      java.lang.Object value)
Set engine option. Note: Not part of JAX-RPC specification.

addOption

public void addOption(java.lang.String name,
                      java.lang.Object value)
Deprecated. replaced with setOption()

Old version of above

invoke

public void invoke()
            throws AxisFault
Invoke this Call with its established MessageContext (perhaps because you called this.setRequestMessage()) Note: Not part of JAX-RPC specification.
Throws:
AxisFault -  

getOutputParams

public java.util.Vector getOutputParams()
Get the output parameters (if any) from the last invocation. NOTE that the params returned are all RPCParams, containing name and value - if you want the value, you'll need to call param.getValue(). Note: Not part of JAX-RPC specification.
Returns:
Vector of RPCParams

getService

public Service getService()
Get the Service object associated with this Call object. Note: Not part of JAX-RPC specification.
Returns:
Service the Service object this Call object is associated with

addAttachmentPart

public void addAttachmentPart(java.lang.Object attachment)
This method adds an attachment. Note: Not part of JAX-RPC specification.
Throws:
java.lang.RuntimeException - if there is no support for attachments.


Copyright © 2001 Apache XML Project. All Rights Reserved.