Many customers have requested to have a process identifier returned after process start. Ideally this would be the process instance id, with which the respective instance can be found. This blog explains how to model and implement the synchronous process start leveraging a new feature in SAP NetWeaver BPM 7.3 EHP 1.
The process start event in SAP NetWeaver BPM is an asynchronous web service call which does not return a response. In order to change this, one needs to enhance the process model to enable the response to the caller application which instantiates the process instances. The snippet from the process model below indicates how to model such a synchronous resonse.
As one can see, after the process start event the process flow is split into two parts. The regular process flow and the return of the response to the caller application through a message end event. Please note: the message end event must not be terminating as this would also terminate the just created process instance.
Web Service Definition
Of course, in order to return the response, you have to define a WSDL file which accomodates both the request and the response. For both BPMN event artifacts you also have to define a trigger referencing the respective WSDL file. The WSDL file itself looks like this:
The screenshot shows, that the WSDL file has both an input message of type startProcess as well as an output message of type startProcessResponse1. While startProcess defines the attributes which are handed over to the process, startProcessResponse1 contains in our example just one string field, which returns the process instance-ID.
The last remaining part is to map the response message to the output event in the process flow. This is where the new feature of SAP NetWeaver BPM 7.3.1. comes into play. The mapping editor provides now access to the process-instance-id. It can be mapped into the response message and provided back to the caller application.
Please note: Beside the start event also the intermediate message event can make use of the process-instance-ID in the mapping dialog.
SAP NetWeaver BPM 7.3.1 provides this new feature to access the process instance-id at runtime. With this, scenarios like synchronous process start can be modelled and easily implemented. The caller receives the process instance-id after successfully instantiating the process instance with a reference that is valid throughout the lifecycle of the process instance.
Through this, the caller application can maintain a reference to the process instance for easier identification or for later message correlation.
In high-volume scenarios this mechanism can also be an option to ensure delivery of the message from the caller perspective to the process server and a successfull process instantiation.
SAP NetWeaver BPM 7.3, EhP1 is currently in ramp-up and will be general available soon.