org.globus.ogsa.client.reflection
Class DynamicInvoker

java.lang.Object
  extended byorg.globus.ogsa.client.reflection.DynamicInvoker

public class DynamicInvoker
extends java.lang.Object

This class is intended to be a standard, dynamic interface to a web service. Becuase the Axis Call object cannot use or return actual WSDL definitions, this class must fetch the WSDL definition form the service itself. Thus, assuming a valid URL to a service WSDL definition, the following shows how to invoke a remote service method: String wsdlDefinition = ...
DynamicInvoker invoker = new DynamicInvoker(gsh);

Before doing anything else, you must tell the class which operation you wish to invoke:

invoker.setMethodName("printHello");

Next you supply the operation's parameter values via an Object array:

Object[] parameters = new Object[2];
parameters[0] = "Parameter 1";
parameters[1] = new Integer(2);
invoker.setParameters(parameters);

Finally, you must tell the class to invoke the remote operation:

Double returnValue = null;
try {
returnValue = (Double) invoker.call();
} catch (Exception e) {
...
}


Optionally, you may combine the setMethodName, setParameters, and the call method into an alternate version of the call method:
try {
returnValue = (Double) invoker.call("printHello", parameters);
} catch (Exception e) {
...
}


Field Summary
protected static org.apache.commons.logging.Log logger
           
 
Constructor Summary
DynamicInvoker(java.lang.String gsh)
           
 
Method Summary
 java.lang.Object call()
          Execute the specified remote operation
 java.lang.Object call(java.lang.String methodName, java.lang.Object[] parameters)
           
 GSR getGSR()
           
protected  int getMessageStyle()
           
protected  java.lang.Object[] getParameters()
          Get parameter names and types for a specific operation.
 void setMethodName(java.lang.String methodName)
           
 void setParameters(java.lang.Object[] parameters)
          Set the parameter values for the remote operation that will be invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.commons.logging.Log logger
Constructor Detail

DynamicInvoker

public DynamicInvoker(java.lang.String gsh)
               throws java.lang.Exception
Method Detail

getGSR

public GSR getGSR()

setMethodName

public void setMethodName(java.lang.String methodName)
                   throws GridServiceException,
                          ReflectionException
Throws:
GridServiceException
ReflectionException

getParameters

protected java.lang.Object[] getParameters()
Get parameter names and types for a specific operation. The parameter information is collected into a Hashtable where the names are the keys and the types are the values.

Returns:
Parameter types mapped by parameter names

setParameters

public void setParameters(java.lang.Object[] parameters)
Set the parameter values for the remote operation that will be invoked.

Parameters:
parameters -

getMessageStyle

protected int getMessageStyle()
                       throws GridServiceException
Throws:
GridServiceException

call

public java.lang.Object call()
                      throws java.rmi.RemoteException,
                             java.net.MalformedURLException,
                             ReflectionException
Execute the specified remote operation

Returns:
The return value
Throws:
java.rmi.RemoteException
java.net.MalformedURLException
ReflectionException

call

public java.lang.Object call(java.lang.String methodName,
                             java.lang.Object[] parameters)
                      throws java.rmi.RemoteException,
                             java.net.MalformedURLException,
                             ReflectionException
Throws:
java.rmi.RemoteException
java.net.MalformedURLException
ReflectionException


Copyright ? 1999 University of Chicago and The University of Southern California. All Rights Reserved.