org.iids.aos.webservices.wsgateway
Class WSGatewayAgentModule

java.lang.Object
  extended by org.iids.aos.webservices.wsgateway.WSGatewayAgentModule
All Implemented Interfaces:
Module, SystemService, WSGateway

public class WSGatewayAgentModule
extends java.lang.Object
implements Module, WSGateway

This module provides access to the WSGateway via an AgentProxy mechanism. This allows 0.9 style agents to interact with the service, without the need to use a AgentServer2WSGatewayModule or similar.

This module creates an agent that runs a proxy, and forwards the method invocations to the module.

Author:
rjtimmer

Nested Class Summary
static class WSGatewayAgentModule.WSGatewayAgent
           
 
Field Summary
 
Fields inherited from interface org.iids.aos.systemservices.WSGateway
ERROR_COULD_NOT_PARSE_WSDL, ERROR_IO, ERROR_LEASE_EXPIRED, ERROR_MALFORMED_SOAP_REQUEST, ERROR_MALFORMED_URL, ERROR_NO_EXCLUSIVE_TRANSPORT, ERROR_UNKNOWN_PORT, WSGATEWAY_ADDRESS
 
Method Summary
 AgentInfo getAgentInfo()
           
 Communicator getCommunicator()
           
 java.lang.String getModuleName()
           
 boolean isStarted()
           
 void pingService()
           
 void publishService(java.lang.String name, AgentHandle publisher, java.lang.String className, byte[] jar)
           
 int requestWSDLAccess(java.lang.String wsdl, java.lang.String serviceName, java.lang.String serviceNameSpace, java.lang.Boolean exclTransport, AgentHandle handle)
          Called by an agent server (on behalf of an agent) to request access to a web service specified by a WSDL document.
 java.lang.String sendSOAPRequest(java.lang.String request, java.lang.String portName, java.lang.Integer leaseID, AgentHandle handle)
          Called by an agent server (on behalf of an agent) to carry out a SOAP operation.
 void setPublisher(WSGatewayPublishModule publisher)
           
 void shutdown()
           
 void start()
           
 void stop()
           
 void unbind()
           
 void unPublishService(java.lang.String serviceName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setPublisher

public void setPublisher(WSGatewayPublishModule publisher)

requestWSDLAccess

public int requestWSDLAccess(java.lang.String wsdl,
                             java.lang.String serviceName,
                             java.lang.String serviceNameSpace,
                             java.lang.Boolean exclTransport,
                             AgentHandle handle)
                      throws org.apache.xmlrpc.XmlRpcException
Description copied from interface: WSGateway
Called by an agent server (on behalf of an agent) to request access to a web service specified by a WSDL document. As part of this call, the WS gateway creates a lease, which acts a context in which the agent interacts with the web service. Multiple leases may be requested for the same parameter set.

SOAP communicates over transport sessions whose protocols and contact points are specified in the WSDL document. (Typically these are HTTP sessions.) Some web services associate client state with the transport sessions. An agent may optionally specify that it requires the same transport sessions to be used consistently by this lease and that other leases (of other agents or of the same agent) cannot share the transport sessions.

Specified by:
requestWSDLAccess in interface WSGateway
Parameters:
wsdl - a URL pointing to a WSDL document
serviceName - the requested web service in the WSDL document
serviceNameSpace - the XML name space of serviceName
exclTransport - if true, the agent requires transport sessions to be maintained for the duration of the lease, not to be shared by other leases, and to use at most one transport session per web service port
handle - the agent identifier
Returns:
a lease ID
Throws:
org.apache.xmlrpc.XmlRpcException - containing one of: ERROR_MALFORMED_URL, ERROR_COULD_NOT_PARSE_WSDL, ERROR_NO_EXCLUSIVE_TRANSPORT

sendSOAPRequest

public java.lang.String sendSOAPRequest(java.lang.String request,
                                        java.lang.String portName,
                                        java.lang.Integer leaseID,
                                        AgentHandle handle)
                                 throws org.apache.xmlrpc.XmlRpcException
Description copied from interface: WSGateway
Called by an agent server (on behalf of an agent) to carry out a SOAP operation. The operation is carried out by sending a SOAP request to a web service and receiving the SOAP response.

Specified by:
sendSOAPRequest in interface WSGateway
Parameters:
request - a SOAP envelope containing the request, including the name of the operation
portName - port inside the web service that contains the SOAP operation
leaseID - a lease identifier returned by requestWSDLAccess
handle - the agent identifier, which must correspond to the agent identifier passed to requestWSDLAccess
Returns:
a SOAP envelope containing the response
Throws:
org.apache.xmlrpc.XmlRpcException - containing one of: ERROR_LEASE_EXPIRED, ERROR_UNKNOWN_PORT, ERROR_MALFORMED_SOAP_REQUEST, ERROR_IO

publishService

public void publishService(java.lang.String name,
                           AgentHandle publisher,
                           java.lang.String className,
                           byte[] jar)
                    throws WSGatewayException
Specified by:
publishService in interface WSGateway
Throws:
WSGatewayException

unPublishService

public void unPublishService(java.lang.String serviceName)
                      throws WSGatewayException
Specified by:
unPublishService in interface WSGateway
Throws:
WSGatewayException

getModuleName

public java.lang.String getModuleName()
Specified by:
getModuleName in interface Module

getCommunicator

public Communicator getCommunicator()
Specified by:
getCommunicator in interface Module

start

public void start()
Specified by:
start in interface Module

stop

public void stop()
Specified by:
stop in interface Module

isStarted

public boolean isStarted()
Specified by:
isStarted in interface Module

unbind

public void unbind()
Specified by:
unbind in interface SystemService

shutdown

public void shutdown()
              throws java.lang.UnsupportedOperationException
Specified by:
shutdown in interface SystemService
Throws:
java.lang.UnsupportedOperationException

pingService

public void pingService()
Specified by:
pingService in interface SystemService

getAgentInfo

public AgentInfo getAgentInfo()


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.