Home

Expose BPD as a Restful Service in IBM BPM

Introduction
There are two ways we can integrate BPD in IBM BPM Process designer as a Restful service. It can be either inbound or outbound integration. Outbound Integration involves the Business Process Definitions (BPD) invoking external Restful service as part of the process.
This artical focuses on inbound integration that involves exposing the BPD as a Restful service for external users.
Overview
As part of exposing BPD as a Restful Service we need to follow below steps.
1.      Create a BPD.
2.      Expose as a Service.
3.      Install Sanpshot.
4.      Test the Application.
Create a BPD:
Open Process Designer and Click on Create New Process App. Give name as ‘BPD Sample App’, Acronomy as ‘BSA’ and click on Cretae.
Click on ‘Open in Designer’, now our application will open in designer we can create BPD under processes.
Click on + under Processes and select Process, give new process name as ‘Restful BPD’.
Select Variables tab under Restful BPD implementation, add Input varaible name as ‘name’ and Output variable name as ‘greeting’ as shown below. By default these input and output variables are String type.
Select Defination tab and drag and drop three activities, connect them and name it as shown below.
Select First Log Activity à Properties à Implementation à Select Type as ‘Script’ from drop down box.
Select First Log Activity à Properties à Select Script tab and enter below message.
log.info("Entering into Restful BPD ::: "+tw.local.name);
Repete the same step for last Log Activity and enter below message under Script.
log.info("Exit from Restful BPD ::: "+tw.local.greeting);
Now select ‘Set Greeting’ Activity à Properties à Implementation à Select Type as ‘Script’ from dropdown box.
Select ‘Set Greeting’ Activity à Properties à Select Script tab and enter below message.
tw.local.greeting = "Hello, "+tw.local.name;
Expose as a Service:
Select Overview tab and under Exposing section select ‘All Users’ for Expose to Start as shown below. Save all the changes.
By selecting All users for Expose to start all user under this server can start this BPD, if we want to retrict for specific Team or user we can select specific team or user.
Install Snapshot:
Come back to Process center page, click on BPD Sample App click on Create New Snapshot. Give Snapshot name as ‘BPD Sample App V1.0’ and click on create.
Click on Install beside of BPD Sample App V1.0, select Process Server and click on Install.
Finally we can see our application is deployed into process server as shown below.
Test the Application:
IBM is providing BPMRestAPI tester along with IBM BPM product. We can access the BPMRestAPI Tester by using below url.
https://<hostname>:<port>/bpm/test/bpmrest-ui/
It will look like below.
Expand the Business Process Manager Rest APIs à Process API à Select Exposed Processes and click on Execute call.
This service call will show list of exposed processes name along with details as shown below.
Now we can see our BPD is exposed as a service, but we want to access as a restful service.
Expand the Business Process Manager Rest APIs à Process API à Select Start Process, give the values as shown below and click on Execute call.
Conclusion
Here we have learnt exposing BPD as a restful service in IBM BPM, even we can expose BPD as SOAP webservice and Javasctipt to access the BPD. I will post in other article to expose BPD in otherways too.
Download
S. No
File Name
Size
Download
1
Expose BPD as Restful service in IBM BPM.pdf
1.9 MB
2
BPD_Sample_App_V1.0.twx
10 MB

Comments