Tag Archives: if-else

BPEL structured activities: If-Else with Eclipse -3-

  1. Create a new BPEL project named “BPEL_IfElse” by selecting File→New→Others→BPEL 2.0→BPEL Project. Select Next. Type the project name asBPEL_IfElse and select the Target Runtime as Apache ODE 1.x Runtime. Click Finish.
  2. Create a new BPEL process file named IfElseSample by right clicking on the BPEL_IfElse/bpelContent folder, select New→Others→BPEL 2.0→New BPEL Process File. Click Next. Fill in BPEL Process Name the string IfElseSample, and in the Namespace the string http://ifelse.bpel.tps. Select the Template as Synchronous BPEL Process. Click Next.
  3. Modify the Service Address as http://localhost:8080/ode/processes/IfElseSample (suppose that your Tomcat environment is running on port 8080). Click Finish.
  4. Open IfElseSample.bpel file. Click and drag the If control from the Palette to the process, between the receiveInput and replyOutput actions.
  5. Drag an Assign action into the If and drag the replyOutput below the Assign. A sequence is automatically created.

  6. Right click on the If activity, select Add Else. Drag one Assign and one Reply action to the Else branch.

  7. Select the If activity, in the Properties view, select Details→Create New Condition and edit the condition as $input.payload/tns:input=“John”.

  8. Click on the Assign action, in its Properties view, select Details→New. Assign the fix value “Hello John” to the variable output→payload→result. A pop-up dialog appears asking you about the variable initiation. Select Yes. In case the pop-up dialog does not appear, you can do the following steps to initialize the result variable: change the operation to “assign from a Variable to Variable”; then, assign the input variable to output→payload→result; the pop-up dialog should appear; then you change the operation back to “assign from a Fix value to a Variable”.

  9. By the same way, at the Assign1 action, assign “You are not John” to the output-payload-resultRemember to initialize the variable result before assigning this string.
  10. Click on the Reply action, in the Detail tab, at the Quick Pick, select IfElseSample→process→IfElseSampleResponseMessage-Payload→result to assign the result to the output variable.

  11. Save the process design. Right click on the BPEL_IfElse/bpelContent, select New→Others→BPEL 2.0→Apache ODE Deployment Descriptor. ClickNext. Verify the BPEL Project name as /BPEL_IfElse/bpelContent. Click Finish.
  12. Open the deploy.xml file. And select the Associated port with the Partner Link client is IfElseSamplePort.
  13. Save file and open the Server view, right click on the Ode v1.x Server at localhost, select Add and Remove Projects. Select the BPEL_IfElse in the Available projects box and click Add. Then, click Finish.
  14. Start the ODE server and use the Eclipse’s Web Services Explorer to test our application. If you deploy the process successfully, you will see the result like the following: