Open Development Platform

Eclipse Platform

Subscribe to Eclipse Platform: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Eclipse Platform: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Eclipse Platform Authors: Janakiram MSV, Ken Fogel, Marcin Warpechowski, Michael Meiner, Liz McMillan

Related Topics: Eclipse Platform

Eclipse Platform: Article

Modeling Web Services Choreography with New Eclipse Tool

Dancing with BPMN and new Eclipse tool pi4soa

Choreography is the dark continent of Web services: few onlookers have traveled there, and many question whether there are any riches to be brought home from the trip. In the first place, choreographies bear such a striking resemblance to business processes that the novice might think that the two types of artifacts are indistinguishable.

After all, isn't choreography just a way to describe what a business process does (i.e., it choreographs the actions of its participants)? And then there is the dearth of choreography tools; until recently choreography was a topic learned by reading, not by hands-on experimentation. This article takes the trip. It describes how, in the ideal set of design tools, not only are choreographies and processes treated as entirely different artifacts (with different development life cycles), but that special modeling techniques are available to fully accentuate the nuances of choreographies.

Choreography and Process
Contrary to what many Web services and business process people think, it is terminologically incorrect to say that a process choreographs its services. Choreography describes the global protocol that governs how individual processes interact with one another. Each process offers its own services and uses services of partner processes. It is correct to say that a process orchestrates these services, but the view from one process is only the behavior of that process in terms of its partners. Choreography presents the unified global view, depicting all of the processes and their required interactions.

Web Services Choreography Description Language (WS-CDL) is the leading choreography language, and Business Process Execution Language (BPEL) is the dominant process orchestration language. Though both XML-based languages feature a similar flow-oriented design style, only BPEL is meant to have an actual run-time platform: BPEL processes run, and WS-CDL choreographies are formal specifications documenting rules to guide interprocess exchange. There are no traffic cops in this laissez faire world, only traffic laws and law-abiding drivers.

Figure 1 shows the development life cycle for both choreographies and processes. In part (a) of the figure, the work to build a choreography begins with the gathering of requirements from representative participants, whereupon a software designer, using a business process modeling tool, draws the choreography in a notation language, preferably Business Process Modeling Notation (BPMN) or UML. The tool generates from the diagram WS-CDL XML code, which in turn is input to a choreography code editor, such as pi4soa (discussed in detail shortly), which enables a software developer to refine the choreography into a form that is suitable for rigorous testing. A good way to test the choreography is to create stub processes (preferably in BPEL) that represent each participant, and have these processes exchange messages with each other. An endpoint monitor watches the message traffic and checks for compliance to the choreography. When testing completes, the WS-CDL choreography and its reference BPEL stubs are ready for release.

Part (b) shows the life cycle for a particular participant process that intends to follow the choreography. The software designer bases the formal process design on the choreography itself as well as requirements specific to the participant organization. As in (a), the modeling tool should support BPMN or UML and be able to export BPEL code (as a bonus, it should also be able to import the BPEL stubs provided with the choreography), which can then be fed into a BPEL code-level editor, where the process can be refined and be made test-worthy. The test cycle requires a BPEL platform and scripts to test for both private and public requirements, and the endpoint monitor introduced in (a) can be used to verify choreography compliance.

This article focuses on two parts of the choreography cycle: modeling and code refinement. In the modeling area, there are plenty of good business process tools supporting UML and BPMN from which to choose, but none of them can generate WS-CDL output directly. Many can export models in a canonical form (e.g., XML metamodel interchange, or XMI), but there are no third-party tools that can generate WS-CDL code from that form. An open-source version of the proposed code editor, to our delight, is now available in alpha form. The tool, known as Pi Calculus for Service-Oriented Architecture (pi4soa, developed by the company Pi 4 Technologies), is an Eclipse plugin that provides a graphical editor to compose WS-CDL choreographies and generate from them compliant BPEL.

Example: Open Energy Market
To demonstrate the tools described above, we will model and then manipulate the WS-CDL source code of a simple energy market choreography, which describes how, in a competitive, deregulated market, retailers work with a single distributor to enroll customers. The energy example is inspired by the Ontario Energy Board Electronic Business Transaction standard (good examples come from the most improbable places), which was published in 2001 before choreography came along, but was influenced by the B2B ideas of the day. The standard uses UML-like collaboration diagrams, rather than choreography, to depict message exchanges between customers, retailers, and distributors.

The rules of the choreography can be stated in English as follows:

  • When a customer decides to enroll with a retailer, the retailer sends an enrollment request message to the distributor to sign up the customer.
  • If there is a problem with the enrollment, the distributor sends an enrollment reject message to the retailer. Problems include:
    - The customer is already enrolled with that retailer
    - The customer has an enrollment in progress with another retailer
    - There is a problem with the customer's account
  • Otherwise, if the customer is not currently enrolled with a retailer, the distributor sends an enrollment accept message to the retailer. The customer now has 10 business days to cancel the enrollment. If the customer decides to cancel, the retailer sends a cancellation message to the distributor; otherwise, at the end of the 10 days, the distributor sends an enrollment complete message to the retailer. The customer is now enrolled with the retailer.
  • Otherwise, if the customer is currently enrolled with a different retailer (i.e., the "current" retailer), the distributor notifies both retailers by sending to each a pending switch message. The customer now has 10 business days to cancel the switch. If the customer decides to cancel, the new retailer sends a cancellation message to the distributor, who sends a message to the current retailer indicating that the switch has been cancelled. Otherwise, at the end of the 10 days, the distributor sends to both retailers a message indicating that switch has completed, and the customer is now enrolled with the new retailer.
The Choreography Model
In BPMN, two possible ways to model choreography are:
  • Imaginary Hub: Although choreography is fundamentally decentralized, we imagine there is a central hub through which all messages pass, and model the choreography as the process of that hub.
  • Sum of Parts: The process of each participant is drawn in a separate pool. The steps in each process are the public steps - the ones required by the choreography. Message flow depicts the passing of messages from a step in the process of one participant to the step in a process of another.

    Figure 2 shows the imaginary hub process, which oversees all messages exchanged among retailer, current retailer, and distributor participants. There are two types of interactions in this process:

  • Receives (circles with enclosed mail envelopes), representing messages sent by the participant indicated in parentheses
  • Sends (rounded boxes), representing messages sent to the participant or participants indicated in parentheses
The diagram also makes use of the exclusive-OR event gateway (delimited by a diamond with an enclosed star and a plain diamond), which waits for exactly one of multiple messages to be received, and executes the logic on the path for that event.

The logic resembles the English description above, identical but for the inclusion of the hub. When an enrollment request is received from the retailer, the hub sends it to the distributor, and then waits for the one of three events to arrive from the distributor: an enrollment reject, an enrollment accept, or a pending switch notification. In each case, the hub forwards the message to the retailer and, in the pending switch case, to the current retailer too. In the accept and switch cases, the hub waits for either a cancel from the retailer (which it routes to the distributor, and, for a switch, to the current retailer) or a notice of completion (i.e., an enrollment complete or switch period over event) from the distributor, which the hub forwards to the retailer (and current retailer for a switch).

As we will discover in the next section, the imaginary hub approach maps nicely to the WS-CDL representation of the choreography.

More Stories By Michael Havey

Michael Havey is a Chordiant consultant with 10 years of industry experience, mostly with application integration. Michael's book Essential Business Process Modeling was published by O'Reilly in August 2005.

Comments (2)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.