JSON Formatted Business Information through DOSGi (JAX-RS ReST Services)

Gary Samuelson
Next Post
Previous Post

[Editor’s note: Today we’re again taking a departure from markets and Apple and BPM vendors, to talk about something purely technical.  Gary has been a contributor to our blog over the last few years, bringing his unique blend of technical and business acumen to the subject.  This is the third of four in the series]

Multi-part Series:

  1. BPM Integration with OSGI: JAX-RS and JPA
  2. JPA OSGi Bundle Delivers (Java) Business Domain Objects
  3. (this article) JSON Formatted Business Information through DOSGi (JAX-RS ReST Services)
  4. BPM dojo Widget Consumes JSON/ReST Response

Forward

This article’s focus is BPM integration with ReST services – specifically OSGi and JAX-RS. Though much of these integration details reasonably cross-over into SOAP protocols, I mainly wanted to focus on the benefits of ReST for both BPM(server) and browser-based applications.

We’re trying to serve two major component requirements here:

  • Web-browser requires the JSON format for efficient transformation between javascript and java objects.
  • BPM Services, within Websphere, also require efficient access to business objects. JSON over ReST protocol being the preferred technology in support of increased agility in managing business needs (the “BPM” part of this puzzle).

Additionally, communication-traffic must avoid unnecessary intervention as it marshals its way through system boundaries. This means that there will be no XSLT transformations in this architecture… because they are no longer necessary given the ease at which APIs and JSON messages are built via JAX-RS and JAXB tools, APIs, and tooling.

A Few Words on Intervention Code: Message-mapping (XSLT Transformations)…

Intermediary transformations (i.e. XSLT) are a throwback to the days when refactoring web-services was such an insurmountable horror that a whole new technology was built around avoiding these unpleasantries. Rather than simply fixing an “impedance mismatch”  at its source, the place where all rational thinking requires both ownership and management of logic, a new effort was born and allowed to metastasize into a growing, self-justified resource and performance sucking darkness.

Well, we aren’t doing XSLT here… but rather agile JAX-RS services via OSGi bundles. I’ll then re-focus discussion on the “lightness of ReSTful being” (aka agile technology).

JAX-RS and DOSGi (OSGi with CXF)

I again used both Eclipse (Juno) and Rational Application Developer v9-beta for these demonstrations. Only the Rational Application Developer examples demonstrate DOSGi. I couldn’t get DOSGi working within Websphere-Liberty.

Eclipse (Juno) with Websphere Liberty deployment (example and tutorial)

The Eclipse guide isn’t as complete as the RAD examples. I substituted Wink for the JAX-RS implementation because I simply couldn’t get DOSGi-CXF running within Websphere-Liberty. The differences are very slight though – but, if you want to see DOSGi you must take a look at my RAD/Websphere examples.

Rational Application Developer with Websphere Application Server v8.5 deployment (example and tutorial)

This Rational Application Developer (RAD) walk-through and Websphere deployment is the most complete example to-date. It includes working examples for JAX-RS, DOSGi-CXF, JAXB, XML and JSON messaging, JPA integration, and soapUI for ReST service testing… Please refer to the Apache CXF web-site for detailed architectural discussions for internals on JAX-RS and JAXB JSON/XML generation.

Tags: