axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Elder" <ant.el...@uk.ibm.com>
Subject Re: [wsif] -- example of asynchronous request/response, with correlation service?
Date Mon, 30 Dec 2002 13:09:44 GMT

Hi Jeff,

The only example with WSIF is an async testcase at:
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-axis-wsif/java/test/async/AsyncTests.java

The async model still needs a bit of work but the current design works as
follows:

There are two ways of using async, one where WSIF handles the correlating
of the response to the request, the other where the client must do this.

The first way of using async is passing in a WSIFResposneHandler on the
request which will then be invoked when the response is received. In this
case WSIF will use the correlation service and call the response handler
executeAsyncResponse method when the response arrives. The WSIFOperation
method to do this is:

    public WSIFCorrelationId executeRequestResponseAsync(
        WSIFMessage input,
        WSIFResponseHandler handler)

There are a number of difficulties actually using this model.

One, the supplied correlation service uses a simple static HashTable and is
only useful to run the WSIF testcases. Really you need  correlation service
implementation using a persistent data store such as a database or JMS
queue.

The second problem is WSIF does not come with anything that listens for the
response to arrive. In practice you need something like an MDB listening on
the response queue which will call the WSIFOperation fireAsyncResponse
method when a response is received. The WSIF testcases use a very simple
listener, the processResponse method gives an idea of what the MDB would
need to do:
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-axis-wsif/java/test/org/apache/wsif/util/jms/JMSAsyncListener.java



The 2nd way of using async uses the WSIFOperation methods:

               public WSIFCorrelationId
executeRequestResponseAsync(WSIFMessage input)

      public boolean processAsyncResponse(
            Object response,
            WSIFMessage output,
            WSIFMessage fault)

The executeRequestResponseAsync takes an input WSIFMessage and returns the
correlation ID of the message (the JMS messageID). This is really fire and
forget for WSIF, and its up to the client to handle the
listening/correlating of the response and matching it with the WSIFOperatio
instance to be used to process the response. The WSIFOperation
processAsyncResponse method is to help with processing the response. Here
the response Object is expected to be a JMS message containing the SOAP
message which will be unserialised and the WSIFMessage output or fault
message populated as appropriate.

So to answer your last question, yes, if you use a response handler then
you would use the correlation service.

       ...ant

Anthony Elder
ant.elder@uk.ibm.com
Web Services Development
IBM UK Laboratories,  Hursley Park
(+44) 01962 818320, x248320, MP208.


"Jeff Greif" <jgreif@alumni.princeton.edu> on 23/12/2002 23:59:43

Please respond to axis-user@xml.apache.org

To:    <axis-user@xml.apache.org>
cc:
Subject:    [wsif] -- example of asynchronous request/response, with
       correlation service?




If anyone has an example of usage of WSIF for an  asynchronous
request/response WS call, particularly one using the
WSIFCorrelationService, or the WSIFResponseHandler I'd appreciate seeing
it.  Would you ever use the correlation service if you also used a response
handler?

Thanks much.

Jeff




Mime
View raw message