toolbox.services.ws
Class WSClientService

Package class diagram package WSClientService
java.lang.Object
  extended by toolbox.services.BaseService
      extended by toolbox.services.ws.WSClientService
All Implemented Interfaces:
Service
Direct Known Subclasses:
LoggingServiceWSClientImpl

public class WSClientService
extends BaseService

A convenience service implementation to develop Web Service clients.

Developers will extend or use this class to obtain a reference to a web service client using either static configuration or a toolbox.services.uddi.simple.SimpleUDDIService instance to obtain the remote service details dynamically.

WSClientService implementations must be configured with a specific XML configuration document. An example is provided with the Toolbox distribution at the following location: etc/wsClientService.xml.

Configure service implementations based on this class as singleton to avoid looking up and creating the service reference on each access of the getServiceObject method.


Nested Class Summary
(package private)  class WSClientService.WSClientPasswordCallback
          WSS4J callback implementation to return the WS-Security password that must be used to access the service.
 
Constructor Summary
WSClientService()
          Default constructor.
 
Method Summary
protected  void clearMessageID()
          Clear the message id from the previous method invocation.
 void create(java.lang.String name, java.lang.String confHome, ServiceEnvironment env, XMLProperties xmlProps)
          Call the parent class.
 void destroy()
          Destroy this service.
protected  java.lang.String getMessageID()
          Return the message id from the previous method invocation.
 java.lang.Object getServiceObject()
          Return a reference to the service this client is accessing.
 void setBus(org.apache.cxf.Bus bus)
          Set the CXF bus that must be used by this client instance.
protected  void setPassword(java.lang.String passwd)
          Set the password that must be used to authenticate against the service.
 void setSimpleUDDIService(SimpleUDDIService uddiSvc)
          The injection point for the SimpleUDDIService dependency when dynamic service lookup is employed.
protected  void setUser(java.lang.String user)
          Set the user name that must be used to authenticate against the service.
 
Methods inherited from class toolbox.services.BaseService
getConfigHome, getName, getProperties, getProperty, getXMLProperties, logConfig, logFine, logFiner, logFinest, logInfo, logSevere, logWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSClientService

public WSClientService()
Default constructor.

Method Detail

create

public void create(java.lang.String name,
                   java.lang.String confHome,
                   ServiceEnvironment env,
                   XMLProperties xmlProps)
            throws ServiceException
Call the parent class.

Specified by:
create in interface Service
Overrides:
create in class BaseService
Parameters:
name - The name of the service.
confHome - The path to the configuration home directory.
env - ServiceEnvironment of this service.
xmlProps - XML configuration properties.
Throws:
ServiceException - if the service cannot be created.

setBus

public void setBus(org.apache.cxf.Bus bus)
Set the CXF bus that must be used by this client instance.

Parameters:
bus - The CXF Bus instance to use.

getServiceObject

public java.lang.Object getServiceObject()
                                  throws ServiceException
Return a reference to the service this client is accessing. Service implementors can cast the returned object to the expected service interface.

NOTE: A new reference will be created everytime this method is called. To avoid this overhead only call this method once to obtain a reference to the remote service.

Returns:
Object instance containing a reference to the service this client is accessing.
Throws:
ServiceException - if the service reference cannot be returned.

getMessageID

protected java.lang.String getMessageID()
Return the message id from the previous method invocation.

Returns:
String containing the message id from the previous invocation.

clearMessageID

protected void clearMessageID()
Clear the message id from the previous method invocation.


setUser

protected void setUser(java.lang.String user)
Set the user name that must be used to authenticate against the service.

Call this method before calling getServiceObject to specify or override the user name that must be used to authenticate.

Parameters:
user - String containing the user name that must be used.

setPassword

protected void setPassword(java.lang.String passwd)
Set the password that must be used to authenticate against the service.

Call this method before calling getServiceObject to specify or override the password that must be used to authenticate.

Parameters:
passwd - String containing the password that must be used.

setSimpleUDDIService

public void setSimpleUDDIService(SimpleUDDIService uddiSvc)
The injection point for the SimpleUDDIService dependency when dynamic service lookup is employed.

Parameters:
uddiSvc - SimpleUDDIService instance.

destroy

public void destroy()
Destroy this service.

Specified by:
destroy in interface Service
Overrides:
destroy in class BaseService