BPM Client: BPM Service and Web-client Consumers for JSON over ReST
BPM Client
Development Platform and Tools:
- Windows 7-64
- Rational Application Developer v9
- Linux/CentOS v6.3 OS
- Websphere Application Server v8.5
- Database: DB2 v9.7 sp7
BPM Test-client for CXF ReST JSON Service
NOTE: See below for IBM-BPM Test Client (Coach)
BPM Service Overview
Test service composed of a simple IBM-BPM "Coach" (form) and one script component.
From within the Coach, when the user clicks the "OK" button, a dojo post (ajax) sends the users choice into the BPM server via ReST API. The service receives and routes flow to the SysOut script component. SysOut then simply prints the user's selection to the SystemOut log.
BPM Coach Overview
1) Select Name: SelectGS02 Custom Control
NOTE: This isn't an out-of-the-box BPM dojo-widget or "view". I extended this view and added a couple of key features enabling it to both
- accept a ReST URL
- reference JSON records from (above) ReST xhr response
2) Select Name: Selected Item (configuration)
The "selected" variable is of type ColorItem. And, this a "business data" type I created in BPM to help forward user's selection into process application.
ColorItem (type)
- colorCode: String
- name: String
"selected" is bound to an instanced of SelectGS02 so that the user's selection fires an event that assigns the dropdown choice to select properties colorCode and name. These values are passed back into the server and printed to systemout (for demonstration).
3) Select Service URL
This field holds the ReST service (JSON provider) URL. A relative path is used and then picked up by a Proxy server which then matches the URI pattern "/cxf/*". On pattern match a proxy routing rule then forwards the ReST call to the Business Data Server.
4) Item Data Reference
This value tells the component to look at a specific depth within the JSON response. Records are then retrieved and loaded into the "data" property of the SelectGS02 (which is an extended dojo FilteringSelect).
5) Selected Code: Text BPM Widget or View
This widget (or view) is bound to the "selected.colorCode" property (See above for Selected Name binding). This field shows the selected code from the drop-down list.
BPM Service Runtime
1) BPM ReST Client loads in web-browser
When the javascript/dojo widget loads in the web-browser, javascript initializes and runs the FilteredSelect's method to fetch the drop-down list from the Business DataServer
2) Select Name: Select Service URL: "/cxf/colorservice/getallcolors"
The ReST service request is routed through the proxy server and into the Business Data Server
3) Business Data Server returns JSON response
4) ReST response routes back through the Proxy and is parsed into a drop-down list
5) User selects item from drop-down list (FilteredSelect)
6) Selected Code (field) takes the selection from the drop-down list
7) User clicks OK when then calls an ajax (xhr) post ReST call
8) The Proxy Server routes the post (xhr) request int the Task Service
9) Task Service routes "OK" xhr post (ajax) to next step in service. SysOut then prints to BPM Server Log