Hello Michele, Thank you for your ideas. I am saying it is not possible because I need some validation on the webservice implementation and then respond. As you said in your first response, " the acknowledgment (i.e. HTTP 200) is *always* sent back to the client *before* the server starts processing the request"
Maybe an example will help: Suppose that we are developing a Webservice for a bank with an operation that transfers money from an user's account to another bank account. The service will be used in a frontend so users transfer money between accounts. A client will set the destined account and amount and the frontend should quickly respond if the operation will be executed or not. 1. A ws-client sends the request to the service, with a xml that contains the user's account, the amount and the destined account. 2. The ws receives the request and validates the input (checks if the user's account has enough funds) 3 if valid, ws spawns a thread in order to make the money transfer (this could take hours if the other account is in some other country, for example) 3.1. ws notifies external system 3.2. ws responds (to the replyTo or faultTo) that it will process this request 4 if not valid ws responds (to the replyTo or faultTo) that it will not process this request. The external system is not notified Maybe with the example above I can make myself clearer? Some other thoughts: - I don't understand how it would be possible to respond to the client replyTo or faultTo and then notifying an external system. My understanding is that replying will be that last instruction in my code (a return or throw). Maybe you mean to do this with a custom handler? - You mention that axis2 uses a dedicated thread pool used to serve incoming requests. I thought that the thread pool was managed by the application server (tomcat,jetty,weblogic) rather than axis2 itself since the webservice request are managed by a servlet after all... Is this correct? Thanks again David On Thursday 20 November 2008 11:53:18 Michele Mazzucco wrote: > Hi David, > > why are you saying it is not possible?! > What I have in mind is: > 1 - client send request to ws > 2 - ws sends a http 200 code back > 3 - ws validates the input > 4 - ws does the job (no need to spawn a separate thread! -- axis2 > uses a dedicated thread pool used to serve incoming requests) > 5 - ws responds to client using replyTo or faultTo > 6 - ws notifies external system (another ws is fine). > > You'll need to remove the relatesTo field because such values are > stored on the client side. If msg # 6 is a brand new msg, then > there's no problem (the relatesTo in msg #5 is with msg #1, which is > fine). However, if you "forward" the result somewhere else (i.e. no > client), then msg #5 won't be related to anything on the receiver > side, right? > > Michele > > On 20 Nov 2008, at 14:47, David Ojeda wrote: > > Hello Michele, > > Thank you for your response. > > If a HTTP 200 acknowledgement is always sent back to the client > > before the server starts processing, then the situation I was > > thinking is not possible at all. I thought it may be possible to > > send an acknowledgement with some response like "ok I will process > > this" or "there is a validation error". > > Since this is not possible, I will have to come up with a solution > > like: > > 1. client sends request to ws > > 2. ws validates the input > > 3. if valid, ws spawns a thread to do some work that takes a while > > 4. ws responds to the client > > 5. eventually the thread finishes and notifies an external system > > (another ws perhaps) > > That aside, why do you say that I will need to write a handler in > > order to remove the relatedTo field? I am curious on how to > > implement the 'server' that will receive the response. > > Thank you > > > > On Thursday 20 November 2008 10:00:42 Michele Mazzucco wrote: > > > Hi David, > > > > > > I don't really see where the problem is when you say "there is an > > > initial acknowledgment and then the response is delivered somewhere > > > else". > > > If you use asynchronous communication (i.e. WS-addressing and double > > > channel) the acknowledgment (i.e. HTTP 200) is *always* sent back to > > > the client *before* the server starts processing the request. > > > Then you can specify different endpoints for reply and fault by > > > > using > > > > > setReplyTo() and setFaultTo(), respectively. > > > However be careful that if the response is sent "somewhere else", > > > i.e., to a host different from the sender, you'll need to write a > > > handler in order to remove the relatesTo field (WS-addressing > > > > stuff). > > > > > HTH, > > > Michele > > > > > > On 19 Nov 2008, at 22:11, David Ojeda wrote: > > > > Hello, > > > > I am trying to design a webservice that will respond > > > > asynchronously > > > > > > and to a specific URL. I have read documentation on asynchronous > > > > services [1] but I have not found a solution for the following > > > > situation: > > > > 1. A client sends a soap request to the webservice > > > > 2. The webservice does some validation of the input (by actually > > > > calling another webservice) > > > > 3. If the validation succeds, the webservice responds with an xml > > > > that indicates that the operation is pending. > > > > 3.1 The webservice does some work that takes a while (>1min) > > > > 3.2 The webservice responds (succesfully or with a fault) to an > > > > URL > > > > > > specified by the client > > > > 3.3 End > > > > 4. If the validation failed, the webservice responds with an xml > > > > that indicates that there is a problem > > > > So I think this situation is weird since there is an initial > > > > acknowledge to the client (with data) and then the response is > > > > delivered somewhere else. > > > > I have managed to use the addressing module to specify the URL for > > > > the final response > > > > options.setReplyTo(new EndpointReference( > > > > "http://10.21.17.196:8888/pruebaservlet/pepe")); > > > > However, when I call the service, I do not how to send or receive > > > > the acknowledge. > > > > I monitored the http communication and the client sends correctly > > > > the soap request and the service responds with a 200 OK code > > > > but no > > > > > > content. > > > > So this is my question: Is it possible to implement this scenario, > > > > i.e. an ack that indicates if the operation will or will not be > > > > performed, then the response is sent somewhere else. > > > > Some other doubts: What would be the "ideal" way to handle this > > > > response? > > > > With a simple servlet? Or perhaps an in-only webservice whose in- > > > > parameter is the output-parameter of the initial webservice. > > > > (I hope I am making some sense with these questions) > > > > Thank you > > > > [1] > > > > http://www.onjava.com/pub/a/onjava/2005/07/27/axis2.html?page=4 > > > > http://www.ibm.com/developerworks/webservices/library/ws-axis2/ > > > > http://today.java.net/pub/a/today/2006/12/13/invoking-web- > > > > services- > > > > > > using-apache-axis2.html > > > > -- > > > > David Ojeda > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > > David Ojeda > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- David Ojeda
