In this article we will discuss about another activity while loop in BPEL process. This example will display the series of number in reverse based on loopcounter. Follow the below steps.
- 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. Expose this BPEL process as a SOAP service.
- Create two variables in the BPEL process. Click on Variable icon in the main scope. Create two variables 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 WHILE activity from Structured Activities component and drag and drop it after Assign activity
- Double click on while activity and give condition by clicking on expression icon. Condition will be like below screenshot ($loopCounter>0)
- Drag and drop another ASSIGN activity within WHILE activity
- Double click on assign activity and add expressions to resultVar and loopCounter
- resultVar: concat($resultVar , $loopCounter) A� A� A� A�loopCounter: $loopCounter – 1
- Editor wizard of assign activity will look like this
- Add one more ASSIGN activity after WHILE activity and assign resultvar to output payload
- Now BPEL process will be like the below screenshot
- Deploy the project and test it in EM console