I am having problems with a web service I have made for an application using Jax-ws and @Oneway annotation.
I am expecting that with the @Oneway annotation I can pass my parameters off to the web service and allow it to process data concurrently with control
returned to my calling thread as soon as parameters are passed off.
Instead it appears that the processing must be finished before control is relinquished to the calling thread.
Am I misunderstanding the way @Oneway works? or is there some subtlety to it I am missing?
B Porter wrote:Am I misunderstanding the way @Oneway works?
Yes. The In-Only message exchange pattern merely indicates that there will not be a SOAP response to the originating sender. However as you are working with an HTTP binding (hence the name "web" service) the HTTP response (with its status code) won't be sent until the "WebMethod" returns. To achieve the effect that you desire, you have to offload the processing entirely (e.g. somewhere in another thread) so that the "WebMethod" can return immediately after it initiates the processing (that runs asynchronously somewhere else).
The point is that "asynchronous processing" capability is not really in the scope of a web services framework. JAX-WS does support client side asynchronous invocation through javax.xml.ws.Response and javax.xml.ws.AsyncHandler<T>. However the actual call is still synchronous - it's just that the client's thread isn't blocked by the web service call.
It needs to be understood that web service frameworks like JAX-WS primarily deal with the "message processing logic" but not necessarily the "core service logic".
Joined: Aug 19, 2005
B Porter wrote:Do you ranchers think that integrating Quartz job scheduler into the solution would work? I am considering a job that is kicked off per request.
I will post back my resolution to the problem for completeness when I finish my implementation.
Joined: Feb 04, 2009
So, as promised I wanted to post back my resolution to the issue I presented. I ended up using JMS as implemented by JBOSS Messaging on JBOSS AS 5 to solve my issues. I remained concerned about the thread safety and so went with the EE solution.
I ended up creating an object message and a queue and fed into the object my parameters for the web service. Then I picked up the message with an MDB and made the call out to the JAX-WS web service...
This has took longer than we expected for it to come out due to .... This week
it was mainly on Apple not including Java SE 6 in Mac OS 10.5 Leopard, ....
Using @HttpSessionScope: One way to bring state to Web Services is to use Http
... For Servlet based WebServices, you can use com.sun.xml.ws.transport.http.