uk.ac.soton.ecs.iam.grid.comms.client
Class AbstractTransport

java.lang.Object
  extended by uk.ac.soton.ecs.iam.grid.comms.client.AbstractTransport
All Implemented Interfaces:
Transport
Direct Known Subclasses:
AxisTransport

public abstract class AbstractTransport
extends Object
implements Transport

Abstract base class for local and SOAP-based Transport implementations.


Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
AbstractTransport()
           
 
Method Summary
 Parser fetchWSDL(URL url)
          Download and parse a WSDL file.
 X509Certificate getIssuerCert()
          Return the certificate of the issuer of the certificate we use for signing messages.
 char[] getKeyPassword()
          Get the password for the single private key in the keystore.
 KeyStore getKeyStore()
          Get the keystore, which contains a single private key.
protected  String getKeystoreLocation()
           
 Key getPrivateKey()
          Get the private key from the keystore.
 X509Certificate getSubjectCert()
          Return the certificate we use for signing messages.
protected abstract  Object invoke(RemoteBoundMethod method, String serviceProviderRef, SOAPHeaderElement[] extraHeaders, Object[] argValues)
          Subclasses of AbstractTransport implement this method to actually perform an invokation.
 Object invokeService(RemoteBoundMethod method, String serviceProviderRef, SOAPHeaderElement[] extraHeaders, Object[] argValues)
          Invoke a SOAP method on a remote server.
static Parser loadWSDL(String service)
          Loads "service.wsdl" from CLASSPATH.
 InputStream openURL(URL url)
          Fetch 'url' using the Apache commons httpclient, using our configured keystore.
protected  void setUserAgent(String userAgent)
          Sets the User-Agent header.
 
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.log4j.Logger logger
Constructor Detail

AbstractTransport

public AbstractTransport()
Method Detail

setUserAgent

protected void setUserAgent(String userAgent)
Sets the User-Agent header. This is used in fetchWSDL(java.net.URL) and openURL(java.net.URL).


getKeystoreLocation

protected String getKeystoreLocation()

getKeyPassword

public char[] getKeyPassword()
Description copied from interface: Transport
Get the password for the single private key in the keystore.

Specified by:
getKeyPassword in interface Transport

getSubjectCert

public X509Certificate getSubjectCert()
Description copied from interface: Transport
Return the certificate we use for signing messages.

Specified by:
getSubjectCert in interface Transport

getIssuerCert

public X509Certificate getIssuerCert()
Description copied from interface: Transport
Return the certificate of the issuer of the certificate we use for signing messages.

Specified by:
getIssuerCert in interface Transport

getPrivateKey

public Key getPrivateKey()
Description copied from interface: Transport
Get the private key from the keystore.

Specified by:
getPrivateKey in interface Transport

invoke

protected abstract Object invoke(RemoteBoundMethod method,
                                 String serviceProviderRef,
                                 SOAPHeaderElement[] extraHeaders,
                                 Object[] argValues)
                          throws RemoteException
Subclasses of AbstractTransport implement this method to actually perform an invokation. The arguments are passed from invokeService, except that the missing header fields have been filled in by this point.

Returns:
null if the return type is void, DataHandler if we get an attachment, or the return value of the operation otherwise.
Throws:
RemoteException

invokeService

public Object invokeService(RemoteBoundMethod method,
                            String serviceProviderRef,
                            SOAPHeaderElement[] extraHeaders,
                            Object[] argValues)
                     throws RemoteException
Description copied from interface: Transport
Invoke a SOAP method on a remote server.

The clientRef, serviceProviderRef and version fields of the request are filled in automatically.

Specified by:
invokeService in interface Transport
Parameters:
method - the service to invoke
serviceProviderRef - the server-assigned ID for the conversation
extraHeaders - additional SOAP headers to add to the message
argValues - the values of the input arguments
Returns:
the value returned by the remote call, or null if return type is void. If an attachment is returned, the value will be a DataHandler.
Throws:
RemoteException

loadWSDL

public static Parser loadWSDL(String service)
Loads "service.wsdl" from CLASSPATH.


getKeyStore

public KeyStore getKeyStore()
Description copied from interface: Transport
Get the keystore, which contains a single private key.

Specified by:
getKeyStore in interface Transport
Returns:
the keystore

openURL

public InputStream openURL(URL url)
                    throws IOException
Description copied from interface: Transport
Fetch 'url' using the Apache commons httpclient, using our configured keystore. We can't use the regular method because https endpoints will give errors since we need to set up the keystore location.

Specified by:
openURL in interface Transport
Parameters:
url - the URL of the HTTP or HTTPS resource
Returns:
InputStream the response data stream (excuding headers)
Throws:
IOException

fetchWSDL

public Parser fetchWSDL(URL url)
                 throws IOException,
                        SAXException,
                        javax.wsdl.WSDLException
Description copied from interface: Transport
Download and parse a WSDL file.

Specified by:
fetchWSDL in interface Transport
Parameters:
url - the URL of the WSDL file
Returns:
a parsed WSDL document
Throws:
IOException
SAXException
javax.wsdl.WSDLException


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.