[jboss-user] [JBossWS] - web service and asynchronous processing

vitor_b do-not-reply at jboss.com
Sun Mar 4 14:22:14 EST 2007


Hello

I really need your help, so please read my question and post your reply if you know the answer, so ...

Webservices generally have one or more business methods exposed for clients.
for example:

public ResponseObject businessMethod(RequestObject request)


A client sends a request, this request is transformed to an object, this object is passed as a parameter to our business method. The method do some work, then returns ResponseObject, application server sends the response to the client. The client waits for the answer. So this is synchronous communication.
WebServices use SOAP. Application server knows where has to send the reply.


But lets suppose that in some cases i would like to do some business logic later, not just when a request is received. I have been thinking of it and 
i would like you to help me.

So I could expose another method, like:

public ConfirmationObject asyncBusinessMethod(RequestObject request)

This method would put RequestObject in JMS queue and then send reply. This reply
means that request is accepted, and will be processing later. Client can continue its work. 
The Queue will hold all async requests. 


Requests will be taken from the queue later, one after the other.
There will be for example a session bean (not MDB becouse i don't want it to take objects when they are available, just later), this bean will take a request from queue and then call first described method: businessMethod(...) . This method will create a reply, but now there is a big problem.
Where it should be send? We have no info about client which has sent this message to our application.
How to handle this? Generally client will have a end point, waiting for async response.
It will use SOAP. How to send the async response using SOAP to client? 
Or should I do it in completely different way? The goal is asynchronous handling of requests.

If there was only one client i could create and send SOAP message like that:

ResponseObject response = ...
  | //add the response object to SOAP message
  | //then
  | SOAPConnection connection = ...
  | java.net.URL endpoint = new URL ("http://www.one.known.client");
  | SOAPMessage response = connection.call(response, endpoint);
  | //endpoint - client end point waiting for async reply, hardcoded or in app config

Could that be done from a session bean?

If there were many clients we wouldn't know to which client we should send the reply.
Once again how to handle that?

Please help me, I'm a beginner and this is not easy for me at all.
Thank you in advance.

vitor_b


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024926#4024926

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024926



More information about the jboss-user mailing list