Publishing a Document and Waiting for a Reply
A service can request information from other resources in the webMethods system by publishing a document that contains a query for the information. Services that publish a request document, wait for and then process a reply document follow the request/reply model. The request/reply model is a variation of the publish-and-subscribe model. In the request/reply model, a publishing client broadcasts a request for information. Subscribers retrieve the broadcast document, process it, and send a reply document that contains the requested information to the publisher.
A service can implement a synchronous or asynchronous request/reply.
In a synchronous request/reply, the publishing service stops executing while it waits for a response to a published request. The publishing service resumes execution when a reply document is received or the specified waiting time elapses.
In an asynchronous request/reply, the publishing service continues to execute after publishing the request document. The publishing service must invoke another service to wait for and retrieve the reply document.
If you plan to build a service that publishes multiple requests and retrieves multiple replies, consider making the requests asynchronous. You can construct the service to publish all the requests first and then collect the replies. This approach can be more efficient than publishing a request, waiting for a reply, and then publishing the next request.
You can use the
pub.publish:publishAndWait service to build a service that performs a synchronous or an asynchronous request/reply. If you need a specific client to respond to the request for information, use the
pub.publish:deliverAndWait service instead. For more information about using the
pub.publish:deliverAndWait service, see
Publishing a Document and Waiting
for a Reply.
For information about how a
Integration Server sends a request and reply, see
Publishing a Document and Waiting
for a Reply.