In this article we will discuss about another activity repeat-until in BPEL process. This example will display the series of number in reverse based on loopcounter.
- Create a project under same application. Go to File -> New -> Project -> SOA Project. Enter project name and then select Composite With BPEL Process in the next wizard
- Click on FINISH button and BPEL Process creation wizard will open. Enter BPEL process name and select Synchronous BPEL Process option as template type
- Create two variables in BPEL process. Click on variable icon in the main scope. Create two variables with name a�� loopCounter and resultVar and variable type will be integer
- Drag and drop ASSIGN activity after receiveInput.
- Double click on Assign activity and assign loopcounter value to input payload
- Select RepeatUntil activity from Structured Activities component and drag and drop it after Assign activity.
- Double click on RepeatUntil activity and enter condition by clicking on expression icon. Condition will be like below screenshot.
- Drag and drop another ASSIGN activity within RepeatUntil activity
- Double click on assign activity and add expressions to resultVar and loopCounter.resultVar: concat($resultVar , $loopCounter)loopCounter: $loopCounter – 1
- Editor wizard of assign activity will look like this.
- Add one more ASSIGN activity after RepeatUntil activity and assign resultvar to output payload
- Now BPEL process will look like the below screenshot
- Deploy the project and test it in EM console.
Have you observed the difference between WHILE activity and RepeatUntil activity?
In While activity, loop condition will be tested before the body is executed. The loop will be exit when the condition will be false.
In Repeat-Until, loop condition will be tested after the body is executed. Thata��s why one extra zero has come in the output payload.