File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Service for Asynchronous Client calls (polling, callback) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Service for Asynchronous Client calls (polling, callback)" Watch "Service for Asynchronous Client calls (polling, callback)" New topic

Service for Asynchronous Client calls (polling, callback)

Alan Rickmoore

Joined: Oct 11, 2011
Posts: 1
I am a WebService learner and digging through all this stuff isn't easy with all that maybe-outdated-but-still-usable technology floating around. Here's my thing.

My goal is to create a WebService that can be called to perform a time-consuming task. This should be done asynchronously since the client is required to continue working. On my way to achieve this I have stumbled upon JAX-WS 2.0 and it's possibility to create web services via annotation. It also allows asynchronous calls with the @oneway annotation.

Now, I to my understanding (and from several different sources on the web) it seems like I need a server working synchronously which returns a Response<?> (for a polling approach). For a callback approach it seem to be needing an AsyncHandler and sometimes a Future<?>.

Here's how that is supposed to look:

Here's the endpoint code:

I am using Java 1.6.0_26 and Eclipse Indigo with WTP. I have not actively deployed this code to any server, I am just running this Publisher class above. Everything was working fine until either Response, Future or AsyncHandler are added to the code.

Before that the WSDL was retrievable via http://localhost:8080/services?wsdl. I was able to run a client based on this code using wsimport from a *.bat like this:

wsimport -d ..\src -keep -p test http://localhost:8080/services?wsdl

Now it's giving me this exception, which means I don't even get to the point where my Publisher generates the WSDL:

From what I know this tells me JAXB isn't able to work with these interfaces because it can't translate them. But if that's the case, why do I find tutorials with this code at IBM and Apache Axis 2?

Thanks for your help.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
KEY: The features you're looking for is from the Client side only - Client ASYNCHRONOUS invocation.

You will be clarified by these 2 links:

Simplified as below:

wsimport this wsdl and you (client) can make a SYNCHRONOUS call.

the generated service endpoint interface DO NOT have async methods.

3. if you (client) want to make a ASYNCHRONOUS call to the web service provider (polling or callback)

In order to generate a service endpoint interface with asynchronous methods the following binding declaration file will be passed to wsimport

These 2 allow you (client) to invoke a web service provider ASYNCHRONOUSLY from the client only.

4. Some IDE will generate these 2 async methods or have an option during the web service client generation to create
these 2 asyn methods.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
Here is 1 quick test:

Server side on GlassFish 3x

Client side (eclipse ide, Apache CXF and the binding file for ide for client side artifacts generation)

I agree. Here's the link:
subject: Service for Asynchronous Client calls (polling, callback)