Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Asynchronous call in the Server side?.,

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends..

i'm wondering about how to implement Asynchronous call in the Server side?..
(the Server used is Glassfish)..

is there any turorial or link for develop it?..
sorry i'm still beginner in developing WebService..

Thanks in advance..
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
You are asking about asynchronous calls on the server side - do you mean asynchronous invocation of other web services from a web service or do you mean implementing a web service that processes request asynchronously? If the latter, then:
In order for your web service server to be asynchronous, an option is to follow something along these lines:
- Receive a request.
- Validate the request to the extent possible.
- Generate an id for the request (only if polling is used).
- Associate the id with the request (only if polling is used).
- Queue the request in a queue of some sort.
- Return the id (only if polling is used).

At this time, the client has completed the request and received a result, optionally containing an id with which it can poll for the result of the request later.

At some point in time in the web service server:
- The request is taken from the queue and processed.
- If the result is to be returned using callback, then call back and enclose the result.
- If the result is to be returned using polling, then place the request result in the polling queue.
Later when the client calls the polling function, supplying the request id, the result is returned to the client.

The above is a basic outline of how to implement asynchronous processing of requests in a web service. There may be additional aspects to take into consideration.
I haven't seen any tutorials on this subject.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan, thanks for your reply..

sorry i try to "digest" step by step..

do you mean asynchronous invocation of other web services from a web service?


how to reach it?.. is it implemented as the Client side (use the Service class or Port interface)?..
is it implemented use @WebServiceRef?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic