Switch condition in BPEL 1.1

Switch Condition in BPEL 1.1

Aim of the program

Create a process that takes in PO amount to find out if approval is required using Switch Condition in BPEL 1.1

If

  • The amount is less than 1000, it returns ‘No Approval Required’
  • The amount is between 1000 and 10000, it returns ‘Approval Required’
  • The amount is more than 10000, it returns ‘Cannot be approved’

 

Start by creating a composite containing a synchronous BPEL process.

Switch

Modify the BPELProcess1.xsd to modify the names of input and output, to better mimic real world scenario

 

switch_XSD

Drag a switch activity in the Bpel process.

switch_drap_Drop

Expand the Switch and click on the expression builder

Switch condition

 

The expression builder comes up.  Select the client input, surround it with number() function and add the condition.

Xpatch builder

 

The Condition Expression window is now populated.  You can also give a name to this branch, say LessThan1000

Label

Add another case to the switch statement, for the scenario when PO amount is between more than 10,000

Add Switch

 

Now add the relevant expression.

number(bpws:getVariableData(‘inputVariable’,’payload’,’/client:process/client:POAmount’))>10000.  The condition looks as follows.

Switch

 

Add three assign activities, one in each of the cases of the Switch activity and one in the otherwise branch.  Give appropriate names and add copy operations to assign ‘No Approval Required’, ‘Requires Approval’ and ‘Cannot be approved’ to the result part of outputVariable.

switch

The final process looks like this

BPEL

Deploy and test.  Give inputs like 500, 1500 and 15000 to see the different branches in action.

 

Relevant Courses:

Oracle SOA suite 12c online training 

Oracle Service Bus 12c online training

Oracle weblogic administration training

0 responses on "Switch condition in BPEL 1.1"

Leave a Reply

© 2017 SCM Teck. All rights reserved.
X