sskumar86
sskumar86

Reputation: 161

Asynchronous reponses from webservice - CXF JAXWS

I need to send a asynchronous message to client from my CXF (JAX WS) webservice layer...

How client would be capable of receiving it?What steps need to be taken care to achieve this?Is there a sample tutorial available?

Upvotes: 1

Views: 2418

Answers (1)

zenbeni
zenbeni

Reputation: 7193

You have two options to achieve asynchronous calls from client with CXF.

  • You can poll the service for response
  • You can define a callback which will be executed when the server's job is done

Each solution has pros and cons, so choose according to your needs.

The polling gives you a Response object and you can test if the call is complete on it by response.isDone(). (if not, wait some time, then send another request)

The callback gives you a Future object which wraps the call, you can define an AsyncHandler for instance when you call the service to define what will be run when the process is finished.

From the server side, you should take a look at WS-Addressing (to define a replyTo endpoint for callback if needed) and WS-POLICY: http://cxf.apache.org/docs/ws-addressing.html

Note that if you need to use callbacks (it seems so), you will have to define a CXF client on the client side to enable WS-addressing (on the cxf bus).

Upvotes: 1

Related Questions