Feeds

Programming constructs in BPEL

Part 3: BPELJ and Compensation

Maximizing your infrastructure through virtualization

In this column in our series examining BPEL and its use within Service Oriented Architecture (SOA) systems, I'll will be looking at BPELJ and Compensation.

BPELJ is an extension to the core BPEL (Business Process Execution Language), which allows the direct inclusion of Java code within a BPEL script. Compensation is actually a core element of BPEL that provides an undo-like facility for situations where part of a BPEL script fails and other parts require their effects to be undone.

BPELJ

The aim of BPELJ is to let you embed Java and J2EE processes in a BPEL process. The intention is to allow portable integration of Java and J2EE applications into BPEL across application servers. In practice, most BPEL engines have allowed integration with programming languages such as Java in one form or another for some time, but via their own proprietary extensions. Thus, there have been BPEL extensions without portability, which I personally find extremely frustrating - because I need to support multiple application server environments.

BPELJ offers a glimmer of hope, in that it aims to provide a standard extension to BPEL for inline Java. The aim of BPELJ is to combine the power of a general purpose programming language such as Java with the orchestration and integration facilities of BPEL. By doing this, developers are free to select the appropriate "programming" language for the level of task they are implementing.

The Design of BPELJ

The design of BPELJ allows Java code to be embedded directly within a BPEL script in similar way to the embedding of Java within a JSP page. That is, BPELJ allows sections of Java code, called Java snippets, to be included in BPEL process definitions. Snippets are expressions or small blocks of Java code used for such things as loop conditions, branching conditions, variable initialisation, calling methods on Java objects etc.

Within BPEL standard extension points are used to support BPELJ. For example, a new partner link type is defined that references Java code; variables can now be typed as being of a specific Java class; and BPELJ code snippets can contain valid Java code statements, with the ability to invoke methods on Java classes from within BPEL statements.

BPELJ Examples

The following BPEL script illustrates the concepts presented in the above section. I've omitted much of this example for clarity, however, the core BPELJ elements remain:


<process name="BookCheck" 

expressionLanguage="http://jcp.org/java"

bpelj:package="com.regdev.example"

xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"

targetNamespace="http://regdev.com/bp/BookCheck"

xmlns:bpelj="http://schemas.xmlsoap.org/ws/2003/03/business-process/java"

xmlns:pq="http://regdev.com/ws/external/BookCheck">

<partnerLinks>

      ...

      <partnerLink name="lookup"  

              partnerLinkType="bpelj:com.regdev.BookLookup"/>

<variables>

   ....

   <variable name="message" type="bpelj:com.regdev.TextMessage"/>

</variables>

<sequence>

...

<flow>

...

</flow>

<bpelj:snippet name="Calculate Total">

   <bpelj:code>

      ...

      subtotal = subtotal * (1 – discount.getRate());

      response.setSubtotal(subtotal);

      float taxes = subtotal * taxRate;

      float total = subtotal + taxes;

      response.setTax(taxes);

      response.setTotal(total);

      ...

   </bpelj:code>

</bpelj:snippet>

...

<invoke partnerLink="BookLookup" operation="checkRegistration">

    <input part="Title" variable="title"/>

    <input part="ISBN" variable="isbn"/>

</invoke>

...

</sequence>

</process>

Reducing security risks from open source software

Next page: Compensation

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Apple fanbois SCREAM as update BRICKS their Macbook Airs
Ragegasm spills over as firmware upgrade kills machines
Captain Kirk sets phaser to SLAUGHTER after trying new Facebook app
William Shatner less-than-impressed by Zuck's celebrity-only app
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
prev story

Whitepapers

Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Build a business case: developing custom apps
Learn how to maximize the value of custom applications by accelerating and simplifying their development.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.