Java Reference
In-Depth Information
Looping
Problem
You need to repeat the execution of some activity until a condition fails, as in a loop.
Solution
Select from one of the available BPEL constructs for this purpose: <while> , <repeatUntil> ,
or <forEach> .
Discussion
These constructs are rather straightforward, so we'll just take a quick tour.
while loop
As in Java, the <while> activity allows you to repeat a block of code (or, more specifically,
the BPEL activity you're enclosing) until a certain <condition> no longer evaluates to true.
Here is the basic structure:
<while>
<condition>$lineItems < 10</condition>
<scope>...</scope>
</while>
A slightly more ambitious example illustrates how you can increment a variable counter with-
in a loop:
<while>
<condition>$counter < $lineItems</condition>
<sequence>
<invoke partnerLink="CheckInventory" ... />
<!-- Here we increment the condition's counter-->
<assign>
<copy>
<from expression="$counter + 1" />
<to variable="counter" />
</copy>
</assign>
</sequence>
</while>
Search WWH ::




Custom Search