Search code examples
web-serviceswcfsoapjax-ws

Is there any (widely implemented) WS-* standard for long-running asyncronous operations?


I am implementing a web service where clients can submit potentially long-running tasks, after which they receive an Asynchronous Completion Token (a GUID, in my case). The token may be used to poll for the status of the operation, possibly retrieving the result of the computation or a fault occurred during the computation. In addition, the operation may be cancelled at any time. Currently, the client needs to cancel the operation after it completed to free the stored result, however, I expect some form of garbage collection of results will be also needed.

This setup is nontrivial for the client: it needs to store the GUID token, poll periodically, remember to cancel the operation if it is no longer needed, handle asynchronous faults, etc. If there will be some need of authentication (WS-Security, WS-Trust), the situation will be even more complicated, for example, access to the status of an operation started by another user must be forbidden.

Is there a widely available, interoperable WS-* standard for such asynchronous operations? I would like to be able to call the server at least from WCF and a JAX-WS client, and possibly use the asynchronous jobs in conjunction with other WS-* standards. Rolling my own polling solution is not a big deal, however, I wouldn't like to reinvent the wheel.


Solution

  • Not quite sure the WS-* standards for this. Recently our team used Hangfire to implement some feature similar to yours.

    As you can easily integrate Hangfire using codes, you can expose the job submitting as a interface and implement some logic to generate GUID and queue the task to Hangfire server(s), and then implement your requirement in business logic.