This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Service for Asynchronous Client calls (polling, callback)

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 491
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 491
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

    Bookmark Topic Watch Topic
  • New Topic