JTR 4.0 API Documentation

jtr.ws.wsif
Class WsifHelper

java.lang.Object
  extended by jtr.ws.wsif.WsifHelper
All Implemented Interfaces:
IWsHelper

public class WsifHelper
extends java.lang.Object
implements IWsHelper

This is the WSIF-based implementation of the IWsHelper interface.
Application level runner implementations do not need to directly access this class. They can access and invoke webservices by means of the methods inherited from their superclass, that is the jtr.runnersAbstractWsRunner class.

Since:
3.0
Version:
4.0
Author:
Francesco Russo (frusso@dev.java.net)
See Also:
WsifHelperFactory

Field Summary
protected  org.apache.log4j.Logger logger
           
protected  WebServiceConfig wsConfig
           
protected  WebServiceRtConfig wsRtConfig
           
 
Constructor Summary
WsifHelper()
          Default constructor.
 
Method Summary
 void asynchronousInputOnlyInvoke(Binding binding)
          This method performs an asynchronous invocation of the webservice, following a one-way messaging pattern.
 void generateRuntimeConfig(WebServiceConfig wsCfg)
          This method produces the WSIF-based runtime classes required to access and invoke the webservices represented by the input WebServiceConfig instance.
This method is invoked once by the AbstractWsRunner class, before the test() method of the application-level runner implementation is actually invoked.
 java.lang.Throwable getFaultCause(Binding binding)
          This method returns the cause of the webservice failure as a WsProviderException instance.
 java.lang.String getFaultMessageAsString(Binding binding)
          This method returns the String representation of the fault message associated with the given webservice operation.
 boolean getMessageBooleanPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the boolean content of a specific message part.
 byte getMessageBytePart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the byte content of a specific message part.
 char getMessageCharPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the char content of a specific message part.
 double getMessageDoublePart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the double content of a specific message part.
 float getMessageFloatPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the float content of a specific message part.
 int getMessageIntPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the int content of a specific message part.
 long getMessageLongPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the long content of a specific message part.
 java.lang.Object getMessageObjectPart(Binding binding, java.lang.String partName, WsMsgType msgType)
          This method gets the Object content of a specific message part.
 java.lang.String[] getMessageParts(Binding binding, WsMsgType msgType)
          Returns the String[] of the part names of the given message.
protected  org.apache.wsif.WSIFMessage getOperationMessage(Binding binding, WsMsgType msgType)
          This method returns a WSIFMessage instance representing the message of type msgType associated with the webservice identified by the union of the remaining input parameters.
 WebServiceRtConfig getWsRtConfig()
          This method does not belong to the IWsHelper interface.
 java.lang.Object invoke(Binding binding, java.lang.Object input)
           
 java.lang.Object invoke(IRunnerWs runner, Binding binding, java.lang.Object input)
          This method performs a request/response synchronous webservice invocation.
 IWsResponse invokeAsync(Binding binding, java.lang.Object input)
           
 java.util.concurrent.Future<?> invokeAsync(Binding binding, java.lang.Object input, IWsResponseListener rl)
           
 IWsResponse invokeAsync(IRunnerWs runner, Binding binding, java.lang.Object input)
          This method performs an asynchronous invocation of the webservice described by the binding parameter.
 java.util.concurrent.Future<?> invokeAsync(IRunnerWs runner, Binding binding, java.lang.Object input, IWsResponseListener rl)
          This method performs an asynchronous invocation of the webservice described by the binding parameter.
 void invokeOneWay(Binding binding, java.lang.Object input)
           
 void invokeOneWay(IRunnerWs runner, Binding binding, java.lang.Object input)
          This method performs a request only webservice invocation.
protected  org.apache.wsif.WSIFOperation renewOperation(WebServiceRtPort port, java.lang.String operationName)
          This method reinstantiates an operation for subsequent reuse and sets the newly created operation into the given WebServiceRtPort.
 void setMessageBooleanPart(Binding binding, java.lang.String partName, boolean val, WsMsgType msgType)
          This method sets the boolean content of a specific message part.
 void setMessageBytePart(Binding binding, java.lang.String partName, byte val, WsMsgType msgType)
          This method sets the byte content of a specific message part.
 void setMessageCharPart(Binding binding, java.lang.String partName, char val, WsMsgType msgType)
          This method sets the char content of a specific message part.
 void setMessageDoublePart(Binding binding, java.lang.String partName, double val, WsMsgType msgType)
          This method sets the double content of a specific message part.
 void setMessageFloatPart(Binding binding, java.lang.String partName, float val, WsMsgType msgType)
          This method sets the float content of a specific message part.
 void setMessageIntPart(Binding binding, java.lang.String partName, int val, WsMsgType msgType)
          This method sets the int content of a specific message part.
 void setMessageLongPart(Binding binding, java.lang.String partName, long val, WsMsgType msgType)
          This method sets the long content of a specific message part.
 void setMessageObjectPart(Binding binding, java.lang.String partName, java.lang.Object val, WsMsgType msgType)
          This method sets the Object content of a specific message part.
 boolean synchronousInvoke(Binding binding)
          This method performs a synchronous invocation of the webservice, following a request/response pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wsRtConfig

protected WebServiceRtConfig wsRtConfig

wsConfig

protected WebServiceConfig wsConfig

logger

protected org.apache.log4j.Logger logger
Constructor Detail

WsifHelper

public WsifHelper()
Default constructor.

Method Detail

generateRuntimeConfig

public void generateRuntimeConfig(WebServiceConfig wsCfg)
                           throws WsProviderException
This method produces the WSIF-based runtime classes required to access and invoke the webservices represented by the input WebServiceConfig instance.
This method is invoked once by the AbstractWsRunner class, before the test() method of the application-level runner implementation is actually invoked.

Specified by:
generateRuntimeConfig in interface IWsHelper
Parameters:
wsCfg - JTR configuration file derived webservice configuration
Throws:
WsProviderException

invoke

public java.lang.Object invoke(Binding binding,
                               java.lang.Object input)
                        throws WsProviderException
Throws:
WsProviderException

synchronousInvoke

public boolean synchronousInvoke(Binding binding)
                          throws WsProviderException
Description copied from interface: IWsHelper
This method performs a synchronous invocation of the webservice, following a request/response pattern.

Specified by:
synchronousInvoke in interface IWsHelper
Parameters:
binding - The webservice binding to be used
Returns:
boolean The outcome of the invocation
Throws:
WsProviderException
See Also:
IWsHelper.synchronousInvoke(Binding binding)

asynchronousInputOnlyInvoke

public void asynchronousInputOnlyInvoke(Binding binding)
                                 throws WsProviderException
Description copied from interface: IWsHelper
This method performs an asynchronous invocation of the webservice, following a one-way messaging pattern.

Specified by:
asynchronousInputOnlyInvoke in interface IWsHelper
Parameters:
binding - The webservice binding to be used
Throws:
WsProviderException
See Also:
IWsHelper.asynchronousInputOnlyInvoke(Binding binding)

renewOperation

protected org.apache.wsif.WSIFOperation renewOperation(WebServiceRtPort port,
                                                       java.lang.String operationName)
                                                throws WsProviderException
This method reinstantiates an operation for subsequent reuse and sets the newly created operation into the given WebServiceRtPort.

Parameters:
port - The port the operation to be renewed belongs to
operationName - The operation name
Returns:
WSIFOperation The renewed WSIF-based operation
Throws:
org.apache.wsif.WSIFException
WsProviderException

getOperationMessage

protected org.apache.wsif.WSIFMessage getOperationMessage(Binding binding,
                                                          WsMsgType msgType)
This method returns a WSIFMessage instance representing the message of type msgType associated with the webservice identified by the union of the remaining input parameters.

Parameters:
binding - The webservice-binding to use
msgType - The message type (input, output, fault)
Returns:
WSIFMessage
See Also:
WsMsgType

getFaultMessageAsString

public java.lang.String getFaultMessageAsString(Binding binding)
Description copied from interface: IWsHelper
This method returns the String representation of the fault message associated with the given webservice operation.

Specified by:
getFaultMessageAsString in interface IWsHelper
Parameters:
binding - The webservice binding to be used
Returns:
String The fault message in a human-readable format
See Also:
IWsHelper.getFaultMessageAsString(jtr.config.ws.Binding)

getFaultCause

public java.lang.Throwable getFaultCause(Binding binding)
Description copied from interface: IWsHelper
This method returns the cause of the webservice failure as a WsProviderException instance.

Specified by:
getFaultCause in interface IWsHelper
Parameters:
binding - The webservice binding to be used
Returns:
Throwable The cause of the fault
See Also:
IWsHelper.getFaultCause(jtr.config.ws.Binding)

getMessageObjectPart

public java.lang.Object getMessageObjectPart(Binding binding,
                                             java.lang.String partName,
                                             WsMsgType msgType)
                                      throws WsProviderException
Description copied from interface: IWsHelper
This method gets the Object content of a specific message part.

Specified by:
getMessageObjectPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
Object The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageObjectPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageIntPart

public int getMessageIntPart(Binding binding,
                             java.lang.String partName,
                             WsMsgType msgType)
                      throws WsProviderException
Description copied from interface: IWsHelper
This method gets the int content of a specific message part.

Specified by:
getMessageIntPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
int The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageIntPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageBooleanPart

public boolean getMessageBooleanPart(Binding binding,
                                     java.lang.String partName,
                                     WsMsgType msgType)
                              throws WsProviderException
Description copied from interface: IWsHelper
This method gets the boolean content of a specific message part.

Specified by:
getMessageBooleanPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
boolean The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageBooleanPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageBytePart

public byte getMessageBytePart(Binding binding,
                               java.lang.String partName,
                               WsMsgType msgType)
                        throws WsProviderException
Description copied from interface: IWsHelper
This method gets the byte content of a specific message part.

Specified by:
getMessageBytePart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
byte The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageBytePart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageCharPart

public char getMessageCharPart(Binding binding,
                               java.lang.String partName,
                               WsMsgType msgType)
                        throws WsProviderException
Description copied from interface: IWsHelper
This method gets the char content of a specific message part.

Specified by:
getMessageCharPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
char The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageCharPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageDoublePart

public double getMessageDoublePart(Binding binding,
                                   java.lang.String partName,
                                   WsMsgType msgType)
                            throws WsProviderException
Description copied from interface: IWsHelper
This method gets the double content of a specific message part.

Specified by:
getMessageDoublePart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
double The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageDoublePart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageFloatPart

public float getMessageFloatPart(Binding binding,
                                 java.lang.String partName,
                                 WsMsgType msgType)
                          throws WsProviderException
Description copied from interface: IWsHelper
This method gets the float content of a specific message part.

Specified by:
getMessageFloatPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
float The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageFloatPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

getMessageLongPart

public long getMessageLongPart(Binding binding,
                               java.lang.String partName,
                               WsMsgType msgType)
                        throws WsProviderException
Description copied from interface: IWsHelper
This method gets the long content of a specific message part.

Specified by:
getMessageLongPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
msgType - The message type (input, output, fault)
Returns:
long The content
Throws:
WsProviderException
See Also:
IWsHelper.getMessageLongPart(jtr.config.ws.Binding, java.lang.String, jtr.ws.WsMsgType)

setMessageObjectPart

public void setMessageObjectPart(Binding binding,
                                 java.lang.String partName,
                                 java.lang.Object val,
                                 WsMsgType msgType)
                          throws WsProviderException
Description copied from interface: IWsHelper
This method sets the Object content of a specific message part.

Specified by:
setMessageObjectPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
Throws:
WsProviderException
See Also:
IWsHelper.setMessageObjectPart(jtr.config.ws.Binding, java.lang.String, java.lang.Object, jtr.ws.WsMsgType)

setMessageIntPart

public void setMessageIntPart(Binding binding,
                              java.lang.String partName,
                              int val,
                              WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the int content of a specific message part.

Specified by:
setMessageIntPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageIntPart(jtr.config.ws.Binding, String, int, jtr.ws.WsMsgType)

setMessageBooleanPart

public void setMessageBooleanPart(Binding binding,
                                  java.lang.String partName,
                                  boolean val,
                                  WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the boolean content of a specific message part.

Specified by:
setMessageBooleanPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageBooleanPart(jtr.config.ws.Binding, String, boolean, jtr.ws.WsMsgType)

setMessageBytePart

public void setMessageBytePart(Binding binding,
                               java.lang.String partName,
                               byte val,
                               WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the byte content of a specific message part.

Specified by:
setMessageBytePart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageBytePart(jtr.config.ws.Binding, java.lang.String, byte, jtr.ws.WsMsgType)

setMessageCharPart

public void setMessageCharPart(Binding binding,
                               java.lang.String partName,
                               char val,
                               WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the char content of a specific message part.

Specified by:
setMessageCharPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageCharPart(jtr.config.ws.Binding, java.lang.String, char, jtr.ws.WsMsgType)

setMessageDoublePart

public void setMessageDoublePart(Binding binding,
                                 java.lang.String partName,
                                 double val,
                                 WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the double content of a specific message part.

Specified by:
setMessageDoublePart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageDoublePart(jtr.config.ws.Binding, java.lang.String, double, jtr.ws.WsMsgType)

setMessageFloatPart

public void setMessageFloatPart(Binding binding,
                                java.lang.String partName,
                                float val,
                                WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the float content of a specific message part.

Specified by:
setMessageFloatPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageFloatPart(jtr.config.ws.Binding, java.lang.String, float, jtr.ws.WsMsgType)

setMessageLongPart

public void setMessageLongPart(Binding binding,
                               java.lang.String partName,
                               long val,
                               WsMsgType msgType)
Description copied from interface: IWsHelper
This method sets the long content of a specific message part.

Specified by:
setMessageLongPart in interface IWsHelper
Parameters:
binding - The webservice binding to be used
partName - The name of the message part
val - The actual value of the part
msgType - The message type (input, output, fault)
See Also:
IWsHelper.setMessageLongPart(jtr.config.ws.Binding, java.lang.String, long, jtr.ws.WsMsgType)

getMessageParts

public java.lang.String[] getMessageParts(Binding binding,
                                          WsMsgType msgType)
Description copied from interface: IWsHelper
Returns the String[] of the part names of the given message.

Specified by:
getMessageParts in interface IWsHelper
Returns:
String[] The part names
See Also:
IWsHelper.getMessageParts(Binding, WsMsgType)

getWsRtConfig

public WebServiceRtConfig getWsRtConfig()
This method does not belong to the IWsHelper interface. It might be useful for accessing webservice-implementation specific functionalities not directly exposed by the JTR framework.

Returns:
WebServiceRtConfig The current runtime WSIF-based webservice configuration or null if not available

invokeOneWay

public void invokeOneWay(Binding binding,
                         java.lang.Object input)
                  throws WsProviderException
Throws:
WsProviderException

invokeAsync

public java.util.concurrent.Future<?> invokeAsync(Binding binding,
                                                  java.lang.Object input,
                                                  IWsResponseListener rl)
                                           throws WsProviderException
Throws:
WsProviderException

invokeAsync

public IWsResponse invokeAsync(Binding binding,
                               java.lang.Object input)
                        throws WsProviderException
Throws:
WsProviderException

invoke

public java.lang.Object invoke(IRunnerWs runner,
                               Binding binding,
                               java.lang.Object input)
                        throws WsProviderException
Description copied from interface: IWsHelper
This method performs a request/response synchronous webservice invocation. The input parameter is the invocation argument, while the returned Object instance is the result of the invocation.

Specified by:
invoke in interface IWsHelper
Parameters:
runner - The runner on whose behalf the service is invoked
binding - The JTR description of the webservice that must be invoked
input - The input message
Returns:
The output of the invoked webservice
Throws:
WsProviderException

invokeOneWay

public void invokeOneWay(IRunnerWs runner,
                         Binding binding,
                         java.lang.Object input)
                  throws WsProviderException
Description copied from interface: IWsHelper
This method performs a request only webservice invocation. The input parameter is the invocation argument.

Specified by:
invokeOneWay in interface IWsHelper
Parameters:
runner - The runner on whose behalf the service is invoked
binding - The JTR description of the webservice that must be invoked
input - The input message
Throws:
WsProviderException

invokeAsync

public java.util.concurrent.Future<?> invokeAsync(IRunnerWs runner,
                                                  Binding binding,
                                                  java.lang.Object input,
                                                  IWsResponseListener rl)
                                           throws WsProviderException
Description copied from interface: IWsHelper
This method performs an asynchronous invocation of the webservice described by the binding parameter. The returned Future instance can be used to check whether the response message has been received or not. Once the response message has been received the provided IWsResponseListener will be notified and will be able to inspect the response.

Specified by:
invokeAsync in interface IWsHelper
Parameters:
runner - The runner on whose behalf the service is invoked
binding - The JTR description of the webservice that must be invoked
input - The input message
rl - The listener to be notified upon response reception
Returns:
The Future required to check for response availability
Throws:
WsProviderException

invokeAsync

public IWsResponse invokeAsync(IRunnerWs runner,
                               Binding binding,
                               java.lang.Object input)
                        throws WsProviderException
Description copied from interface: IWsHelper
This method performs an asynchronous invocation of the webservice described by the binding parameter. The returned IWsResponse instance is required to check for response mesage availability and to inspect the response itself.

Specified by:
invokeAsync in interface IWsHelper
Parameters:
runner - The runner on whose behalf the service is invoked
binding - The JTR description of the webservice that must be invoked
input - The input message
Returns:
The IWsResponse instance required to check for response mesage availability and to inspect the response itself
Throws:
WsProviderException

The JTR Project is licensed under GPL version 2