There are several use cases where you might want to use a Web Service Provider object with Business Processes that are either long-running or asynchronous. For example:
- A Business Process you want to be invoked asynchronously by Trading Partners.
- A scenario where you use a webhook to invoke a Web Service Provider API or to receive notification from a SaaS application to run a background process.
- A long-running Business Process with an execution time of more than 30 seconds invoked using a Web Service Provider.
The following best practices can help you successfully implement use cases noted above.
- Create a Web Service Provider, which internally creates and attaches a BP (Parent BP).
- Add the required tasks to the Parent BP such that they run for a shorter period.
- Add a Send REST Web Services Reply task to send a response back to the client. This is typically an acknowledge response.
- Create a new long-running Business Process and add the required tasks.
- Create an Event object and configure the long-running BP details in the Event properties.
- Add a Send Event Notification task after the Send REST Web Services Reply task in the Parent BP, and provide the created Event details in the properties - to launch the long-running BPS as an asynchronous task.
- Add Set Exit Status as the last task in the Parent BP.