• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAX-WS Async call

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a question to interpret the following statement in the below link

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/twbs_jaxwsclientasync.html

Using an asynchronous message exchange

By default, asynchronous client invocations do not have asynchronous behavior of the message exchange pattern on the wire. The programming model is asynchronous; however, the exchange of request or response messages with the server is not asynchronous. To use an asynchronous message exchange, the com.ibm.websphere.webservices.use.async.mep property must be set on the client request context with a boolean value of true. When this property is enabled, the messages exchanged between the client and server are different from messages exchanged synchronously. With an asynchronous exchange, the request and response messages have WS-Addressing headers added that provide additional routing information for the messages. Another major difference between asynchronous and synchronous message exchange is that the response is delivered to an asynchronous listener that then delivers that response back to the client. For asynchronous exchanges, there is no timeout that is sent to notify the client to stop listening for a response. To force the client to stop waiting for a response, issue a Response.cancel() method on the object returned from a polling invocation or a Future.cancel() method on the object returned from a callback invocation. The cancel response does not affect the server when processing a request.


My question here is only when we set the "mep" property the client then starts the local http server connection and waiting for the reponse from the server. But if we did not set this flag then either your actual client will be waiting (Polling method) or the listener might be waiting (call back method).


1) Use polling method and then call cancel() method will result in cancelling all the waiting threads on the client side to receive the reponse
2) set the mep flag but still call the cancel method will result terminating the above the new Http connection

the point i want to make sure is we use async call to "call and return" and i dont want any threads to wait on the client side expecting the results based on my requirement.

Can any of you thought about this ?


Thanks
Karthi
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
If you want a truly asynchronous web service with the service calling the client and the service generating some kind of result, here is what you can do:
1. Implement the service to insert the request into some kind of queue and then immediately return.
Example of queues are ApacheMQ, Java SE classes implementing the java.util.Queue interface, a JMS queue etc.
2. Implement a callback service on the client side.
The service server needs a way to tell the client that a result of the request submitted by the client is ready.
You can also use polling, in which case you do not need a callback service on the client side.
Best wishes!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic