Multi-part Series:

  1. BPM Integration with OSGI: JAX-RS and JPA
  2. JPA OSGi Bundle Delivers (Java) Business Domain Objects
  3. JSON Formatted Business Information through DOSGi (JAX-RS ReST Services)
  4. (this article) BPM Service and Web-client Consumers for JSON over ReST

Forward

My goal with this last article is to demonstrate a few techniques for ReST/JSON integration. The fact that we’re connecting into an OSGi bundle doesn’t take as much focus until we require changes to JSON and XML output formats. The IBM-BPM web-client is also introduced in the examples.

BPM Service and Web-client Consumers for JSON over ReST

The BPM user interface primarily uses JSON over ReST. Once the browser has its initial configuration loaded, ReST APIs take over and drive:

  • form navigation
  • events
  • message communication

The combination of dojo UI widgets and ReST/Ajax protocols provide the user with a seamless, uninterrupted experience while navigating through process and service models (flows).

In this scenario (see Task Service illustration), the user launches a task that delivers libraries and configuration to the browser. The user’s browser then renders a BPM web-app’ that includes a dojo drop-down (FilteringSelect) loaded with business-oriented reference data.

Breaking out business reference services onto its own server helps free up BPM CPU overhead so that it can more efficiently focus on process and task related work. Additionally, placing business reference services within OSGi bundles streamlines version management and allows in-console (Websphere) switching between deployments.

Detailed Description: 

  1. Browser requests Task Service from BPM server. This service contains the dojo form widgets and BPM (js) library
  2. The browser’s request flows through a proxy server. The proxy server is required to present a single “facing” domain+port for both BPM and Business Data service provider.
  3. Proxy server routes request to the Process Application (BPM Engine), which then routes to Task Service.
  4. Task Service returns the form (test page) to the user’s browser. Browser then loads application.
  5. dojo FilteringSelect loads and renders into the form
  6. Form sets FilteringSelect to ItemFileReadStore
  7. xhr.post fetches (ajax) JSON data from ReST service
  8. Proxy routes dojo post request to business data server
  9. JSON data returns and loads into FilteringSelect “store”. Data rendered for drop-down list and user selects “TESTNAME”
  10. On select, the “selected code” field populates with “TESTCODE”.
  11. User clicks “OK” which then uses dojo post (ajax) to send form values into the BPM server.
  12. Task Service receives JSON message, loads form values (bound data), and moves processing to the next step in the service flow

Examples:

Here I used a simple HTML dojo test page and IBM-BPM to demonstrate a TaskService “Coach” (workflow form).

Basic HTML dojo with FilteringSelect

This example contains a single page “cxf_client_01.html” using a FilteringSelect and xhr.get (dojo) to fetch and load JSON response into the drop-down select. Full listing is at the end of the example.

IBM-BPM with Extended FilteringSelect (Coach “view”)

This example is more of a detailed illustration of how a modified BPM widget (coach “view”) uses an extended FilteringSelect to fetch results from the Business Data Server and then xhr post the user’s choice back into the BPM Task Service.