Feeds

Programming constructs in BPEL

Part 3: BPELJ and Compensation

Securing Web Applications Made Simple and Scalable

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>

Bridging the IT gap between rising business demands and ageing tools

Next page: Compensation

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
DARPA-derived secure microkernel goes open source tomorrow
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
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
prev story

Whitepapers

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.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
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.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.