When using RESTFul web services to orchestrate a long-running asynchronous process, a popular approach is to use a polling style. This involves an initial resource call to start the process and then another resource is called at intervals (polled) to obtain status updates until the process is complete. At this point, a final resource is called to obtain the required output. There are, of course, variants on this in terms of calls made and status codes used, but the overall pattern remains similar.
In this recipe, we'll see how to test this style of asynchronous service using a RESTFul mock quote service as an example.
The example quote service has the following resources (produces and consumes XML):
POST
/quote/task/
: This creates a quote task (starts the process)GET
/quote/{id}
: This gets a quote by its ID (once complete)GET
/quote/task/{id}
: This gets the task status updates by its ID (during processing)
A standard RESTful...