Miroslav,
Read this carefully.
Callbacks are a dead end. IT CAN NOT BE DONE. There are several reasons that make it utterly impractical.
The most "straightforward" solution is simply JMS.
One of the features of JMS is a "private queue". Essentially, an attribute of the message being sent is a queue that the reciever can use to send back a result to the caller. This technique is a way to make what is nominally an asynchronous call, effectively a synchronous one.
When your client makes the initial request, it can set up a private response queue that it can listen to. The server (a Message Driven Bean) will listen to the "main queue", process what it wants to, and each time it may need to "call back", it can set up its own private queue, send a message to the client using the private queue the client originally sent, then listen for a response on its own private queue. The client gathers its information, and replies on the servers private queue. It can do that as often as it likes.
When it's all done, the private queues are destroyed and processing moves on.
It's a little cumbersome, but it works, and its portable, and should suit your need quite well.
The interchange all happens in the JMS server, the server never talks directly to the client.
Also, you'll need to ensure that you have enough instances of your Message Bean, since it sounds like it can block while waiting for the users (which means you'll need enough MDBs to service however many simultaneous blocked users you may have).
[Message sent by forum member 'whartung' (whartung)]
http://forums.java.net/jive/thread.jspa?messageID=276149