Sunday, December 5, 2010

Indirectly referenced variables in BPEL

or "Dynamically specified XPaths in BPEL"

Let's assume I have a String variable "counter",
and I want to do a lookup on a collection MyCollection accessing its MyElement number "counter".

In Java it would be Element element = myCollection.get(counter).

In BPEL you have to toil a lot more even to do the simplest thing:


If Counter contains 4,
Temp_Variable will contain a string "/ns2:MyCollection/ns2:MyElement[4]"
which will be evaluated as a XPath by the second "copy" statement.

One can - more effectively - use dynamic indexing:

Why do simple things in Java, when you can do overly complicated programming in XML?

No comments: