How to : Async Callbacks using SOAP/REST Web Services with Java

17,422

Solution 1

The Async Http Client is an open source library that was specifically designed for this type of problem. It utilizes futures and wraps up a lot of the detail and hassle out of making async calls.

The author has a very good getting started guide and there is an active discussion group. The author is a very talented developer and the project is under continuous development.

From the documentation:

The library uses Java non blocking I/O for supporting asynchronous operations. The default asynchronous provider is build on top of Netty (http://www.jboss.org/netty), the Java NIO Client Server Socket Framework from JBoss, but the library exposes a configurable provider SPI which allows to easily plug in other frameworks.

Solution 2

Your question is not clear. I am interpreting your question as you want your serverside code to call a remote REST web services in an Async manner. If so then your best bet is to use the Futures feature of java.util.concurrent it will do exactly what you want. If my interpretation of the question is wrong then please update your question with exactly where the async operations need to happen.

Solution 3

Akka http://akka.io/

Great framework, great performance - Here are their claims:

"""

Simpler Concurrency

Write simpler correct concurrent applications using Actors, STM & Transactors.

Event-driven Architecture

The perfect platform for asynchronous event-driven architectures. Never block.

True Scalability

Scale out on multi-core or multiple nodes using asynchronous message passing.

Fault-tolerance

Embrace failure. Write applications that self-heal using Erlang-style Actor supervisor hierarchies.

Transparent Remoting

Remote Actors gives you a high-performance transparent distributed programming model.

Scala & Java API

Scala and Java API as well as Spring and Guice integration. Deploy in your application server or run stand-alone. """

Solution 4

@Vivek

GET is async and other HTTP methods are not.

This isn't true. Please go ahead and read about AJAX :-)

Share:
17,422
malifa
Author by

malifa

sdfsdfsdf sdf sdfsdfsdsdsdfsdf sdfdsfsdsdfssdfsd

Updated on June 04, 2022

Comments

  • malifa
    malifa almost 2 years

    We have a Java API that needs to be supplemented/fronted with a SOAP/REST Web service Layer.

    What does it take to implement Async Calls across process/server boundaries using
    a) SOAP Webservices
    b) RESTful webservices

    Some of the methods might need multiple calls to respond to the request.

    We will be using Java/J2ee to implement the SOAP/restful service using a library like CXF or Axis or    Jax-RS/WS.

    Any examples ? Gotchas ?

    Thank you,