- BPM Integration with OSGI: JAX-RS and JPA
- JPA OSGi Bundle Delivers (Java) Business Domain Objects
- JSON Formatted Business Information through DOSGi (JAX-RS ReST Services)
- (this article) BPM Service and Web-client Consumers for JSON over ReST
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
- 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.
- Browser requests Task Service from BPM server. This service contains the dojo form widgets and BPM (js) library
- 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.
- Proxy server routes request to the Process Application (BPM Engine), which then routes to Task Service.
- Task Service returns the form (test page) to the user’s browser. Browser then loads application.
- dojo FilteringSelect loads and renders into the form
- Form sets FilteringSelect to ItemFileReadStore
- xhr.post fetches (ajax) JSON data from ReST service
- Proxy routes dojo post request to business data server
- JSON data returns and loads into FilteringSelect “store”. Data rendered for drop-down list and user selects “TESTNAME”
- On select, the “selected code” field populates with “TESTCODE”.
- User clicks “OK” which then uses dojo post (ajax) to send form values into the BPM server.
- Task Service receives JSON message, loads form values (bound data), and moves processing to the next step in the service flow
Here I used a simple HTML dojo test page and IBM-BPM to demonstrate a TaskService “Coach” (workflow form).
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.
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.