| Architect: SOA
Transforming BPMN into BPEL: Why and How
When transforming a BPMN model into an executable BPEL process, it's important to keep the semantic differences between BPMN and BPEL in mind.
By Lonneke Dikmans
Published September 2008
With the acquisition of BEA, several new products have joined the pre-existing Oracle Business Process Analysis Suite in Oracle's Business Process Management (BPM) portfolio. These new tools form what is collectively now called Oracle Business Process Management Suite (including Oracle Business Process Management Studio, formerly BEA AquaLogic Business Process Management Studio), which is an option to Oracle WebLogic Suite.
Oracle Business Process Analysis Suite, which is complementary to the new Oracle Business Process Management Suite, can be used to model the business architecture of an organization formally using Business Process Modeling Notation (BPMN). One of the advantages of using Oracle Business Process Analysis Suite to model business processes is that you can reuse these descriptions as blueprints for your executable Business Process Execution Language (BPEL) processes.
However, there are some differences between BPMN and BPEL that you need to be aware of. First of all, BPMN is used in a different stage in the life cycle of BPM than BPEL. BPMN is used when designing and improving the business process, whereas BPEL is used when implementing it. Different requirements exist in different phases. Second, BPMN is used by business analysts, and BPEL is used by technical analysts and programmers. They use different paradigms and focus on separate issues when modeling a process.
In this article, BPMN and BPEL and the differences between the languages are further explained and illustrated with an example.
Business Process Management Lifecycle
BPM is a notation based on flowcharting for business process modeling; it became an OMG final adopted standard in February 2006. It covers activities performed by organizations to manage and, if necessary, to improve their business processes. Oracle has different tools that support the activities in the BPM lifecycle:
So why can’t we just design our processes using BPEL? Well, BPEL is an execution language, which makes it too detailed and technical to be used by business analysts to capture or design business processes. With this fact in mind, the BPMN specification committee tried to achieve two goals with BPMN:
Overall they succeeded with both goals. Business analysts pick up BPMN fairly easily, and there is a lot of software on the market that transforms BPMN into BPEL. However, there are some issues when transforming a BPMN process to BPEL. These issues have different causes. In the next section I’ll briefly describe the two modeling languages, and emphasize the differences between the two.
In BPMN, a business process diagram (BPD) consists of flow objectsconnecting objects, swimlanes, and artifacts. The specification defines the notation and semantics of a BPD. Oracle Business Process Analysis Suite is not 100-percent compliant with the BPMN standard. In this section, I will describe the elements in more detail and discuss how this process can be modeled with Oracle Business Process Analysis Suite..
There are three types of flow objects: activities, events, and gateways.
An activity is work that is performed in the business process. There are three types of activities: Tasks, looped activities, and subprocesses. Subprocesses don’t show up in Oracle Business Process Analysis Suite as the specification describes, but they can be modeled in it by editing the BPMN attributes. The same is true for looped activities.
Within a BPMN tool, vendors can add markers or icons to tasks, as long as this does not affect the footprint of the diagram. In Oracle Business Process Analysis Suite, tasks are represented by the following objects: function, automated activity, notification , human task, and business rule function.
An event is something that happens during the business process. It is usually triggered by something and/or has a result. The type of event depends on the place in the business process. There are three types of events: start event, intermediate event, and end event. In BPMN, the trigger and result can be modeled by using the attributes dialog box.
Gateways is the last category of flow objects. There are different types of gateways. They all merge and split the flow. If the flow does not need to be controlled, a gateway is not needed. In Oracle Business Process Analysis Suite, you can model XOR (exclusive or)gateways (data based and event based), OR, AND, and complex gateways.
The connecting objects can be sequence flows (a connector that connects two activities), message flows, or association flows.
In BPMN, there are two types of swimlanes: pools and lanes. Pools are used to mark the boundaries of an organization. Interactions between pools are through message flows. Sequence flows are not allowed to cross a pool boundary. This means that a process is always fully contained within a pool. Lanes can be used to divide a pool—for example, to mark different organizational roles within an organization. Sequence flows can cross lanes.
The last category of objects in BPMN is artifacts. There are three types of artifacts: data objects, groups, and annotations. Annotations and groups are not supported in Oracle Business Process Analysis Suite. Data objects consist of a group of different types: person type function, data cluster, and so on.
Now that we know what objects can appear on a BPD, we can start with an example. In this example, we will model part of the process of publishing an article for Oracle Technology Network (OTN).
The process starts when the abstract is approved. This is modeled as a start event, with a message. The marker shows up, when you choose Message in the BPMN attribute Trigger/Result.
The article is written and submitted to the editors. The artifact article is used to depict the information carrier. Then the writer waits for review results. When the article with revisions is received, the writer reviews it. Depending on the result, the process ends or the article is edited and submitted to the editors again. This is modeled by the 'exclusive-or-data' gateway and a sequence flow going backto 'edit article'. The process ends with the publishing of the article.
As you can see, there are three events here: a start event, an intermediate event, and an end event. There is one gateway of the type ‘exclusive or’. There are three activities, all tasks. All flow objects are connected using sequence flows. There are two artifacts: one article that is sent to OTN and one revision that is sent to the writer. These are connected to the tasks using associations.
It is common practice to identify different levels of abstraction in the process models. The most-detailed processes contain information that links the process to IT systems; the more-abstract models don’t.
The goal of these process models is to visualize the business process in an organization. These models can be used for different goals: to automate processes with IT services to support and improve the process, to write instructions for employees, to show compliance to auditors, and to create insight into the business. In this article, you will use the model to automate and monitor the process. To accomplish this, you need to transform it into an executable language, BPEL. Before you do that, you will create a variant of the process with specific implementation details needed to transform the task. You make human tasks of the ‘write article’ and ‘review revision’ activities. This way, we can monitor the deadlines and keep track of the state. ‘Submit article’ is transformed into a notification.
BPEL comprises basic and structured activities, variables, partner links and handlers. It uses XML to describe these things. Oracle SOA Suite supports BPEL4WS 1.1. In addition, Oracle has added extensions that are not in the specification. The latest specification is the final BPEL 2.0 specification; it can be found at the OASIS site.
Variables can be declared at the beginning of the process (global variables) or within a scope.
<!-- HelloWorld BPEL Process --> <process name="HelloWorld" targetNamespace="http://samples.otn.com/helloworld" suppressJoinFailure="yes" xmlns:tns="http://samples.otn.com/helloworld" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" > <!-- List of services participating in this BPEL process --> <partnerLinks> <!-- The 'client' role represents the requester of this service. It is used for callback. The location and correlation information associated with the client role are automatically set using WS-Addressing. --> <partnerLink name="client" partnerLinkType="tns:HelloWorld" myRole="HelloWorldProvider" partnerRole="HelloWorldRequester" /> </partnerLinks> <!-- List of messages and XML documents used as part of this BPEL process --> <variables> <!-- Reference to the message passed as input during initiation --> <variable name="input" messageType="tns:HelloWorldRequestMessage"/> <!-- Reference to the message that will be sent back to the requestor during callback --> <variable name="output" messageType="tns:HelloWorldResultMessage"/> </variables> <!-- Orchestration Logic --> <sequence> <!-- Receive input from requestor. Note: This maps to operation defined in HelloWorld.wsdl --> <receive name="receiveInput" partnerLink="client" portType="tns:HelloWorld" operation="initiate" variable="input" createInstance="yes"/> <!-- Generate content of output message based on the content of the input message. --> <assign> <copy> <from expression="concat('Hello ',bpws:getVariableData('input', 'payload','/tns:name'))"/> <to variable="output" part="payload" query="/tns:result"/> </copy> </assign> <!-- Asynchronous callback to the requester. Note: the callback location and correlation id is transparently handled using WS-addressing. --> <invoke name="replyOutput" partnerLink="client" portType="tns:HelloWorldCallback" operation="onResult" inputVariable="output" /> </sequence> </process>
As you can see, this is an asynchronous BPEL process that receives a message stored in the variable “input”. The process then assigns the result of the concatenation “Hello” and the payload of the message to the variable “output”. This is then returned to the requester by an invoke activity.
There is one partner link in this example: the same client that invokes the process receives the answer.
BPEL Has No Goto
Now that we’ve discussed both languages, let’s focus on the translation from BPMN to BPEL.
In general, the following mapping is used by Oracle Business Process Analysis Suite when generating a BPEL process from a BPMN diagram:
The BPMN specification explains the mapping in detail in Annex A. This mapping is not complete, so don’t be surprised if different tools result in different transformation rules.
To test this with Oracle JDeveloper and Oracle Business Process Analysis Suite, we will first import the SOA profiles into Oracle Business Process Analysis Suite and then transform the BPMN diagram to BPEL. Then we move to Oracle JDeveloper, install the Oracle Business Process Analysis Suite plug-in for Oracle JDeveloper, and start a project based on a blueprint. We will use the process example from the previous paragraphs. First we will add some detail to the process. Once you decide to implement the process, you need to decide which activities are going to be automated activities, which are human tasks, what messages are exchanged, and so on.
Now you have the skeleton BPEL process in Oracle JDeveloper. The developer adds implementation details to this process. The model structure is protected: a developer can add new scopes between existing scopes but can’t delete any existing scopes. New versions of the BPMN model can be imported from Oracle JDeveloper.
Changes in the process from Oracle JDeveloper are visible in Oracle Business Process Analysis Suite as improvement proposals, after you upload them from Oracle JDeveloper. You can find these when you are in the explorer view of Oracle Business Process Analysis Suite.
Handling Incompatible Processes
One common problem occurs when you are trying to transform a valid BPMN model into a BPEL process and errors are generated. This typically happens when you have two or more activities flowing back to a previous activity. This stems from the fact that BPMN supports arbitrary cycles and BPEL only supports structured cycles, with one entry point and one exit point (while).
Suppose you expand our example because a change occurred in the process: if you submit an article that has no edits, then it is published right away, without sending a revision back to the author. This process looks like this:
If you validate this business process, Oracle Business Process Analysis Suite informs you that the BPMN diagram is valid. But, when you transform this to a BPEL process, you get the following error:
As you can see, it is a semantic error: this is valid BPMN, but it can’t be transformed into[ Q: “into”?] BPEL. The diagram shows an error at the write article activity:
There are several solutions to this problem. Usually the best way to solve this is to remove generalizations from the process. Generalizations that you make in your IT systems don’t belong in a business process. For example, in a business process there is a difference between the first time (write the article and submit it) and the consecutive actions that are taken. You can’t avoid the first edit and review, but every edit action after that should be kept to a minimum. So instead of editing the article, we create a new activity called correct article. In our IT systems, we obviously do want to reuse components and services when executing these activities. We also add an event to show that we expect either a revision or a publication message. Finally, we also change the review flow: even if the author agrees with all the changes made by the editor, she or he still needs to explicitly approve the changes. To summarize, we change the model as follows:
This process flow is still relatively easy to understand. We can now generate the blueprint and start editing it in Oracle JDeveloper. The resulting BPEL is a little more complex. This is something to watch out for: the more flows and loops in a BPMN diagram, the more differences there will be in the corresponding BPEL. The BPEL model will also be expanded with assignments and copy actions that are purely technical in nature. Communication between the developer and the business becomes harder because the models differ in shape; this makes it harder to solve problems, add features, and improve the business process. This is something that should be considered when designing the processes in Oracle Business Process Analysis Suite. Organizing the processes in smaller chunks and in different levels of abstraction can reduce the mismatch between BPMN and BPEL considerably.
In this article, you have learned how to transform a BPMN model from Oracle Business Process Analysis Suite to an executable BPEL process by generating a blueprint. When using this method, it is important to keep in mind the semantic differences between BPMN and BPEL. Generalization should be limited to the technical models: BPEL and services. This makes the process easier to change and easier to translate into BPEL.
Lonneke Dikmans is an Oracle ACE Director and managing partner at Approach Alliance, a Dutch IT company specializing in SOA and BI.