OracleArea51

Sponsored By Chola Global Services LLC

Using Switch Activity in a BPEL Process

E-mail
(2 votes, average 4.50 out of 5)
There may be many scenarios where you will be need to execute a set of activities depending upon one value. At that point you make a decision of which set of activities do you want to execute for which value in your BPEL process. This can be achieved by using the Switch process Activity in your BPEL process.

Don't have an Vision instance to practice these tutorials? Visit http://cholagls.com/products-/11i-virtual-machine for details.Our smart solution to smart people like you !!


Here in this simple example lets see how to implement this switch case. Here we will see how to use a File Read Adapter,Assign Activity and Switch Case.

Initial Steps


1.Right Click on Applications.Select New.Go to General->Workspaces->Workspace.workspace
2.Name the workspace as SwitchDemo.Un check the Add new project.proj opton
3.Right click on SwitchDemo and select New. Selet New BPEL Project.
4.Name the project as SwitchDemo and select Synchronous process.Depending on your project needs you need to choose this.

File Adapter


5.Save your work.Since we are going to use the File Adapter we need to have a schema for it. So Copy OrderBookingPo.xsd file from C:\OraBPELPM_3\integration\orabpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles and paste it in your working folder(C:\OraBPELPM_3\integration\jdev\jdev\mywork\SwitchDemo)

6.Right click on Project Schemas in the Structure Navigator and select Import Schemas.Click on the torch icon and select
the OrderBooking xsd file from you r project folder
schema
schma2

7.For creating the File adapter drag and drop a PartnerLink to the right side.
8.Name it as FromFile.


.pl1

9.Click on the icon showed in the above screenshot. Select the file adapter.
10.pl2

10.Select the Read File option.

.pl3

11.Select the directory from where the files need to be picked from.
pl4

12.Select the file types you want the adapter to pick up.
pl5

13.Select the time interval in which the file needs to be picked.
plpl6

14.A schema needs to be selected.Click Browse and from the Project schemas choose the OrderBookingPo and then Purchase Order.
pl7

15.Click Next and Finish.Check the My Role and Partner Role and click Ok.
pl8

16.Double click on ReceiveInput and set the following:


Partner Link - FromFile
Operation - Read


receive


Switch Case



17.Drag and drop  a Switch activity below receive.There will be 2 cases by default. Drag and drop a assign activity on both the cases.
switch1
18.Name the case1 as OrderAbove100 and the otherwise case as Otherwise.

19.Double click on the OrderAbove100 case and create an expression by clicking on Expression icon.Double click on OrderPrice or click the arrow to shuttle it to right.Then click the > symbol and enter ' 100'.this will check if orderprice is greater than 100. and then execute the activities in that particular case.switch2

switchhh1

Map to results.

switch

20.Now for the otherwise case.Double click on that case and select create copy rules.Select the type as expression.Here I am concating the order price item with a string Otherwise Case. So whenever the order price is not greater than 100 this case will get executed and this outputstring will be displayed as output.switch3

switch4

Deploy the project and put a xml file into C:/temp folder. It will be picked up.Login to the BPEL Console and Click on SwitchDemo process. Goto AuditFlow and check the output.
res

Aarthi Sudhakar
Points: 1501
Contact Author | Website :
 

Related Posts:

relatedArticles
Trackback(0)
Comments (0)add comment

Write comment

busy