Another approach you could take is to make use of JMS and a DB.
The process would be
- In web service call, put a message on a JMS Queue
- Insert a record into a DB table, and return a unique id for that record to the client
- In an MDB that listens to the Queue, call the bean
- When the bean returns, update the DB record with a "Done" status
- When the client calls for status, read the DB record, return "Not Done" or "Done" depending on the record.
- When the client calls and the record indicates "Done", return "Done" and delete the record
This process is a bit heavier on resource usage, but has some advantages
- A Durable JMS Queue will redeliver if your bean method throws an Exception
- A Durable JMS Queue will redeliver if your server restarts
- By using a DB table instead of some static data, you can support a clustered or load balanced environment