You are on page 1of 374

b le

fer a
ans
n - t r
a no
Oracle SOA s ฺ11g: Build
haSuite
Compositeo m ) ide
Applications
u
o o ฺc nt G
ahVolume e Guide
II •dActivity
u
y
@ his S t
z u
a y ez se t
i lp t o u
h
(s nse
z z u c e
y e l i
i l p a
sh

D53946GC20
Edition 2.0
February 2010
D65410

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Author Copyright © 2010, Oracle and/or its affiliates. All rights reserved.

Glenn Stokol Disclaimer

This document contains proprietary information and is protected by


Technical Contributors copyright and other intellectual property laws. You may copy and print
and Reviewers this document solely for your own use in an Oracle training course. The
document may not be modified or altered in any way. Except where
Akshatha Niranjan Shay Shmeltzer your use constitutes "fair use" under copyright law, you may not use,
Anand Sidgiddi Sheela Vasudevan share, download, upload, copy, print, display, perform, reproduce,
publish, license, post, transmit, or distribute this document in whole or in
Anirudh Pucha Stephanie McReynolds part without the express authorization of Oracle.

Anjulaponni Azhagulekshmi Steven Friedberg


The information contained in this document is subject to change without
Subbiahpillai Steven Muench notice. If you find any problems in the document, please report them in
writing to: Oracle University, 500 Oracle Parkway, Redwood Shores,
Avijit Borthakur Swarnapriya Shridhar California 94065 USA. This document is not warranted to be error-free.

Bijoy Choudhury Ted Witiuk


Restricted Rights Notice
Brian Fry Timothy Gleason

Clemens Utschig Tom Hardy If this documentation is delivered to the United States Government or
anyone using the documentation on behalf of the United Statesb l e
David McCann
Valli Pataballa Government, the following notice is applicable:
fer a
Vasiliy Strelnikov
an s
David Shaffer
Vikas Anand
U.S. GOVERNMENT RIGHTS
n - t r
The U.S. Government’s rights to use, modify, reproduce, release,
David Twelves
Deirdre Matishak Vikas Jain
a no
perform, display, or disclose these training materials are restricted by
the terms of the applicable Oracle license agreement and/or the

Demed L’Her Viktor Tchemodanov


) h as eฺ
applicable U.S. Government contract.

Dhiraj Thakkar William Prewitt


o m Guid
Trademark Notice
c
Gangadhar Konduri
Yan Jing
o oฺ ent
Oracle is a registered trademark of Oracle Corporation and/or its
h
Heidi Buelow
Yi Lu
y a Stud
affiliates. Other names may be trademarks of their respective owners.
Yogesh Kumar @
Holger Dindler Rasmussen
z z u this
James Mills Yosuke
a y e
Katsuki
s e
lp to u
Jay Kasi
( s hiEditorse
Joe Greenwald
z z u cArijit
e nsGhosh
John Cobb
y e li Nita Pavitran
Kalpak
i a
lpKothari
h
s Cooper
Ken
Graphic Designer
Kevin Clugage
Rajiv Chandrabhanu
Khanderao Kand
Kristopher Rice
Publisher
Lloyd Williams
Syed Imtiaz Ali
Lynn Munsinger
Manoj Das
Mark Kennedy
Melody Yang
Mohan Kamath
Peter Laseau
Prabhu Thukkaram
Prasad Dixit-Hardikar
Prasen Palvankar
Rakesh Saha
Rashmi Menon
Robert LaVallie

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Contents

Practices for Lesson 11 ....................................................................................................... 1


Practice 11-1: Deploy the ADF-BC CustomerSDO and OrdersSDO Services .............. 2
Practice 11-2: Insert an Database Order by Using an Entity Variable ........................... 3
Practice 11-3: Query Customer and Address Data with Entity Variables .................... 22
Practice 11-4: Deploy and Test Data Management with Entity Variables ................... 38
Practices for Lesson 12 ..................................................................................................... 44
Practice 12-1: Modify the POProcessing Model for Human Task and Notification .... 46
Practice 12-2: Implement Manual Approval in the ApproveCCOrder BPEL Process. 58
Practice 12-3: Send Order Status Email Notification to Customer............................... 71 b l e
Practice 12-4: Deploy and Test the POProcessing and Human Task Form Projects.... 77 fer a
an s
Practices for Lesson 13 ..................................................................................................... 89
Practice 13-1: Add Business Rule Components to the Assembly Model..................... 91 n - t r
no
Practice 13-2: Define the ApprovalRules Business Rules.......................................... 100
a
) has ideฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder BPEL Process ... 111
Practice 13-4: Define the ShippingRules Decision Table........................................... 119
ฺ c om t Gu
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL Process .............. 128
h o o e n
Practice 13-6: Test the POProcessing with Business Rules........................................ 141
ya Stu d
Practices for Lesson 14 ................................................................................................... 149
z @
u this
Practice 14-1: Create a Test Suite for the CreditCardValidation Composite ............. 150
y e z e
a u s
Practice 14-2: Create Test Cases in the CreditCardValidation Test Suite.................. 156

( s hilp se to
Practice 14-3: Deploy and Execute the CreditCardValidation Test Suite .................. 167
Practices for Lesson 15 ................................................................................................... 175
z z u cen
li
Practice 15-1: Apply Security Policies Post Deployment........................................... 176
ye
i l p a
Practice 15-2: Apply Security Policies at Design-Time ............................................. 198
sh Practices for Lesson 16 ................................................................................................... 217
Practice 16-1: Modify a Composite Application to Publish an Event ........................ 219
Practice 16-2: Modify a Composite Application to Subscribe to an Event ................ 234
Practice 16-3: Test Event Publication and Subscription............................................. 242
Practice 16-4: Implement Fulfillment for Orders with a Waiting Status.................... 258
Practice 16-5: Test Fulfillment for an Order with a Waiting Status ........................... 274
Practices for Lesson 17 ................................................................................................... 283
Practice 17-1: Configure the BAM Adapter in WebLogic Administration Server .... 284
Practice 17-2: Create BAM Objects and a JDeveloper BAM Connection ................. 291
Practice 17-3: Create and Use a BAM Adapter in POProcessing .............................. 304
Practice 17-4: Test the BAM Adapter and View the BAM Dashboard...................... 318
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action........................... 328
Practice 17-6: View Order Status Changes in the BAM Dashboard .......................... 352

iii
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 11
The goal of this practice is to learn how to create and work with Entity Variables to query
and modify database data through a Service Data Object implemented as an ADF-BC
service. The following image depicts the changes made to the Fulfillment BPEL Process
in the POProcessing composite application:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
hilp seBPEL
You modify thesFulfillment
( to process to implement the logic that uses an Entity
to:u
Variable z
z c e n
l i
y•e Insert an order ready to be fulfilled into the ORDERS and ITEMS database tables,
il p a and using the Entity variable to modify the order status based on the processing
sh results that occur in BPEL Fulfillment process.
• Query the customer name and address information that is copied to the shipping
request data that is sent to the shipping services though their respective JMS
Adapter services.

Oracle SOA Suite 11g: Build Composite Applications 1


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-1: Deploy the ADF-BC CustomerSDO and
OrdersSDO Services
In this practice, you deploy two additional ADF applications in the ADFBCApplication
application workspace. You deploy the OrdersSDO and CustomerSDO applications to
the soaserver environment.
Note: Remember to deploy ADF applications use the JDeveloper Application Menu in
the Application Navigator. For example:

The OrdersSDO ADF-BC service is used to insert order and item records into the e
database at the start of the Fulfillment BPEL process. The CustomerSDO is also used by a b l
the Fulfillment BPEL process to obtain the customer name and address information s fer
t r an
required for the shipping request. In both cases, the ADF-BC applications are accessed as
-
Service Data Objects, through the use of BPEL Entity Variables.
non
a
To complete the deployment tasks perform the following steps:
) has ideฺ
1) In the JDeveloper Application Navigator, select ฺ c othemADFBCApplication
t G u workspace
on the Application Menu pull-down menu. o o e n
y
Note: If the ADFBCApplication workspace ah Sis tnot udpresent then open the
zu thi@ s
D:\labs\files\ADFBCApplication\ADFBCApplication.jws file.
e z e
y project,usby performing the following steps:
2) Deploy the OrdersSDO
l p a
( s
a) In the Application
to click the Application Menu and select Deploy >
hi seNavigator,
z z u cen
OrdersSDO_OrdersSDOProfile > to > soaserver.
y e l i
sh ilpa b) In the Select Deployment Targets window, select soa_server1 and click OK.
c) In the “Deployment – Log” window, verify that deployment is successful.
3) Deploy the CustomerSDO project, by performing the following steps:
a) In the Application Navigator, click the Application Menu and select Deploy >
CustomerSDO_CustomerSDOProfile > to soaserver.
b) In the Select Deployment Targets window, select soa_server1 and click OK.
c) In the “Deployment – Log” window, verify that deployment is successful.
4) In the JDeveloper window, select File > Save All to save changes to the application
workspace due to deployment steps.
5) Confirm that OrdersService and CustomerSDOService exist by using the WSIL
connection in the Resource Palette.
Note: If OrdersService and CustomerSDOService services do not appear in the
Resource Palette, right-click WSILConnection1 and select Refresh.

Oracle SOA Suite 11g: Build Composite Applications 2


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable
In this practice, you create an external reference for the OrdersService in the
POProcessing composite assembly model and wire it to the Fulfillment BPEL Process.
Then you modify the Fulfillment BPEL Process, in Scope_insertorder, to use the
OrdersService as a Service Data Object that is accessed by using a BPEL entity variable.

To complete this task perform the following steps:


1) Open the POProcessing composite.xml file, by performing the following steps on
the JDeveloper Application Navigator:
a) Select the POApplication name from the Application Menu pull-down menu.

b le
fer a
ans
n - t r
a no
) has ideฺ
b) Expand the POProcessing > SOA Contents ฺ c om t Gu
folder.
h o o e n
c) Double-click the composite.xml ya fileSname.
tu d
@
zuReference s
Create the OrdersService e z e thi in the POProcessing Composite
p a y s for the OrdersService, and create a wire from
ureference
i
In this section create l the o
external
t
h se component to the new external reference.
the Fulfillment(sBPEL Process
u n
2) yInethe lice
zzcomposite.xml window, drag a Web Service component into the External
a
ilp References column.
sh 3) To configure the OrdersService external reference use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 3


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
Note: The WSDL URL field should contain your machine’s host name and not
localhost, as shown in the above image.

If your require help to create the external reference, use instructions in the following
table to specify settings in the Create Web Service window:
Step Screen/Page Choices or Values
Description
a. Create Web Name: OrdersService
Service Type: Reference
WSDL URL: Click the “Find existing WSDLs” icon ( ).
b. SOA With Resource Palette from the pull-down menu, expand
Resource the WSIL > WSILConnection1 > b le
Browser OrdersSDO_OrdersSDOProfile folder, select fer a
OrdersService and click OK. ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 4


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
4) Create a wire from the Fulfillment BPEL Process component to the new
OrdersService that has been added to the External References column. Use the
following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: Remember when you create a wire from a BPEL component to another service,
a partner link is created in the BPEL process.
5) Select File > Save All to save the changes to the POProcessing composite.xml
and the Fulfillment BPEL process.

Create the Order Entity Variable in the Fulfillment BPEL Process


In this section you create two new variables in the Fulfillment BPEL process scope. One
of the variables is used as an Entity Variable to insert data into the ORDER and ITEMS
database table through the OrdersService. The other variable is used to provide the order
data to be inserted into the table through the Entity variable. Both variables are needed by
the Create Entity activity, which inserts the data by using the OrdersService as a Service
Data Object.

Oracle SOA Suite 11g: Build Composite Applications 5


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
6) In the POProcessing composite.xml window, double-click the Fulfillment BPEL
process icon to open it in the BPEL Editor.
Note: When the BPEL process is opened in the editor confirm that the OrdersService
exists in the Partner Link column on the right side of the editor window.
7) In the Fulfillment.bpel Design window, in the main process Fulfillment scope
click the Variables icon ( ) to open the Variables window.
8) In the Variables window, a new variable normal BPEL variable called orderData
whose Type is the ordersViewSDO element from the OrdersService partner link’s
imported inline schema definitions. Use instructions in the following table and
associated screenshots as a guide:
Step Screen/Page Description Choices or Values e
a. Variables a b l
b. Create Variable
Click the Create icon ( )
Name: orderData s fer
- t r an
Type: Select the Element option and click
no n
the Browse Elements icon ( ).
a
c. Type Chooser
has ideฺ
Expand the Partner Links > OrdersService >
)
OrderService.wsdl> Imported WSDL
ฺ c om t Gu
> OrdersService > Inline Schema > schema
h o o e n
folder. Scroll down and select
ya Stu d
ordersViewSDO. Then click OK.
z @
u this
a)
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 6


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
b)

b le
fer a
ans
n - t r
a no
) has ideฺ
c)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 7


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
9) In the Create Variable window verify that the orderData variable is based on the
“{/orderssdo/common/}ordersViewSDO” element type and click OK. Use the
following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
10) In the Variables window, create a new yavariable d
tuentity variable called ordersEV whose
@ s S
Type is the ordersViewSDO
e z zu elementt hifrom the OrdersService partner link’s
imported inline schema
a u e
y definitions.
s This time you select the Entity Variable option
l p
hi se t
and the associated o
OrdersService Partner Link. Use the following steps as a guide:
( s
u Variables nwindow, click the Create icon ( ).
a) zInzthe
l i c e
a yb)e In the Create Variable window, enter ordersEV in Name, and for the Type
il p
sh select the Element option and click the Browse Elements icon ( ).
c) In the Type Chooser window, expand the Partner Links > OrdersService >
OrderService.wsdl> Imported WSDL > OrdersService > Inline Schema >
schema folder. Scroll down and select ordersViewSDO. Then click OK.
d) In the Create Variable window, select the Entity Variable option, and click the
Browse Partner Link icon ( ).
e) In the Partner Link Chooser window, select OrdersService and click OK.

Oracle SOA Suite 11g: Build Composite Applications 8


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
f) In the Create Variable window, verify that your ordersEV variable is being
defined as an Entity Variable based on the ordersViewSDO element and the
OrdersService partner link, and click OK. For example:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
g) In the Variables window, you can
d
yastretchSthetuwindow to confirm that the two new
variables are listed and z
that
@ h is is associated with the OrdersService
u the ordersEV
z
efollowing t
eimage as a guide:
y
partner link. Use the
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

11) Save the changes to the Fulfillment BPEL process.

Implement the Scope_insertorder Activity Sequence


In this section you implement the activities to populate the orderData variable, by
transforming the information from the inputVariable to the orderData elements. You use
a database function in an Assign activity to get the order ID from a database sequence,
and use the Create Entity activity to insert the order data into the database tables.

Oracle SOA Suite 11g: Build Composite Applications 9


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
12) In the Fulfillment.bpel Design window, locate and expand the
Scope_insertorder activity, and delete the Empty activity presently in the scope. In the
Confirm Delete window click OK.
13) Inside the Scope_insertorder scope, create the sequence of named activities in the
order listed in the following table:
__ Activity Type Activity Name Purpose
a. Assign Assign_orderid Replaces the existing order ID in the
inputVariable with a value from the
ORDER_SEQ database sequence by
using the oraext:sequence-
next-val database function.
b. Transform Transform_order Copies the order data from b le
inputVariable to the orderData fer a
variable. ans
c. CreateEntity n - t r
CreateEntity_order Inserts the order data into the database
a no
tables from the orderData variable, by
has ideฺ
using the ordersEV entity variable.
)
c m Gu
oflow:
o o ฺ
Use the following image as a guide to the activity
n t
h
a Stud e
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

14) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 10


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
15) Configure the Assign_orderid with a copy operation to replace the ID element in the
inputVariable with a new order ID obtained from the ORDER_SEQ database
sequence, by using the oraext:sequence-next-val database function. Use
the following image a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
h i lp
The text in the “From” section
t o should resemble the following case-sensitive
expression:(s se
z u e n
ez lic
yoraext:sequence-next-val('ORDER_SEQ',
i l p a 'jdbc/soademo')

sh IMPORTANT NOTE: The parameter values for the oraext:sequence-next-


val database function are case-sensitive and MUST be entered as shown.

Oracle SOA Suite 11g: Build Composite Applications 11


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
16) Configure the Transform_order activity to create a new XSL transformation file
called xsl/Transformation_order that copies the order and item data from the
inputVariable into the orderData variable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya and tu d
Use the following steps define @
u thi
the s
settings S to create the mapper file:
e z z
a) Double-click the a y s e activity.
Transform_order
u
s hilp swindow,
b) In the Transform
( e to use the following settings:
z z u Variable:
Source
c e n inputVariable and its payload
l i
ye Target Variable: orderData
i l p a Note: There is no associated Target Part.
sh Mapper File: xsl/Transformation_order
Click the Create Mapping icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 12


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
17) In the Transformation_order.xsl window, create the initial mappings shown
in the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya theSmapping
Use the following table of steps to create
d
tu rules shown:
@
u thi
zelement s
Map From <sources>
y e z e To <target> element
a u s
a.
h i lp
customerId
t o custId
b. (s nse
orderId
c.zu orderTotal
ordId

e z l i c e totalPrice
a y d. status Status
i l p e. Items > item ItemsView
sh
Note: For this mapping, on the
Auto Map Preferences Accept the
default settings Click OK.
18) In the Transformation_order.xsl window, expand the item in the source
column, and expand the for-each node and remaining nodes in the target column
and verify that your mappings are consistent with the image in the previous step. Save
the changes to the file.
19) In the Transformation_order.xsl window, perform the following steps to
complete the XSL mapping rules:

Oracle SOA Suite 11g: Build Composite Applications 13


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
a) Drag the orderId from the source column to the OrdId element, under the
ItemsView in the target column.

b le
fer a
ans
n - t r
no
b) To set the DateOrdered element in the target column, perform the following steps:
a
) hasgroup
i) On the Component Palette, click the Date Functions
i d e ฺ and drag
header
the current-dateTime function intoothe
c mmiddleGcolumn
u of the map
window.
o o ฺ n t
h
a Stu
Note: Make sure you drop ityinto an emptyd e
section. Do NOT drop it on an
existing map line. u@ is
e z z t h
a y u s e
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 14


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
ii) In the Transformation_order.xsl window, drag a line from the
current-dateTime function icon in the middle column and connect it with the
DateOrdered element in the target column.

b le
c) To set the DateShipped in the target column, perform the following steps:
fer a
i) Right-click the DateShipped element, and select Set Text > “<Empty>”. ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
ii) Verify that the DateShipped element displays the [T] icon next to it along with
the indication it has been set to the “<Empty>” value.

Note: When an Empty XML element is supplied to the database through a


Service Data Object it is translated to a database NULL value. The same rule
applies if the element was not provided. In this case, this is the intention, since
the DATE_SHIPPED column allows a NULL value.
d) To set the ItemId (under the ItemsView) in the target column, perform the
following steps:

Oracle SOA Suite 11g: Build Composite Applications 15


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
i) On the Component Palette, click the Node-set Functions group header and
drag the position function into the middle column of the map window.
Note: Make sure you drop it into an empty section. Do not drop it on an
existing map line.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
a ye In theliTransformation_order.xsl window, drag a line from the
ii)
position function icon in the middle column and connect it with the ItemId
i l p
sh element under the ItemsView tree in the target column.

Note: The position element starts at one and is incremented by one for each
item element in the source based on its XML index position in the items
collection. This is a convenient way to set the ITEM_ID database column to a
unique value within the given order.
e) Save the changes to the Transformation_order.xsl file and close the
Transformation_order.xsl window.

Oracle SOA Suite 11g: Build Composite Applications 16


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
20) Configure the CreateEntity_order activity to use the ordersEV entity variable to insert
the order and item data into their associated database tables, by using the data from
the orderData variable.
Note: The CreateEntity_order activity inserts data into the database through an entity
variable, which is associated with the SDO (OrdersService) that provides the
operations to perform the database operations. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
If you require help to configure the CreateEntity_order ) has idperform
activity, e ฺ the
following steps: ฺ c om t Gu
h o o e n
ya Stu
a) Double-click the CreateEntity_order icon. d
b) In the CreateEntity settings
z @
u window,
h isnext to the Entity Variable field, click the
z
e ( ).se t
Browse Variables a yicon
u
h i lpVariables
t o
u ( s nse
c) In the Browse window, select the ordersEV variable, under the Process

e
>z
z l i e and click OK.
Variables folder,
c
a yd) In the CreateEntity settings window, next to the From field click the Expression
i l p
sh Builder icon ( ).
e) In the Expression Builder window, select the orderData variable under the Process
> Variables tree in the BPEL Variables section, and click “Insert Into
Expression”. Then click OK.
f) In the CreateEntity settings window, verify Entity Variable contains ordersEV,
“From” contains: bpws:getVariableData('orderData'), and click
OK.
21) Save the changes to the Fulfillment BPEL process.

Update the Order Status by Using the Entity Variable


In this section, you modify Assign activities in the Switch inside the Scope_checkstock
scope to set the orderEV variable Status. You set the DateShipped in the orderEV
variable in the Assign_shiporder activity in the Scope_shiporder.
Note: Updating elements in the Entity Variable causes the corresponding columns in the
order database row to be updated.

Oracle SOA Suite 11g: Build Composite Applications 17


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
22) In the Fulfillment.bpel window, scroll down and locate the Switch_selectstore
activity contained in the Scope_checkstock scope.
Note: If you require help to perform this task, expand the both the Scope and Switch
activities. Perform the following steps to create copy operations in the Assign
activities in each Switch branch:
a) Double-click the Assign_acquireinternal activity and add another copy operation
that copies the literal string 'completed' (including the single quotes) to the
Status element in the ordersEV variable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

b) Double-click the Assign_acquireonline activity and add a copy operation that also
copies the literal string 'completed' (including the single quotes) to the Status
element in the ordersEV variable. Use the image in the previous step as a guide.

Oracle SOA Suite 11g: Build Composite Applications 18


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
c) Double-click the Assign_waiting activity, and create the following two copy
operations:
i) Add a copy operation that copies the literal string 'waiting' (including the
single quotes) to the Status element in the ordersEV variable. Use the
following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 19


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
ii) Add a copy operation that copies the literal string 'none' (including the
single quotes) to the carrier element in the outputVariable. Use the following
image as a guide

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y
23) Save the changes to the z
eFulfillment
eBPEL process.
a u s
( s hilp se to window, scroll down, locate, and expand the
24) In the Fulfillment.bpel
u cescope,
Scope_shiporder
z z n which is in the Switch_orderstatus activity.
ye l i
il p a
sh

Oracle SOA Suite 11g: Build Composite Applications 20


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-2: Insert an Database Order by Using an Entity
Variable (continued)
25) To set the DateShipped value in the ordersEV Entity Variable, double-click the
Assign_shiporder activity, and create a new copy operation that copies the result of
the xpath20:current-dateTime() Date function into the DateShipped
element of the ordersEV Entity Variable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
26) Save the changes
h i lp
to the Fulfillment
t o BPEL process.
u (s nse
e z z l i c e
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 21


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables
In this practice/task, you modify the POProcessing composite assembly model to create
an external reference for the CustomerSDOService ADF-BC application you deployed in
Practice 11-1. The CustomerSDOService external reference is also wired to the
Fulfillment BPEL process.

In the Fulfillment BPEL process you create two more Entity Variables: one for the
customer data and the other for the address data. You then use the BindEntity variable to
query the customer information and address. You use the customer and address data to
populate the shipping request elements for sending shipping details to the JMS Adapters.
1) In the JDeveloper window, click on the POProcessing composite.xml window.
Note: If needed, open the composite.xml file under the SOA Content folder of
b le
the POProcessing project.
fer a
ans
Create the CustomerService External Reference n - t r
no
In this section create the external reference for the OrdersService, and create a wire from
a
has ideฺ
the Fulfillment BPEL Process component to the new external reference.
)
2) In the composite.xml window, drag a Web Service
c o m component
G u into the External
References column.
o o ฺ n t
h
a reference, d e
3) To configure the CustomerService y
@ external S tu use the WSILConnection1 in
zuthe service
the Resource Palette to locate s
thi name. Use the following image as a guide:
y e z e
i l p a
t o us
u (sh nse
e z z lice
y
sh ilpa

Note: The ADF-BC service is called CustomerSDOService. However, in the


composite assembly model name the external reference CustomerService.
4) Create a wire connecting the Fulfillment BPEL component icon to the
CustomerService external reference, and verify that the assembly model shows the
components connected.

Oracle SOA Suite 11g: Build Composite Applications 22


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
5) Select File > Save All to save the changes to the POProcessing composite.xml
and Fulfillment.bpel files.

Create Entity Variables for the Customer and Address Data


In this section you create the customerEV Entity Variable in the Fulfillment (main
process scope, that is, as a global variable). However, the addressEV Entity Variable is
created local to the Scope_shiporder scope, because it is only required in that context to
obtain the customer address to populate the shipping request information.
6) In the JDeveloper window, click the Fulfillment.bpel window.
Note: If required, double-click the Fulfillment.bpel file name in the SOA
Content folder of the POProcessing project to open the file.
7) To create the customerEV Entity Variable perform the following steps: b le
fer a
a) In the Fulfillment.bpel Design window, in the main process Fulfillment
ans
scope click the Variables icon ( ) to open the Variables window.
n - t r
a no
b) In the Variables window, create a variable called customerEV whose Type is
has ideฺ
the customersViewSDO element in the CustomerService partner link’s
)
ฺ c om t Gu
imported inline schema definitions. In addition select the Entity Variable option

h o o
and set the Partner Link to CustomerService. Use the following image as a
e n
guide:
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

If you require help to create variable, use the following instructions:


i) In the Variables window, click the Create icon.
ii) In the Create Variable window, set Name to customerEV, in Type select the
Element option and click the Browse Elements icon.

Oracle SOA Suite 11g: Build Composite Applications 23


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
iii) In the Type Chooser window, expand the Partner Links > CustomerService >
CustomerService.wsdl > Imported WSDL > CustomerSDOService >
Inline Schemas > schema folder, scroll down to select the
customersViewSDO entry and click OK.
iv) In the Create Variable window, select the Entity Variable checkbox, and click
the Browse Partner Link icon.
v) In the Partner Link Chooser window, select CustomerService and click OK.
vi) In the Create Variable window, click OK.
vii) In the Variables window, click OK.
c) Save the changes to the Fulfillment BPEL Process.
b le
8) To create the addressEV Entity Variable, perform the following steps:
fer a
a) In the Fulfillment.bpel Design window, locate the Scope_shiporder scope ans
n - t
and click the Variables icon ( ) on the scope toolbar to open the Variables
r
window. a no
b) In the Variables window, create a variable addressEV) haswhose
i d e ฺ is the
Type
addressViewSDO element in the CustomerService
ฺ c om t G u link’s imported
partner
inline schema definitions. In additiono
h o the eEntity
select n Variable option and set the
Partner Link to CustomerService.ya Use d
tuthe following image as a guide:
@ s S
e z zu thi
a y u s e
( s hilp se to
z z u cen
ye li
i l p a
sh

If you require help to create variable, use the following instructions:


i) In the Variables window, click the Create icon.
ii) In the Create Variable window, set Name to addressEV, in Type select the
Element option and click the Browse Elements icon.

Oracle SOA Suite 11g: Build Composite Applications 24


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
iii) In the Type Chooser window, expand the Partner Links > CustomerService >
CustomerService.wsdl > Imported WSDL > CustomerSDOService >
Inline Schemas > schema folder, scroll down to select the
addressViewSDO entry and click OK.
iv) In the Create Variable window, select the Entity Variable checkbox, and click
the Browse Partner Link icon.
v) In the Partner Link Chooser window, select CustomerService and click OK.
vi) In the Create Variable window, click OK.
vii) In the Variables window, click OK.
c) Save the changes to the Fulfillment BPEL process.
b le
Query the Customer Data with a BindEntity Activity fer a
ans
t r
In this section, you create the BindEntity_customer activity to read the customer data
n -
after the Scope_checkstock activity. a no
through the CustomerService as a Service Data Object. You add the Bind Entity activity

9) In the Fulfillment.bpel Design window, collapse ) htheasScope


i d e ฺ
called
Scope_checkstock and the Switch activity calledc m Gu
oScope_shiporder.
o o ฺ n t
h
a Sperform
10) To create the BindEntity_customer activity, e
ud the following steps:
y
@ thehComponent t
a) Drag a BindEntity activity
z z ufrom t is Palette between the
Scope_checkstockyand e e
Switch_orderstatus
a o us activities.
b) Rename the i l p
h se t activity to BindEntity_customer. Use the following
BindEntity
( s
u as a cguide:
image n
z z l i e
a ye
il p
sh

Oracle SOA Suite 11g: Build Composite Applications 25


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
11) To configure the BindEntity_customer settings, double-click the
BindEntity_customer activity. This requires setting the Entity Variable name to be
used, choosing the element representing the query (primary) key, and setting the
value used for the primary key lookup (query) operation. To configure these settings
perform steps in the following table (using associated images as a guide, if required):
Step Screen/Page Description Choices or Values
a. Bind Entity Entity Variable: Click the Browse Variables
icon ( ).
b. Browse Variables Select customerEV, and click OK.
c. Bind Entity Unique Keys: Click the Create icon ( ).
d. Specify Key Key Local Part: Click the Browse Entity
Variable icon ( ) to select the key part. b le
e. Browse Entity Variable Expand Variables > customerEV > fer a
ans
n - t r
customersViewSDO and select the CustId
element that has the namespace prefix (such
a no
as ns10:CustId), and click OK.
has ideฺ
Note: Do not select the first CustId entry,
)
ฺ c om t Gu
which is an annotation identifying the name
of the element representing the key.
h o o e n
f. Specify Key
ya Stu d
Observe that the Key Local Part is CustId,

z @
u this and that the Key Namespace URI is
y e z e populated with
a u s
hilp se to
/customersdo/common/.
( s
u cen
In Key Value: click the Expression Builder
z z li Builder
icon ( ).
g. yeExpression In the Expression select the customerId
ilp a element from the inputVariable, and click
sh OK.
h. Specify Key Verify your Key Local Part, Key Namespace
URI, and Key Value settings are provided
and click OK.
a) To select the Entity Variable:

Oracle SOA Suite 11g: Build Composite Applications 26


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
b)

b le
fer a
c) To create the unique key (primary key) setting:
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye
d) li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 27


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
e)

b le
fer a
ans
n - t r
no
f) Select the source value containing the key value to be queried:
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a g)
sh

Oracle SOA Suite 11g: Build Composite Applications 28


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
h)

12) In the Bind Entity settings window, confirm that the Entity variable customerEV is
selected and the Unique Key is specified, and click OK. Use the following image as a b le
guide: fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
13) Save the changes to the Fulfillment BPEL Process.

Query the Address Data with a BindEntity Activity


14) In the Fulfillment.bpel Design window, locate and if needed expand the
Scope_shiporder activity.
Note: The Scope_shiporder activity is contained in the Switch_orderstatus activity.
15) To create the BindEntity_customer activity, perform the following steps:
a) Drag a BindEntity activity from the Component Palette between the
Assign_shiporder and Switch_shiporder activities.
Note: It may help if you collapse the Switch_shiporder activity.

Oracle SOA Suite 11g: Build Composite Applications 29


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
b) Rename the BindEntity activity to BindEntity_address. Use the following image
as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 30


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
16) To configure the BindEntity_address settings, double-click the BindEntity_address
activity, and configure the settings where:
a) The Entity Variable is addressEV.
b) The Unique Keys is the AddrId element selected from addressEV Entity
Variable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
If you require the steps z @
touconfigureh s BindEntity_address settings perform the
ithe
following steps aye
z e t
u s
s
i) In (the
ilp Entity
hBind e o window, next to the Entity Variable filed, click the
tsettings
z z e ns icon ( ).
uBrowsecVariables
ye li
i l p a ii) In the Browse Variables window, select addressEV, and click OK.
sh iii) In the Bind Entity settings window, next to the Unique Keys section, click the
Create icon ( ).
iv) In the Specify Key window, next to the Key Local Part field, click the Browse
Entity Variable icon ( ) to select the key part.

Oracle SOA Suite 11g: Build Composite Applications 31


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
v) In the Browse Entity Variable window, expand Variables > addressEV >
addressViewSDO and select the AddrId element that has the namespace
prefix (such as ns10:AddrId), and click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a S
Note: Do not select the firstyAddrId
d
tu which is an annotation identifying
entry,
@ s
zu representing
the name of the element
e z e thi the key.
vi) In the Specifyp a yKey window,
us verify that the Key Local Part is AddrId, and
that s i l t
h Key Namespace o
u ( the
n s e URI is populated with /customersdo/common/.

e z e Value click the Expression Builder icon ( ).


z For thelicKey
a y vii) In the Expression Builder window, in the Expression add customerId
i l p
sh element from the inputVariable, and click OK.

Note: We are capitalizing on the fact that the ADDR_ID column in the
ADDRESS table contains the exact same value as the CUST_ID column. This
simplifies how you can access the customer address data needed. Therefore, it
is good to remind you that the Bind Entity activity can only perform a primary
key look up of a row in a database table through the associated Service Data
Object. Alternatively, you could call a Web Service that provide a lookup of
the address using the CUST_ID field instead of the ADDR_ID, or you could
modify the database table definition to use the CUST_ID as the primary key
instead of the ADDR_ID. The latter would be fine if there was only one
address per customer supported.

Oracle SOA Suite 11g: Build Composite Applications 32


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
viii) In the Specify Key window, verify your Key Local Part, Key Namespace
URI, and Key Value settings are provided and click OK.

b le
Note: The Key Value is the customerId element from the inputVariable.
fer a
ans
ix) In the Bind Entity settings window, click OK.
n - t r
a no
has ideฺ
17) Save the changes to the Fulfillment BPEL Process.
)
Populate the Shipping Request with Customer
ฺ c om t andG uAddress Data
In this section, now that you have queried the
h o o
customer e n address information by using
and
ya activity
the Bind Entity activities, you another Assign
d
tu with several copy operations to
@ s S
zu containing
modify the shipping request variable
Scope_shiporder activity.yez
thi information sent to a JMS adapter, in the
a o us e
i l p
h se twindow, inside the Scope_shiporder drag a new Assign
18) In the Fulfillment Design
( s
activityubetween the n BindEntity_address and Switch_shiporder activities. Rename the
e
new z z
Assign l i c e
activity to Assign_shipaddress. Use the following image as a
a yguide:
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 33


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
19) Double-click the Assign_shipaddress activity and use the following steps to configure
the copy operations that populate the shippingRequest variable elements:
a) In the Assign settings window, create a copy operation that concatenates the
customerEV variable’s FirstName element, a literal string containing a single
space, and the LastName element in the “From” expression to the > custName
element in the shippingRequest variable local to Scope_shiporder. Use the
following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 34


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
b) In the Assign settings window, create second copy operation that copies the
addressViewSDO > Street element in the addressEV to the shippingRequest >
shippingAddress > street element. Use the following image as a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@
u create
c) In the Assign settings window,
z h isa third copy operation that copies the
z
addressViewSDO >eCity element t
e in the addressEV to the shippingRequest >
a y u s
s h ilp e to
shippingAddress > city element.
d) In the
u ( n s window, create a fourth copy operation that copies the
Assign settings
z z li c e
a ye addressViewSDO > State element in the addressEV to the shippingRequest >
shippingAddress > state element.
i l p
sh e) In the Assign settings window, create a fifth copy operation that copies the
addressViewSDO > Zip element in the addressEV to the shippingRequest >
shippingAddress > zip element.
f) In the Assign settings window, create a sixth copy operation that copies the
addressViewSDO > Country element in the addressEV to the shippingRequest >
shippingAddress > country element.
20) Important Note: In the Fulfillment.bpel Design window, expand the
Switch_selectstore activity flow (inside the Scope_checkstock activity), to ensure that
the left-most <case> branch is titled “<case internalstore=in-stock>”,
otherwise the process will not work as documented to acquire stock from the internal
store first when both the internal and online store have items in stock.

Do the following steps if and only if the “<case internalstore=in-


stock>”, is not the left most <case> branch. Perform the following steps to fix it in
the Source code window:

Oracle SOA Suite 11g: Build Composite Applications 35


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
a) In the Fulfillent.bpel Design window, expand the Switch_selectstore
activity.

b) In the Fulfillent.bpel Design window, select the “<case


onlinestore=in-stock>” branch.

b le
fer a
an s
n - t r
a no
c) In the Fulfillent.bpel Design window, at the ) as eฺside of the
hbottom-left
window click the Source tab. c o m Guid
h o oฺ ent
y a Stud
z z u@ this
a y e s e window, just below the “<switch
u
hilp se to
d) In the Fulfillent.bpel Source
( s
name=="Switch_selectstore">”
u n
element, click the collapse icon in the

e z z gutterlicforethe line containing the source code starting with


line
a y “<case
i l p condition="bpws:getVariableData('Receive_onlinestore_...”
sh

e) In the Fulfillent.bpel Source window, just below the collapsed “<case


condition="bpw...</sequence></case>” line, click the collapse icon
in the line gutter for the line containing the source code starting with
“<case
condition="bpws:getVariableData('Receive_internalstore_...”

Oracle SOA Suite 11g: Build Composite Applications 36


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-3: Query Customer and Address Data with Entity
Variables (continued)
f) In the Fulfillent.bpel Source window, select the entire second (bottom-
most) collapsed “<case condition="bpw … </sequence></case>”
line, and drag it before the first “<case condition="bpw...
</sequence></case>” line (just after the “<switch
name="Switch_selectstore">” element):

b le
fer a
ans
n - t r
no
g) In the Fulfillent.bpel Source window, after dragging the internal store
a
has ideฺ
<case> branch the Source window automatically expands the code and you can
verify that the “<case )
ฺ c om t Gu
condition="bpws:getVariableData('Receive_internalstore_... ”
o o n
line appears immediately after the “<switch
y a h t u de
element:
name="Switch_selectstore">”
z u@ his S
a y ez se t
i lp t o u
h
(s nse
z z u c e
y e l i
a h) In the Fulfillent.bpel Source window, at the bottom-left side of the
i l p
sh window click the Design tab.

i) In the Fulfillent.bpel Design window, verify that the “<case


internalstore=in-stock>” branch is the left-most branch.

21) Save the changes to the Fulfillment BPEL process, and optionally close the
Fulfillment.bpel window.

Oracle SOA Suite 11g: Build Composite Applications 37


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables
In this practice, you deploy the POProcessing composite application, which contains the
modified Fulfillment BPEL Process. You use Oracle Enterprise Manager to test the
composite application with a new order containing two items, by using the
D:\labs\files\xml_in\po-large-guitar.xml file for the order. When you
examine the results of the test you are looking for the following information:
• The order is sent to Fulfillment for processing.
• The Fulfillment BPEL Process successfully inserts the order and items into their
database tables.
• The Fulfillment process selects a JMS Adapter for the shipping request that
should contain customer name and address information.
1) Deploy the modified POProcessing composite application, by right-clicking the b le
POProcessing project name and selecting Deploy > POProcessing > to soaserver. fer a
Overwrite the existing version and ensure deployment is successful. ans
n - t r
Farm navigator, and click the “POProcessing [1.0]” link. a no
2) In the Oracle Enterprise Manager SOA home page, expand the SOA folder in the
s ฺ
hawithin
3) To perform a test with a valid credit card and an order)total
o m u idethetabcredit limit, on
the “POProcessing [1.0]” Test Web Service page,
o
Arguments section, perform the followingosteps:
ฺc nt G
under the Request Input

y a h tude
a) Replace the XML data with@ the contentsSof the file
z u h i s
a y ez se t
D:\labs\files\xml_in\po-large-guitar.xml.
u order have a quantity value of 1 (one), and then
lp itemstoin the
b) Ensure that iboth
click Testh
(s WebnService.
se
z u e
y ez lic
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 38


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables (continued)
c) On the Response tab, click the Launch Message Flow Trace link.

Note: After clicking the Launch Message Flow Trace link the Trace tree may
show a partially completed tree (as shown in the following image):

b le
fer a
ans
n - t r
a no
) h as eฺ
If you see a result similar to the above image then
o click the
mflow u d icon in the
iRefresh
c
oฺ ent
top-right corner of the Flow Trace page until the G
is completed.
h o
a Stud
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 39


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables (continued)
4) On the Flow Trace page, examine the Trace tree shown in the image provided and
answer the questions that follow the image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a Note: To view the Flow Trace tree shown in the image, you may need to collapse the
sh ValidateCCService row, and below the Fulfillment row collapse all the OnlineStore
and InternalStore entries. This enables you to look at the parts of the process flow you
are interested in.

Using the Flow Trace tree answer the following questions:


a) Do you think that the order and two items were successfully inserted to their
database tables? Explain your answer from information in the Flow Trace tree.
b) What do the OrdersService row entries represent?
c) Do you think the customer and address information was successfully queried?
Explain your answer.
d) Using the Flow Trace tree, how can you tell if the order was shipped?
e) What is the order id assigned to the new order? Where can you find this
information in the Fulfillment BPEL process Audit Trail page?

Oracle SOA Suite 11g: Build Composite Applications 40


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables (continued)
Q Answers to Step 4.
a. Yes. The order information was inserted if you see the OrdersService row entry
with a Completed State immediately below the Fulfillment BPEL Component.
b. The first OrdersService row represents the insertion of the order and item
information into the database. The subsequent OrdersService row entries, also in
the Completed state, represent when the order status and date shipped values are
updated through the orders Entity Variable.
c. Yes. The customer and address information was queried successfully. This is
implied by the CustomerService row entries with a Completed State that appear
below the Fulfillment BPEL Component after the second InternalStore reference.
d. The UPSJmsService row entry exists near the end of the trace tree.
e. The order ID value should be 100. To locate the activity that shows the order ID
value, click the Fulfillment link in the Trace tree. In the Instance of Fulfillment b le
Audit Trail page, locate and expand the “<payload>” part for the Assign_orderid fer a
activity (the second activity in the flow). For example: ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh Note: The ORDER_SEQ database sequence is configured to start with the value
100 and increment by 1 for subsequent orders.
5) Using the order ID value, obtained from the ORDER_SEQ sequence by the
Fulfillment BPEL process, verify that the order data appears in the ORDERS and
ITEMS database table, by performing the following steps:
a) In the JDeveloper window, select Tools > SQL Worksheet
b) In the Select Connection window, click OK (as any soademo connection is
sufficient for this task).
c) In the SQL Worksheet window, to display the order data in the ORDERS table
enter and execute the following SQL statement:

select * from orders where ord_id = 100;

Oracle SOA Suite 11g: Build Composite Applications 41


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables (continued)
d) Use the following image as a guide to verify you have a similar set of values in
the Results tab:

Note: The TOTAL_PRICE column contains a value 4100 (the correct order total
b le
for the item price and quantities specified), the DATE_SHIPPED column is been
fer a
s
populated indicating that the shipping request was sent to a shipping company,
an
and the STATUS column has been updated to the value 'completed'. The
n - t r
no
dates stored for your order are most likely different to those shown in the image.
a
e) In the SQL Worksheet window, to display the item data
) h asin theeITEMS
ฺ table for
the same order enter and execute the followingm
o id
SQL statement:
u
c
oฺ e=nt100; G
select * from items where h o
a Studord_id
y
z u@
Use the following imagezas a guide
t h isverify you have two rows with the same
to
e following
values representedyin
a s eimage of the Results tab:
u
( s hilp se to
z z u cen
ye li
i l p a
sh

f) Close the SQL Worksheet window.


g) In the “Save files” window, click No.

Oracle SOA Suite 11g: Build Composite Applications 42


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 11-4: Deploy and Test Data Management with Entity
Variables (continued)
Note: You can optionally execute the
D:\labs\files\sql\gibson_query.sql statement in another SQL
Worksheet window and verify that the INTERNAL column has a value of 2 for
PROD_ID=SKU106, and a value of 4 for the PROD_ID=SKU200. The results are as
shown in the following image:

6) If you have time, consider examining the Audit Trail or Flow tabbed pages for the
b le
Fulfillment BPEL process in more detail to examine the various process activities that
fer a
use Entity Variables.
a n s
7) Close the Flow Trace Web browser window and any SQL Worksheet windows. n -t r
o
n and address
a
8) Finally, to verify that the shipping request contains the customer name
information, perform the following steps: ) has ideฺ
a) Open Windows Explorer, and navigate toฺthe c m Gfolder
oD:\temp u where the
o o e n t
h
shipping request XML files are written.
a Stu
ythe d
b) Double-click the XML file
z u @
with
h
largest
i s number appended to the name
shiporder_. Foreexample,z e t
shiporder_6.xml.
a y
Note: Double-clicking an u s
XML file in Windows Explorer opens the file in an
h i lp window.
t o
u (s nse
Internet Explorer

e z z l i c e
i lpay
s h

Note: You can right-click the shiporder_6.xml file and select Open With >
WordPad, to view the file in WordPad. Optionally, you can verify that the file
contents are consistent with the values in the Audit Trail for the related activities.
c) Close the Internet Explorer (tab page, or window), the WordPad, or the Notepad
window used to display the contents of the shiporder_6.xml file.

Oracle SOA Suite 11g: Build Composite Applications 43


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 12
The goal of this practice is to implement a Human Task component and email notification
functionality in the POProcessing composite application.

The POProcessing composite application assembly model is modified first by creating a


Human Task component and wiring it to the ApproveCCOrder BPEL process. In
addition, you create a wire from the ApproveCCOrder BPEL process to the
CustomerService for the email notification implementation.

The following image shows the changes to the POProcessing assembly model:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
The Human Task and email notificationyis aorchestrated d
tu by adding activities in the
ApproveCCOrder BPEL process.uManual @ i s
order Sapproval is performed for orders with a
z z t
e total exceedsh
valid credit card whose order
a y u s e the value 5000.
s
Email notification
( hisilpimplemented
e to to notify the customer about the status of their order.
z u wiringcethensApproveCCOrder BPEL Process with the CustomerService, such
This requires
z
e customerlidata containing the email address can be obtained for the email
thatythe
a
ilpnotification.
sh

Oracle SOA Suite 11g: Build Composite Applications 44


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
The following image depicts the changes made to the ApproveCCOrder BPEL Processes
in the POProcessing composite application:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u the h s
ichanges
For implementing the humanzworkflow,
e e t made in ApproveCCOrder BPEL
y s branch include:
ilpatoecheck
Process in Switch_ccvalid activityu<case>
• Adding s ahSwitch t o if manual approval is required based on the order total.
u
• Creating
( a Humanns Task activity to initiate human workflow, and implement the
z z c e
li <case> branches for each task outcomes to set the order status, and
a ye task switch

sh ilp perform fulfillment processing for approved orders.


Note: You also generate an ADF-BC project containing JavaServer Faces (JSF)
application files needed to display the task payload in the Human Task Worklist
application so that the approver can view the order details. This project must be deployed
after the composite with the Human Task is deployed.

For email notification the changes made include:


• Wiring the ApproveCCOrder BPEL Process component to the CustomerService
• Adding a Scope_notifycust at the end of the BPEL Process, which contains:
o An Entity Variable for the customer data
o A Bind Entity activity to get the customer information
o An Email Notification activity to send an email to the email address
obtained in the customer Entity Variable.

Oracle SOA Suite 11g: Build Composite Applications 45


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification
In this practice, you open the POProcessing composite assembly model and create a
Human Task component. You first configure the Human Task property settings before
wiring the Human Task component and the CustomerService external reference to the
ApproveCCOrder BPEL Process.

To complete these tasks, perform the following steps:

Create and configure the Human Task Component


In this section you create the Human Task component called ManualApproval in the
POProcessing composite.xml file, and configure the Human Task component
settings. e
a b l
1) In the JDeveloper window, ensure the POApplication name is selected in the
s fer
Content folder are expanded. - t an
Application Menu pull-down menu, and that the POProcessing project and its SOA
r
n
no
a
2) To add a Human Task component to the POProcessing assembly model perform the
following steps:
) has ideฺ
a) Double-click the composite.xml file tocopen
ฺ omit int the
G uComposite Editor
window.
h o o e n
d
ya dragSa Human
tu Task component from the
b) In the composite.xml window, @ s
ztheu Components
Component Palette into
e z e thi column.
c) In the Createilp ay Task
Human o
s enter ManualApproval as the Name,
uwindow,
shdefault
accept(the
t
e for other settings, and click OK.
z u e n svalues
Note: Theic
yezselected. lUse
“Create Composite Service with SOAP Bindings” option should not be
a the following image as a guide:
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 46


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
d) In the composite.xml window, verify that the ManualApproval component
has been added to the diagram. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
Note: A ManualApproval.componentType and ManualApproval.task file
are added to the project. The human task implementation details are stored in the
has ideฺ
ManualApproval.task file, which contains the human task configuration
)
settings.
ฺ c om t Gu
o
3) To edit the ManualApproval Human component
h o settings,
e n on the composite.xml
ya Human
window, double-click the ManualApproval
d
tu Task component icon. The
@ s S
e z zu thi
Human Task Editor opens ManualApproval.task file.
4) To configure the p a y us e task header settings, on the
i l ManualApproval.task
t o
( sh nse window in the top section of the window set the
ManualApproval.task
u
e z z fields:
following
l i c e
y
sh ilpa Title: Select Plain Text from the pull-down menu and enter: Manual
Approval
Description: Manually approve orders

Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 47


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
5) To configure the task parameters, perform the instructions in the following table and
use the associated screenshots:
Step Screen/Page Description Choices or Values
a. ManualApproval.task To add a task parameter, next to the Parameters heading,
click the Create icon ( ).
b. Add Task Parameter Select the Element option, and click the “Browse for complex
types” icon ( )
c. Type Chooser Expand the Project Schemas > internalorder.xsd,
select order and click OK.
d. Add Task Parameter Verify the Element name is
{http://www.example.org/ns/intorder}order,
and select the “Editable via worklist” option, which enables b le
fer
the order details to be changed by the approver. Click OK. a
e. ans
ManualApproval.task In the Parameters section verify the addition of the parameter
you created. n - t r
no
Note: This defines the structure of the parameter data that is
a
) has ideฺ
expected to be in the task payload. The BPEL process must
provide the data for this task parameter.
ฺ c om t Gu
a)
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
b)ezz
u cen
y li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 48


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d)
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

e)

f) Save the changes to your task file.

Oracle SOA Suite 11g: Build Composite Applications 49


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
6) To configure the task assignment and routing policy to assign the task to a single
approver, in the “Assignment and Routing Policy” section perform the following
steps:
a) In the Assignment and Routing Policy diagram, double-click the heading text
“Stage1” in the shaded box.

b le
fer a
an s
n - t r
a no
) has ideฺ
b) In the Edit window, enter Approval and clickoOK.
c m Gu
o o ฺ n t
h
a Stud e
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
a yc)e To add theli approval participants, that is the assignee of the task, select the text
i l p “<no participants>” inside the box with the stage title Approval, and click the Edit
sh option.

Note: This opens the Add Participant Type window, where you can configure the
task assignment rules.

Oracle SOA Suite 11g: Build Composite Applications 50


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
7) To configure task assignment rule for a single user participant, on the Add Participant
Type window perform instructions in the following table and use the associated
screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Add Participant Type With Type: Single, and accepting all other
default settings. In the Participant Names
table: click the Add icon ( ) > Add User
option.
b. Add Participant Type In the user row added to the Participant
Names table, click the edit icon ( ) in the
Value column.
c. Identity Lookup Next to the Application Server field, click b le
the Create icon ( ), to create a new fer a
connection. ans
n - t r
no
Note: This opens the Application Server
a
) has ideฺ
Connection wizard. A new Application
Server connection is needed to connect to
ฺ c om t Gu
the Embedded LDAP Server to lookup the
h o o e n
participant user name. The LDAP Server is
ya Stu d
accessed on a different port 8001 used for
z @
u this the soaserver connection.
y e z e
a) a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 51


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
b)

b le
fer a
ans
n - t r
c)
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
8) Create a new Application Serverz @ h is for the Embedded LDAP Server, by
u connection
performing the following z
e steps: se t
a y uServer Connection – Step 1 of 5 Name and Type”
h
a) On the “Create i lp Application
t o
u
page, (s ldapconnection
enter n se in the Connection Name, accept default settings
z z l i c e
a ye for other fields, and click Next.
p
il b) On the Create Application Server Connection – Step 2 of 5 Authentication page,
sh enter weblogic in the Username, welcome1 for the Password, and click Next.
c) On the Create Application Server Connection – Step 3 of 5 Configuration page,
change Port to 8001, SSL Port to 8002, and WLS Domain to soa_domain,
accept other values as their default, and click Next.

Oracle SOA Suite 11g: Build Composite Applications 52


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
d) On the Create Application Server Connection – Step 4 of 5 Test page, click Test
Connection. Wait for the results to be reported in the Status area, and click Finish.
Use the following image as a guide, and verify that you get 3 of 8 tests successful.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye Note: Theli JNDI, JSR-160 Runtime, and HTTP tests should be successful. This is
i l p a sufficient for the connection required to access the LDAP Server information.
sh

Oracle SOA Suite 11g: Build Composite Applications 53


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
e) After you click Finish to close the Create Application Server Connection wizard
window, the Identity Lookup window is refreshed with the ldapconnection
setting selected. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s h ilp e to
Note: ( ns is made and the Realm contains jazn.com.
u The cconnection
z z e
li Lookup window, lookup and select the user jcooper as the
9) yInethe Identity
a
ilp participant by performing the following steps:
sh a) For the Search Pattern, accept the default selections and to the right of the pull-
down menu with User Name selected, click the Lookup icon ( ).
Note: Clicking the Lookup icon populates the Search User area with a list of user
names registered in the LDAP Server.

Oracle SOA Suite 11g: Build Composite Applications 54


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
b) In the Search User areas, scroll down, locate, and select the user name jcooper,
and click Select. This copies the selected user name to the Selected User area, and
click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s hilp seType
10) In the Add(Participant towindow, verify that the selected user name (jcooper)
z z
appears
c n Names table row, and click OK.
uin the Participant
e
ye l i
il p a
sh

Oracle SOA Suite 11g: Build Composite Applications 55


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
11) In the ManualApproval.task window, verify that the Assignment and Routing
Policy diagram contains the Approval.Participant1 value. Use the following
image as a guide:

b le
fer a
12) Finally, on the ManualApproval.task window, expand the Notification Settings
ans
t r
section and ensure that the notification settings are enabled to send an email to the
n -
a no
Assignees when the task is assigned to the user. You can click the Edit icon (pencil)
in the Notification Header column to examine the text used for the email subject.
hastheideฺ
13) Save all the changes to the POProcessing Project, and)close
ManualApproval.task window. ฺ c om t Gu
h o o e n
Wire the ManualApproval andyCustomerServicea Stu d to ApproveCCOrder
@ s
zu thi Human Task component and
In this section you wire the ManualApproval
CustomerService external y e z
referencestoethe ApproveCCOrder. This creates the respective
i a
p Process
lBPEL o uso that the services can be orchestrated by the
Partner Links in the
h
(s flow.nse t
business process
u
z z lice
14)yInethe composite.xml window, drag a wire from the ApproveCCOrder BPEL
p a
il Process component to the ManualApproval Human Task component.
sh

Oracle SOA Suite 11g: Build Composite Applications 56


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-1: Modify the POProcessing Model for Human Task
and Notification (continued)
15) In the composite.xml window, drag wire from the ApproveCCOrder BPEL
Process component to the CustomerService external references.
Note: You may need to allow the window to scroll down while dragging the wire to
the CustomerService. Use the following image as a guide for the results you can
expect to see after the wire has been created:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
e
16)yOptionally, li the ApproveCCOrder BPEL process in the BPEL Editor and
open
a
ilp confirm that the two partner links (for ManualApproval and CustomerService) have
sh been added to the Partner Links column on the right side of the window. Use the
following image as a guide:

17) Save all the changes to the POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 57


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process
In this practice, you modify the activity sequence in the Switch_ccvalid <case> branch in
the ApproveCCOrder BPEL Process. The changes include:
• Adding a Switch to check if the order total is greater than 5000.
• Configuring the <case> branch to execute Human Task wired to the BPEL
process to implement the human workflow.
• Creating a Human Task to use the Human Task component configured in the
composite application, and specifying its input parameter data.
• Configuring the task switch <case> branches for each task outcome to set the
order status accordingly
• Creating a switch to check the order status and perform fulfillment processing for
approved orders.
b le
You also generate ADF Task Form project for the Human Task to display the task
fer a
parameter information in the Worklist application.
ans
n - t r
To complete the tasks, perform the following steps:
a no
Create and Configure a Switch to Check the )Order has Total
i d e ฺ
In this section you create a Switch with <case> branch
ฺ c omthat compares
t G u if the order total is
o o
greater than 5000, and configure the Switch branches.
h e n
ya Stu d
1) In the JDeveloper window, if the @ApproveCCOrder.bpel window is not visible,
u i s
y e zz e th file name in the Application Navigator,
double-click the ApproveCCOrder.bpel
or double-click the a us BPEL Process icon on the composite.xml
p ApproveCCOrder
tabbed page.shil t o
z u (
e n se
e z
2) In the
l i c
ApproveCCOrder.bpel
ythe Switch_ccvalid activity.
Diagram window, locate and expand (if required)

sh ilpa
3) For visual clarity, collapse the Scope_fulfillment activity in the <case> branch of the
Switch_ccvalid activity.

Oracle SOA Suite 11g: Build Composite Applications 58


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
4) In the ApproveCCOrder.bpel Diagram window, drag a new Switch inside
Switch_ccvalid activity the activity before the Scope_fulfillment activity, and rename
the Switch to Switch_checkapproval. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
a Stu activity to view the same
Note: You may need to collapse @ theyScope_fulfillment
z
results in the above image. z u this
5) To configure thelp a ye use perform the following tasks:
Switch_checkapproval,
s h i e to
a) Expand ( ns
u thecSwitch_checkapproval activity
z z e
li the <case> branch title, in the Switch Case settings, set the Name to
a yb)e Double-click
sh ilp “Approval required” (excluding quotes), and the condition which
compares if the orderTotal element in the inputVariable is greater than 5000. Use
the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 59


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
c) Drag an Assign activity into the <otherwise> branch and rename it to
Assign_autoapproved. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
Create and Configure y z
ethe Human
e Task Activity
a u s
In this section you
s ilp the
hcreate e to Task activity and select the ManualApproval task
Human
(
definition created
u with nthes Human Task component in POProcessing composite.xml.
z z c e
e a Humanli Task activity into the “<case Approval Required>” branch of the
6) yDrag
a
ilp Switch_checkapproval activity.
sh Note: When you drag a Human Task into a BPEL process the Create Human Task
window is displayed.

Oracle SOA Suite 11g: Build Composite Applications 60


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
7) To configure the Human Task activity, perform steps in the following table and use
the associated images as a guide:
Step Screen/Page Description Choices or Values
a. Create Human Task Task Definition: ManualApproval, which is
selected from pull-down menu.
Note: After selecting ManualApproval from the
task Definitions pull-down menu, additional
configuration fields are exposed.
b. Create Human Task Click the ellipsis icon ( ) in the BPEL Variable
field for the Task Parameter called order.
Note: This action allows you to select the sources
for the data provided as a parameter to the human
b le
task service.
fer a
c. Task Parameters
ans
Expand the Variables > outputVariable > payload
- t r
folder, select the order element and click OK.
n
d. Create Human Task no
Verify that the BPEL Variable column contains the
a
has ideฺ
selected value, accept default settings for other
)
fields, and click OK.
a) ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh b)

Oracle SOA Suite 11g: Build Composite Applications 61


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
d) ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 62


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
8) In the ApproveCCOrder.bpel Diagram window, verify that the <case Approval
required> branch contains two activities: the ManualApproval_1 and taskSwitch
activities. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
9) Configure the Assign_autoapproved
z @
u by h is a copy operation that copies the
creating
string literal 'approved' z
e to the t
eorder > status element in the outputVariable. Use
a y u s
hilp sasea guide:
the following image
( s to
z z u cen
ye li
ilp a
sh

10) Save the changes to the ApproveCCOrder BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 63


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
Configuring taskSwitch Branches for Task Outcomes
In this section, you expand the taskSwitch activity and configure the <case> branches for
each outcome result returned from the task services when completed. In each <case>
branch you create an Assign activity to set the order > status in the outputVariable.
11) In the ApproveCCOrder.bpel Diagram window, expand the taskSwitch that
appears after the ManualApproval_1 Human Task activity.
12) Drag an Assign activity inside each of the taskSwitch <case> branches after the
CopyPayloadFromTask activities, and delete the <otherwise> branch. In addition
perform the following steps:
a) In the “<case Task outcome is APPROVE>” branch rename the Assign activity to
Assign_manualapprove.
b l e
b) In the “<case Task outcome is REJECT>” branch rename the Assign activity to
f er a
Assign_manualreject. an s
- t r
Use the following image as a guide:
n on
s a
) a
h ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
e li
i lpay
s h

Oracle SOA Suite 11g: Build Composite Applications 64


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
13) Configure the Assign_manualreject activity with a copy operation that copies the
string literal 'rejected' to the order > status element in the outputVariable. Use
the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e activity with a copy operation that copies the
14) Configure the Assign_manualapprove
a u s
( s hilp se toto the order > status element in the outputVariable. Use
string literal 'approved'

z z u image
the following
c e n as a guide:
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 65


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
15) Collapse the taskSwitch activity.
16) Save the changes to the ApproveCCOrder BPEL Process.

Create a Switch to Fulfill Approved Orders


In this section, you create a Switch activity with a <case> branch for the
Scope_fulfillment activity to ensure that approved orders are process by Fulfillment and
orders that fail credit card validation or are rejected are not processed by the Fulfillment.
17) In the ApproveCCOrder.bpel Diagram window, drag a new Switch inside the
Scope_validatecc activity before the Scope_fulfillment activity, and rename the
Switch to Switch_approved. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 66


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
18) To make sure that order fulfillment is executed for approved orders, drag the
Scope_fulfillment activity into the <case> Branch of the Switch_approved activity.
Note: Expand the Switch_approved activity, and move the Scope_fulfillment into the
<case> Branch and delete the <otherwise> branch. Use the following images as
a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
Note: Collapse the Scope_fulfillment
d
yaactivityStotuobtain the same results as the above
image. z @
u this
y e z e <case> branch Name to “Fulfill
a
19) Configure the Switch_approved u s
activity
Approved”
( s handilpspecify
e taocondition that compares the ouputVariable > order >
z c e ns string literal value 'approved'. Use the following
statusztouthe case-sensitive
e as a guide:
yimage li
ilp a
sh

20) Save the changes to the ApproveCCOrder BPEL Process.

Oracle SOA Suite 11g: Build Composite Applications 67


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
Generate the ADF Task Form for the Human Task
In this section, you use the Human Task to generate a default ADF Task Form Project,
which contains JSF code to display the task parameter information in the Worklist
application. The Worklist application displays the generated Task Form that is viewed by
the task assignee to approve or reject the orders sent for manual approval.
21) To generate the Human Task Form Project perform the following steps:
a) In the ApproveCCOrder.bpel Diagram window, right-click the
ManualApproval_1 activity and select Auto-Generate Task Form.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilpProject
b) In the Create
e to enter the Project Name: ApprovalTaskForm,
window,
anduclick OKens
e z z lic
a y
i l p
sh

Note: JDeveloper may start to consume 100% of the CPU at this time to begin the
generation process. Please wait for the processing to complete.

Oracle SOA Suite 11g: Build Composite Applications 68


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
c) In the Edit Table Columns window, if it is displayed, accept the default settings
and click OK.

b le
fer a
ans
n - t r
a no
Note: Again JDeveloper may start to consume 100% of
) h asthe CPU
e ฺ at this time to
continue the generation process. Please wait form
o id to complete, while
the processing
u
the following message is displayed: c
oฺ ent G
h o
a Stud
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 69


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-2: Implement Manual Approval in the
ApproveCCOrder BPEL Process (continued)
d) When the ADF Task Forms generation is completed the taskDetails1.jspx
window displays the generated task form in the designer.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
e) Close
z z c e n
u the ManualApproval_TaskFlow.xml and taskDeatils1.jspx

a ye windows,liand in the Application Navigator verify that your POApplication


application workspace contains the ApproveTaskForm project.
i l p
sh

22) Select File > Save All to save the changes to the POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 70


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
In this practice, you add a new scope to the ApproveCCOrder BPEL Process. You create
the activities in the scope to obtain the customer email address using an Entity Variable,
and send an email notification to the customer.
1) In the JDeveloper window, open the ApproveCCOrder.bpel Process file, if it is
not already opened by double-clicking the file name in the Application Navigator
window.
2) In the ApproveCCOrder.bpel Diagram window, drag a new scope and drop it
before the callbackClient (after the Scope_validatecc activity, which you may wish
to collapse). Rename the new scope to Scope_notifycust. Use the following
image as a guide.

b le
fer
3) Expand the Scope_notifiycust activity, and create a local Entity Variable in the scope a
called customerEV based on the customersViewSDO element type and the
ans
CustomerService partner link. Use the following image as a guide:
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: To select the Element value, in the Type Chooser expand the Partner Links >
CustomerService > CustomerService1.wsdl > Imported WSDL >
CustomerSDOService > Inline Schemas > schema folder, scroll down and select
customersViewSDO, and click OK.

Oracle SOA Suite 11g: Build Composite Applications 71


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
(continued)
4) Drag a Bind Entity activity into the Scope_notifycust, and rename it to
BindEntity_customer.

b le
fer a
ans
n - t r
a no
5) Configure the BindEntity_customer activity with the Entity Variable: customerEV,
has ideฺ
and the Key Local Part: CustId (selected from the customerEV variable), and the
)
ฺ c om t Gu
Key Value: set to the customerId element in the inputVariable > order element.
Use the following images as a guide:
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 72


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
(continued)

b le
fer a
ans
n - t r
n o
6) Save the changes to the ApproveCCOrder BPEL Process. s a
7) Drag an Email activity from the Component Palette into ) hthea Scope_notifycust
i d e ฺ activity
o m u
after the BindEntity_customer activity. Rename
Email_customer. Use the followinghimage o n tG
oฺcasthea eguide:
Email activity to

y a Stud
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 73


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
(continued)
8) To configure the Email_customer activity, double-click the Email_customer activity
icon, using the following image as a guide perform the steps that appear after the
image:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a
p window, u s
( s hilsettings
a) In the Email
e to in the “To” field click the XPath Expression
z z u iconce( ns).
Builder
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 74


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
(continued)
b) In the Expression Builder window, select the Email element from the customerEV
> customersViewSDO structure, and click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s
Note: (You
ilpdynamically
hare e to obtaining the customer email address from the
z u data
customer
z c e ns into the customerEV Entity Variable.
retrieved
ye li
i l p a c) In the Subject field, enter the text: “Your order status: ” (excluding
sh quotes, and including a trailing space). Then with the cursor at the end of this text,
click the XPath Expression Builder icon ( ) for the field and select the order >
status element from the outputVariable for the Expression in the Expression
Builder.
Note: The resulting Subject line should contain the following text (on one line,
which is split over a couple of lines here for readability):

Your order status: <%bpws:getVariableData('outputVariable',


'payload','/ns2:order/ns2:status')%>

Oracle SOA Suite 11g: Build Composite Applications 75


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-3: Send Order Status Email Notification to Customer
(continued)
d) In the Body field, you can construct any message you like, and include a
combination of text, HTML tags, and use the XPath Expression Builder icon ( )
to select dynamic content, such as the FirstName from the customerEV, and the
status from the outputVariable > order element.
Note: To save time, you can open the file called
D:\labs\files\xml\email-body.xml and copy its entire contents into
the Body field. For your reference, the supplied email Body text (formatted here
for readability) is:

<p>Dear <%bpws:getVariableData('customerEV',
'/ns7:customersViewSDO/ns7:FirstName')%>,</p>
<p>The status of your order is:
<b><%bpws:getVariableData('outputVariable','payload',
b le
'/ns2:order/ns2:status')%></b>.</<p>
fer a
<hr>
an s
<p>Thank you for shopping with us. For more information
n - t r
contact customer support on 1800-MUSICFANS.</p>
a no
Note: If you use the email-body.xml file, then ) hasmayidhave
you e ฺ to change the
XML Namespace prefix ns2 to match the actual
ฺ c omXML t G u
Namespace prefix
generated for your application structures.
h o o Otherwise
e n consider manually entering
and constructing the email bodyytext.a Stu d
e) In the Email settings window,z @ is
u afterthcompleting the above configuration steps click
y e z e
OK.
i l p a
t o us
u ( hcan accept
Note: If thesEmail e does not keep its name and it appears to be called
activity
n s
e z z
Email_1, you
l i c e that change, or rename it back to Email_customer.
9) ySave the changes to the ApproveCCOrder BPEL Process.
a
il p
sh

Oracle SOA Suite 11g: Build Composite Applications 76


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects
In this practice/task, you deploy the POProcessing composite application, which contains
the modified ApproveCCOrder BPEL Process.

Deploy the POProcessing Composite and ApprovalTaskForm


1) Deploy the modified POProcessing composite application, by right-clicking the
POProcessing project name and selecting Deploy > POProcessing > to soaserver.
Overwrite the existing version and ensure deployment is successful.

Note: You may ignore the following compiler warnings when you deploy the
POProcessing composite application:
b le
fer a
ans
n - t r
a no
) has ideฺ
2) To deploy the ApprovalTaskForm ADF application
ฺ c omfiles,t perform
G u the following steps:
a) Click the Application Menu icon and o
h o Deploy
select e n> ApprovalTaskForm > to
soaserver. ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 77


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
b) In the Select Deployment Targets window, select soa_server1 and click OK.

c) In the Deployment – Log window verify that deployment is successful.


d) Select File > Save All to save changes to the POApplication application b le
workspace. fer a
a n s
Test Human Task and Email Notification with an ApprovenAction -t r
o
In this section, you submit an order whose total is greater than 5000atoncause the
POProcessing application to initiate the Human Task for manual
) h asapproval ฺ of the order.
eabout
As the employee jcooper, you check your email to readm
o i d
the notification
u the
c
oฺ etonapprove
assigned task, and then login to the Worklist application t G order.
h o
3) On the Oracle Enterprise Manager y a home
SOA
S t ud expand the SOA folder in the
page,
@ his [1.0]” link.
Farm navigator, and click theu“POProcessing
z
e z e t the order whose total is greater than 5000,
4) To perform a test and a ymanually
u s
approve
i lp steps:
perform the following
h t o
u (s nse [1.0]” Test Web Service page, under the Request tab Input
a) On
e z z l i c e
the “POProcessing
a y Arguments section, perform the following steps:
p
il b) Replace the XML data with the contents of the file
sh D:\labs\files\xml_in\po-large-guitar.xml, and then click Test
Web Service.
c) On the Response tab, click the Launch Message Flow Trace link.

Oracle SOA Suite 11g: Build Composite Applications 78


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
5) On the Flow Trace page, examine the Trace tree shown in the image provided and
answer the questions that follow the image:

b le
fer a
ans
n - t r
a no
Note: If the process Flow Trace tree does not resemble the
s image,
haabove ฺ wait a few
) i d e
seconds and refresh the page before you continue.
ฺ c om t G u to refresh the page a
You may need
few times.
h o o e n
d
ya Stuquestions:
z @
Using the Flow Trace tree answer the following
u this
a) Has the entire process
y z
e completed?
e Explain your answer.
a u s
lp doestothe last row, in the Trace tree, containing the
hiwhat
b) In this case,
u ( s
ManualApproval n e Workflow Component indicate?
sHuman
z lic e
aQ yez
i l p Answers to Step 5.
sh a. No the process is still running. If you look in the Trace tree you can see the State
for the rows containing EnrichPO, ApproveCCOrder, and ManualApproval is
Running in the State column.
b. The ManualApproval row indicates that the process is executing the Human
WorkFlow component, which is not yet complete because it is still in the Running
state.
6) To examine the ManualApproval component state, perform the following steps:
a) In the Web browser window with the Trace Flow page, click the ManualApproval
Human Task Component link.
b) On the “Instance Detail of ManualApproval” page, view the information and
answer the following questions:
i) What is the state of the human workflow task?
ii) Who is the task assignee?

Oracle SOA Suite 11g: Build Composite Applications 79


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
Q Answers to Step 6 b).
i. The task is in the ASSIGNED state. The following image shows the Instance Detail
Of ManualApproval:

b le
fer a
ans
n - t r
a no
) has ideฺ
ii. The assignee is jcooper (refer to the image inฺc om i.)t Gu
answer
h o o e nclick the Flow Trace
c) On the “Instance Detail of ManualApproval” d
yapage, asSshown
page,
tu in answer 6 b) i.
breadcrumb link at the top of@
zu thi
the s
y e z e
a u s
7) In the Web browser
h i lp window
t o with the Trace Flow page, to determine why the
(s nis sstill
ApproveCCOrder
u e running, click the ApproveCCOrder BPEL Component link.
8) On
z e
lic of ApproveCCOrder” page, click the Flow tab to view the process
ezthe “Instance
y
sh ilpa flow and answer the following questions:
a) What is the name of the last activity executed in the Flow tab?
b) Explain what the last activity execute state represents at this time?

Note: Do not close the “Instance of ApproveCCOrder” Flow tab page.


Q Answers for Step 8.
a. The name of the last activity executed is called
receiveCompletedTask_ManualApproval_1

Oracle SOA Suite 11g: Build Composite Applications 80


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
Q Answers for Step 8.
b. The receiveCompletedTask_ManualApproval_1 is in a pending state. If you click
the activity icon to display and examine Activity Details it provides the meaning of
the pending state. For example:

b le
fer a
ans
n - t r
no
The activity is waiting for asynchronous callback message from the human
a
has ideฺ
workflow task that indicates it has been completed. The implications are that the
human workflow process is not complete. )
ฺ c om t Gu
h o oassigneeejcooper,
n on your desktop, open
9) To view the email message sent to the task d
ya bySdouble-clicking
tu
the Thunderbird Email client application
@ the Mozilla Thunderbird
u i s
desktop icon and performing
y e zz the following
e th steps:
a) In the Default
i l p a window,
Client
t o us click OK.
u (sh nse
e z z lice
y
sh ilpa

b) In the Mozilla Thunderbird window, in the All Folders pane, click the
jcooper@soa11g.example.com account name

Oracle SOA Suite 11g: Build Composite Applications 81


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
c) To read the email messages, click “Read messages” in the part of the window
with the title “Thunderbird Mail – jcooper@soa11g.example.com”.

d) In the “Enter your password:” window, enter the password welcome1 and click
OK. e
a b l
e) In the Inbox, verify the presences of an email message and click the entry to seeer
the message body. n s f
n - tra
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

10) To open the Worklist application and login as jcooper to make changes to the
shipping method and approve the order, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 82


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
a) In the Thunderbird window, in the mail message body click the Worklist
Application link in the first paragraph of text.

Note: Alternatively, to access the Worklist application in aWeb browser window


enter the URL http://localhost:8001/integration/worklistapp.
b) On the Oracle BPM Worklist application page, enter jcooper in the Username
b le
and welcome1 for the Password, and click Login.
fer a
ans
c) On the Worklist home page, the Inbox is selected and task with the title “Manual
n - t r
Approval” should be present in the top-right pane on the page. Click the “Manual
a no
Approval” task entry to display the order details in the lower-right pane.

) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: If an ADF Task Form was not generated for the Human Task, then the
order details would not be visible in the Worklist application. The absence of an
associated task form means that you would only see the task row in the list
without any details in the lower-right pane.

Oracle SOA Suite 11g: Build Composite Applications 83


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
d) In this case, before we approve the order, in the Contents section of the task
details jcooper notices that the Ship Method is the two_day value. As jcooper
change the Ship Method to next_day (which causes a different shipping
company to be selected by the Fulfillment BPEL Process), and click the Actions >
Save menu option.
Note: You must save changes to editable items in the payload details before you
click the Approve or Reject action buttons, otherwise the changes made are not
returned to the BPEL process initiating the Human Task.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
e) On the Worklist home page, in y a Stu
the lower-rightdpane containing the task details,

z z
select Actions > Approve.
u@youthcanisselect the task in the top-right pane, and
click Approve. Alternatively,

a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: The Worklist application page is refreshed with assigned task removed
from the Inbox, because it has been completed.
11) Return to the Web browser page containing the “Instance of ApproveCCOrder” Flow
Trace page, and click the Refresh icon in the top-right corner of the page.

Oracle SOA Suite 11g: Build Composite Applications 84


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
12) On the “Instance of ApproveCCOrder” Flow Trace page, perform the following steps:
a) Return to the ManualApproval_1 scope and activities, and verify that the process
has continued executing beyond the receiveCompletedTask_ManualApproval_1
activity where you identified the process was waiting for an asynchronous
callback from the human workflow service.
b) Locate and click the Assign_manualapprove activity to view its Activity Details
page. Examine the changes to the outputVariable and confirm that the shipMethod
element contains the new value of “next_day” as modified in the Worklist
application task details, and that the status element has the “approved” value set
by the copy operation in the Assign_manualapprove activity. Use the following
image as a guide:
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
c) Click the Audit trail tab at the top of the page.

Oracle SOA Suite 11g: Build Composite Applications 85


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
d) On the Audit Trail page, scroll down and expand the <payload> for the
InvokeNotificationService activity, which is contained in the Email_customer
scope, and confirm that the “To” element contains the email address
sking@soa11g.example.com. Verify that the order status “completed” is reflected
in the Subject element. Use the following image as a guide:

b le
fer a
ans
n - t r
n o
a
13) To find out the which shipping company was selected by thesFulfillment BPEL
ha perform
Process, due to the manual change in the Ship Method) value,
i d e ฺ the following
steps:
ฺ c om t Gu
a) On the “Instance of ApproveCCOrder” h o opage, click
e nthe Flow Trace breadcrumb
link at the top of the page. ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye the Flow
b) On li Trace page, click the Fulfillment link.
ilp a
sh

c) On the “Instance of Fulfillment” Audit Trail page, scroll to the last activity on the
page, that is the callbackClient activity, and expand the <payload> part and
confirm that the carrier selected for shipment is FedEx. Use this image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 86


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
d) Note: If you return to the Flow Trace page, and look for the JMS Adapter
reference entry, you can also determine which JMS Adapter was used to ship the
order. In this case, it is the FedExJmsAdapter.
14) Finally, return to the Thunderbird application window, and read the email for the
sking@soa11g.example.com account by performing the following steps:
a) In the All Folders section, click the sking@soa11g.example.com account name.

b le
fer a
a n s
-t
b) On the pane with the title “Thunderbird Mail - sking@soa11g.example.com”
n r click
the “Read messages” link. n o
s a
) a
h ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilpyourse
c) In the “Enter to window, enter welcome1 and click OK.
password:”
d) Inzthe
z n
u Inboxcemessages, click the message header with subject “Your order status:
l i
ye completed” to display the message body in the bottom window pane. Use the
i l p a following image as a guide:
sh

15) Close any Web browser windows, with Flow Trace or Audit Trail pages still visible.

Oracle SOA Suite 11g: Build Composite Applications 87


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 12-4: Deploy and Test the POProcessing and Human
Task Form Projects (continued)
Test Human Task and Email Notification with a Reject Action
16) Create another test using the same order as previously used (from
D:\labs\files\xml_in\po-large-guitar.xml). You can simply click
on the Request tab in the Oracle Enterprise Manager page containing the Response
tab page for the previous test, and click Test Web Service.
Note: When you click the Request tab, the previous Input Argument information is
retained and can be resubmitted.
17) Optionally, use the email client to verify the task has been assigned to jcooper again,
and using the Worklist application, click the REJECT option without changing any of
the order data.
18) On the Flow Trace pages monitor the process until it completes, verify that the e
Fulfillment BPEL process is not executed because the order was rejected during a b l
execution of the ManualApproval Human Task. fer
n s
19) In the Thunderbird application window, by using the sking@soa11g.example.com -t r a
email account, verify that an email is received indicating that the order o n
n was rejected.
a
Optionally, Test Email Notification without Manual ) has Approval
i d e ฺ
20) Optionally, if you have time perform one more ฺ c omusingt the
test G upo-small-
h o oorder wase nprocessed completely.
guitar.xml input file, and verify that
ya Stu the d
z @ is a customer whose email account has not
uorder tishfor
Note: The customer Id forzthis
been created in the a y e s e Therefore, if you wish to see the email
u
Thunderbird client.
( s hilptosThunderbird
message delivered e to for this test you can take one of two steps:
a) z z u a client
Create c e naccount for the user achrist@soa11g.example.com, and copy the
l i
ye email server settings from one of the other accounts, such as jcooper or
il p a sking. Do not use the Global Inbox and use a password of welcome1.
sh
b) Before you click the Test Web Service button to send the order for processing,
change the <custID> element value to 1 (the customer ID for sking) in the
Input Arguments XML View data. If you select this option, for consistency with
the database data, change the following two elements as shown here:

<ns0:ccType>AMEX</ns0:ccType>
<ns0:ccNumber>5678-5678-5678-5678</ns0:ccNumber>
21) On the Flow Trace page for the composite instance created for this test, you can
perform the following simple checks:
a) Ensure that the ManualApproval Human Workflow Component does not appear
in the Trace tree, because order total is less than 5000.
b) Verify that Fulfillment was executed to ensure that the order was shipped, and
confirm that the UPSJmsService was executed.

Oracle SOA Suite 11g: Build Composite Applications 88


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 13
The goal of this practice is to create Business Rules components containing rules exposed
as operations through decision services that are invoked by BPEL processes in the
POProcessing composite application. The following two Business Rules and their
associated decision services are created:
• The ApprovalRules component to determine if manual approval is required for
orders over a specified limit. The rules are implemented as IF-THEN constructs in
a Ruleset.
• ShippingRules to select a shipping company (carrier) to deliver a shipping request
for an order based on the shipping method chosen by the customer and quantity of
items to be delivered. The rules are implemented in a Decision Table construct.
The following image shows the changes to the POProcessing assembly model:
b le
fer a
an s
n - t r
a no
) has ideฺ
c m Gu
oRule
The decision service for the ApprovalRules Business
o ฺ
oBusinessenRule t
component is invoked from
the ApproveCCOrder BPEL Process by using
y a h a
t u d activity, which requires
that you change the way the Switch_checkapproval
u@ tthe S conditional expression checks if
isorder
approval is required. Instead zofzchecking h total, the <case Approval Requires>
y e
needs to be modified toacheck theu e
s returned by the Business Rule. The following
result
i
h se
image illustrates the l p
process t o
flow change for the ApproveCCOrder BPEL Process:
(
u cens
z z li
a ye
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 89


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
The decision service for the ShippingRules Business Rule component is invoked from the
Fulfillment BPEL Process by using a Business Rule activity, which also requires that you
change the way the Switch_shiporder conditional expressions checks which shipping
company is selected and returned by the Business Rule. The following image illustrates
the process flow change to the Fulfillment BPEL Process:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 90


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model
In this practice, you create two Business Rules component in the assembly model of the
POProcessing composite application, and wire the Business Rule components to the
BPEL Processes that invokes their respective decision services.

Note: When you create a Business Rule component you specify its name and can define
the name of the decision service it creates. The decision service provides its operations
through the rulesets or decision tables that you create in the Business Rule component
dictionary. In this section, you create the components, the decision service, and the
dictionary. However, you configure the dictionary contents for the ApprovalRules in
Practice 13-2 and for ShippingRules in Practice 13-4.

To complete these tasks, perform the following steps: b le


fer a
s
ran
Create and Wire the ApprovalRules Business Rules Component
n -t
o
In this section you create the ApprovalRules Business Rule component, and configure the
n
a
decision service interface by defining the service name and specifying the input and
has ideฺ
output fact structures from the orderapproval.xsd, which is imported into the
)
ฺ c om t Gu
project. The ApprovalRules Business Rule component is wired to the ApproveCCOrder
BPEL component.
h o o e n
1) In the JDeveloper window, ensure the yaPOApplication d
tu name is selected in the
@ s S
Application Menu pull-down
e z zumenu, and
thithat the POProcessing project and its SOA
y
Content folder are expanded.
a us e
i
h se
2) To add a Business l pRules t o
component to the POProcessing assembly model perform
( s
u steps:
the following n
e z z l i c e
i lpa ya) Double-click the composite.xml file to open it in the Composite Editor
window (if required).
s h
b) In the composite.xml window, drag a Business Rules component from the
Component Palette into the Components column.

Oracle SOA Suite 11g: Build Composite Applications 91


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
3) In the Create Business Rules window, to configure the component name and the input
XML fact element for the Business Rules Component, use instructions in the
following table (and associated screenshots as a guide):
Step Screen/Page Description Choices or Values
a. Create Business Rules > General Name: ApprovalRules
Note: The Create Dictionary option is selected.
Accept default settings for all other fields.
To define the input fact XML structure, on the
top-right side of the Inputs/Outputs table, click
Create ( ) > Input.
b. Type Chooser
Click the Import Schema File icon ( ). e
c. Import Schema File a b l
Click the Browse Resources icon ( ).
sfer
d. SOA Resource Browser
- t r an
Using the File System, browse for and locate
the D:\labs\files\xsd folder, select the
no
orderapproval.xsd and click OK.
n
a
e.
f.
Import Schema File
Localize Files
Click OK.
) has ideฺ
Copy Options: Deselect the “Maintain original
c om t Gu
directory structure for imported files” option,

h o o e
and click OK. n
g. Type Chooser ya Stu d
Expand the orderapproval.xsd entry,
z @
u this select the price element, and click OK.
y e z e
a) a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 92


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
b)

c) b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
d) @
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 93


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
e)

f)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
g) z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 94


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
4) In the Create Business Rules window, to define the XML fact output (result) element
perform the following steps:

a) In the top-right side Inputs/Outputs table, click Create ( ) > Output.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
b) Inzthe
z e n window, in the expanded orderapproval.xsd entry,
u TypecChooser
l i
ye select the approvalandiscount element, and click OK.
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 95


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
5) In the Create Business Rules window, to define the name for the decision service,
click the Advanced tab, and in Service Name enter (the case-specific name)
ApprovalRulesService, and click OK.

b le
fer a
an s
n - t r
6) Save the changes to the composite.xml file.
a no
7) Answer the following question: For the Business Rules h
) as eฺjust added, what
Component

c o m Guid
files have been created in the POProcessing project?
o
Answer: There are four files that have been
ฺ to the
oadded n t project. The files are:
h e
ud (in the POProcessing project)
a) Expand the Business Rules @ ya Stfolder
> poprocessing
z u this file. This is the rules dictionary for
and you see the ApprovalRules.rules
z
a
the Business Rule y e
component.s e
u
s hilp se to
b) The ApprovalRules.componentType
( is created to represent the component in the
z u e n
z licapplication
composite and references the Business Rules WSDL interface.
y e
sh ilpa c) The ApprovalRules.decs file contains the decision service information,
such as the location of the .rules file and the rules function exposed by the
service.
d) The ApprovalRulesService.wsdl is file containing the decision service
interface.
Use the following image as a guide for the four files found in the Application
Navigator:

Oracle SOA Suite 11g: Build Composite Applications 96


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
8) To wire the ApproveRules Business Rule component to the ApproveCCOrder BPEL
component, on the composite.xml drag a wire from the ApproveCCOrder BPEL
component to the new ApproveRules Business Rules component. Use the following
image as a guide to the result:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
Note: Creating the wire
y z
ecreates sa Partner
e Link for the decision service in the
a u
( s hilp se to
ApproveCCOrder BPEL Process.

z z uchanges
9) Save the
c e nthe POProcessing composite application project.
to
ye and Wire li
ilp aCreate the ShippingRules Business Rules Component
sh In this section you create the ShippingRules Business Rule component, and configure the
decision service interface by defining the service name and specifying the input and
output fact structures from the ordershipment.xsd, which is imported into the
project. The ShippingRules Business Rule component is wired to the Fulfillment BPEL
component.
10) In the composite.xml window, drag another Business Rules component from the
Component Palette into the Components column.
11) In the Create Business Rules window, in the General tab page, use the following table
for the configuration settings (and accept default settings for unspecified fields):
Step Field Name Value
a. Name ShippingRules
b. Input shippinginfo
Note: The shippinginfo element is selected from the
ordershipment.xsd, which must be imported
into the project when you select the Input element.

Oracle SOA Suite 11g: Build Composite Applications 97


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
Step Field Name Value
c. Output shippingcompany
Note: This element is also defined in the
ordershipment.xsd, which is imported when
selecting the Input element.
Note: Do not click OK. Click the Advanced tab to set the service name first.

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 98


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-1: Add Business Rule Components to the Assembly
Model (continued)
12) On the Create Business Rules Advanced tab page, in Service Name enter
ShippingRulesService, and click OK.

b le
fer a
a n s
-t r
13) In the POProcessing composite.xml window, drag a wire from the Fulfillment
n
n o
BPEL process and connect it to the new ShippingRules Business Rules component.
a
has ideฺ
Use the following image as a guide to the result:
)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

14) Save all the changes to the POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 99


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
In this practice, you edit the ApprovalRules Business Rule component to open the
dictionary file and create definitions for a global variable, a ruleset, and two rules for the
decisions service.

To complete these tasks, perform the following steps:


1) In the JDeveloper window, open the POProcessing composite.xml application
file (if required, because it may already be open).
2) In the composite.xml window, to edit the ApprovalRules Business Rule
Component rules dictionary, right-click the ApprovalRules component icon, and click
Edit.
Note: Alternatively, double-click the ApprovalRules component icon or double-click
the ApprovalRules.rules file in the Application Navigator window. b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
Create a Global to Hold the Approval
h o oLimit en
In this section you create a Global value y d limit value, which is used in
ato holdSthetuapproval
z u@ tsteps
the rule conditions created in subsequent
z h is of this practice.
a y e s ewindow (in the Rules Editor), create and Initialize
3) In the ApprovalRules.rules u
s hilpfor stheeapproval
a Global defined
( to limit as a value of 4000. Use instructions in the
z u tablecand
following
z e nassociated screenshots:
l i
yeScreen/Page Description
il p a
Step Choices or Values
sh a.
b.
ApprovalRules.rules
Edit Global – Global_1
Click the Globals tab, and click the Create icon.
Name: approval_limit
Type: double
Value: Click the Expression Builder icon ( )
c. Expression Builder Expression: 4000
Click OK
d. Edit Global – Global_1 Select the Constant option, and ensure the
Final option is selected.
Click OK
e. ApprovalRules.rules > Verify the addition of the approval_limit entry.
Globals

Oracle SOA Suite 11g: Build Composite Applications 100


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
a)

b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
c)
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 101


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
d)

b le
fer a
ans
n - t r
e)
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
Rename the Default
( s hilp seRulesetto
z z u youcrename
In this section e n the default initial ruleset already created in the dictionary,
ye
before you createl ithe rules in the ruleset.
a
ilp4) To rename the Ruleset_1 ruleset, perform the following steps:
sh
a) Click the Ruleset_1 name under the Rulesets section, and click the Ruleset_1
name in the heading section:

Oracle SOA Suite 11g: Build Composite Applications 102


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
b) In the pop-up field enter the text: approvalruleset, and press Enter.

Create the “abovelimit” Rule in “approvalruleset” Ruleset


In this section you create the first rule called abovelimit, in the approvalruleset, which
checks if the total price is greater than the approval limit and sets the required approval
Boolean result to true. Creating a rule request creates a test (or condition) and an action to
determine the results or function behavior.
Note: The structure that contains the result is called approvalandiscount, which contains
a discount element. The discount element is not used in this course application. b le
fer a
5) To create a new rule called abovelimit, perform the following steps:
a n s
a) In the ApprovalRules.rules window, in the approvalrulesetn
r
-t click
heading
the Create icon and select Create Rule. n o
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
b) In the ApprovalRules.rules window, click in the new rule named
Rule_1, and rename it to abovelimit.
Note: Remember to press Enter after typing the new name.

Oracle SOA Suite 11g: Build Composite Applications 103


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
6) To create the test (or condition) in the IF section of the abovelimit rule, perform the
following steps:
a) Click the <insert test> entry.

b le
Note: This creates a conditional structure with two operands with an operator
fer a
between them. For example: <operand> == <operand>. In addition,
ans
- t r
another <insert test> below it. Each part needs to be clicked to specify its
n
value.
a no
b) To set the left-side <operand>, click the <operand>
) hastextidand
e ฺ select
price.totalPrice from the pull-down o
c m Gu
menu.
o o ฺ n t
h
a Stud e
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh
c) To set the operator, click the “==” text and select the greater than (>) sign from
the pull-down menu.

Oracle SOA Suite 11g: Build Composite Applications 104


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
d) To set the right-side <operand>, click the <operand> text and select
approval_limit from the pull-down menu.

b le
fer a
ans
n - t r
a no
Note: The approval_limit is the Global you created and set to the value 4000.
has idsteps:
7) To create the action in the THEN section, perform the)following e ฺ
a) Click the <insert action> text, and ฺselectc omassert
t G unew from the pull-
h o o e n
down menu.
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Note: The assert new action creates a new fact object that needs to be defined
and initialized to hold the desired values. In addition, another <insert
action> is added below the one being created. This allows you to create
multiple actions for a rule. In this case, you create one action.

Oracle SOA Suite 11g: Build Composite Applications 105


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
b) To set the object created by the assert new action, click the <target> text
and select approvalandiscount option from the pull-down menu.

b le
fer a
ans
n - t r
a no
Note: The approvalandiscount structure, as defined in the XSD imported to define
the output result structure for the Business Rule decision service, has child
has ideฺ
elements called properties. You need to set their values for the present condition.
)
ฺ c om
c) To set the approvalandiscount property values, G
click the
t
u property>
<add
text:
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
d) In the Properties window, set the Value column for each of the properties. In this
case, set the approvalRequired property value to true (which can be selected
from the pull-down menu in the Value column). Enter the value 0 (zero) in the
discount Value column, and click Close.

Oracle SOA Suite 11g: Build Composite Applications 106


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
e) Verify that your abovelimit rule contains the condition and action configured in
the previous sub-steps, and save the changes to the ApprovalRules.rules
file.

b le
fer a
ans
n - t r
no
Create the “withinlimit” Rule in “approvalruleset” Ruleset
a
a s
In this section you create a withinlimit rule that tests the condition where the total price is
h ideฺ
)
less than or equal to the approval limit, in which case the approvalRequired property
should be set to a value of false. ฺ c om t Gu
h o o e n
ya Stu
8) To create the new rule, perform the following d
steps:
a) In the ApproveRules.rules
z @
u twindow,
h is in the approvalruleset heading section
y
click the Create icon z
eand click eCreate Rule.
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 107


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
b) Click the new rule name and rename it to withinlimit, and configure the test
(condition) where the conditional expression is expressed as:

price.totalPrice <= approval_limit

c) In the THEN section, click the <insert action> select the assert new
b le
approvalandiscount object (as you did for the abovelimit rule) and set the
fer a
properties so that approvalRequired is false, and discount is 0 (zero).
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 108


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
d) Verify that your withinlimit rule matches the definition in the following image:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a Sclick
ywindow, d
tu the Validate icon in the toolbar to
9) In the ApprovalRules.rules @
ensure that the rule dictionary s
zucontainsthvalid
i definitions.
y e z e
i l p a
t o us
u (sh nse
e z z lice
y
sh ilpa
10) To verify the Ruleset which is exposed by the decision service, click the Decision
Functions tab, select the ApprovalRulesService and click the Edit icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 109


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-2: Define the ApprovalRules Business Rules
(continued)
11) In the Edit Decision Function window, look in the Rulesets & Decision Function
section and ensure that the approvalruleset is in the Selected area.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
12) Select File > Save All to save the changes to the POApplication workspace.
sh

Oracle SOA Suite 11g: Build Composite Applications 110


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process
In this practice, you modify the ApproveCCOrder BPEL Process to invoke the
ApprovalRulesService and use its result to determine if the Human Task activity is
executed.
1) In the JDeveloper window, open the ApproveCCOrder.bpel Process file, if it is
not already opened, by right-clicking the ApproveCCOrder BPEL component icon
and selecting Edit, or double-click its file name in the Application Navigator window.

b le
fer a
an s
n - t r
a no
) has ideฺ
2) In the ApproveCCOrder.bpel Diagramowindow, ฺ com ndrag
t Ga uBusiness Rule
a h o e branch of the
d<case>
component from the Component Palette
y u
insidetthe
S
Switch_ccvalid activity before
z u@Switch_checkapproval
the
h i s activity. Use the following
image as a guide.
a y ez se t
i lp t o u
h
(s nse
z z u c e
y e l i
sh ilpa

Note: This opens the Business Rule settings window.

Oracle SOA Suite 11g: Build Composite Applications 111


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
3) In the Business Rule settings window, set Name to
BusinessRule_approvalrule. For the Dictionary select ApprovalRules from
the pull-down menu.

b le
fer a
ans
n - t r
a no
Note: After selecting the Dictionary value, the Service ) is
asto eฺ
hset
o m u id and reset the
ApprovalRulesService, and the Operation is setcto “Execute
ฺ Assign
oand n G function
tOutput Facts tab sections
h o
session.” In addition, the Assign Input Facts
aBusiness e
d decision service and receive the
y
enable you set the input values for the
S t uRule
result values, respectively. zu@ is
z t
eto be evaluatedh
e by the ApproveRulesService, perform the
4) To assign the input a y
data u s
( s hilp se to
following steps:

z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 112


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
a) Just below the Assign Input Facts tab, click the Create icon.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
yaassignSthe d
tuorderTotal from the order in the
b) In the Decision Fact Mapu @
window, s
z z element
inputVariable to theetotalPricee thi of the Business Rule Fact variable called
p a y us
org_example_ns_approvalrules_Price_i. Click OK.
h i l t o
u (s nse
e z z l i c e
a y
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 113


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
5) To obtain the results (output facts) from the ApprovalRulesService, perform the
following steps:
a) Click the Assign Output Facts tab and click the Create icon below it.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 114


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
b) In the Decision Fact Map window, in the “From” section expand the only
Business Rule Fact variable provided, and select the approvalRequired
element. In the “To” section, expand the Scope – Scope_validatecc, right-click the
Variables subfolder and click Create Variable to create a new local variable. Use
the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y
c) In the Create Variablez
e window, eenter approvalRequired for Name, select the
a u s
Simple Typeilp tothe boolean type by clicking the Browse Simple Types
option and
( s h e
z z u cens image as a guide:
icon. Use the following
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 115


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
d) In the Decision Fact Map window, ensure that the new approvalRequired Boolean
variable in “To” section is selected and click OK.

b le
fer a
ans
n - t r
a no
hasconfigured
e) In the Business Rule setting window, with all parts) now i d e ฺ click OK.
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 116


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
6) In the ApproveCCOrder.bpel Design window, verify that the
BusinessRule_approvalrule appears before the Switch_checkapproval activity. Use
the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
7) Since the results of the business rule a
oo dvariable
arehin a new e n
called
y S t u
approvalRequired, you need
z u @ his
to modify the <case> branch condition in the
Switch_checkapproval e z Toechange
activity. t the <case> branch condition, perform the
following steps: pay u s
h i l t o
a) Expand(s se
the Switch_checkapproval activity.
z u e n
y ez lic
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 117


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-3: Implement ApprovalRules in the ApproveCCOrder
BPEL Process (continued)
b) Double-click the “<case Approval Required>” heading to open the Switch Case
settings window.

b le
fer a
s
c) On the Switch Case settings, delete the existing condition and replace it with the
an
following condition:
n - t r
a no
has ideฺ
string(bpws:getVariableData('approvalRequired')) = 'true'
)
ฺ com
The condition compares the string value of the
being equal to the string literal 'true'o(including
n t
u
approvalRequired
G
single
variable as
quotes). Use the
following image as a guide: h o
a Stud e
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: You have effectively altered the BPEL process to use Business Rules to
evaluate if an order requires approval. If the approval limit needs to be changed
the BPEL process no longer needs to be modified, only the approval_limit in the
rule dictionary needs to be changed.
8) Save the changes to the ApproveCCOrder BPEL Process.

Oracle SOA Suite 11g: Build Composite Applications 118


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
In this practice, you edit the ShippingRules Business Rule component and create the
dictionary definitions, such as the decision table with its rules needed for the decisions
service functionality.

To complete these tasks, perform the following steps:


1) Open the POProcessing composite.xml file, if it is not already open.
2) In the composite.xml window, right-click the Shipping Rules component and
select Edit.

b le
fer a
an s
n - t r
no
3) In the ShippingRules.rules window, rename the default ruleset to
a
has ideฺ
shippingruleset.
)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Create a Decision Table


4) In the ShippingRules.rules window, with the shippingruleset selected, click
the Create icon and click Create Decision Table.

Oracle SOA Suite 11g: Build Composite Applications 119


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
5) In the ShippingRules.rules window, rename the DecisionTable_1 rule name
to carrierrule.

Note: The following image shows the result after renaming the decision table.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z eTable
Create Rules in the a Decision
u s
In this section, s
lp three
hidefine
you torules in the decision table. The rules are created after you
(
u ceOnce
define thezcondition.
e
ns a rule comparison value is set for the condition, you can
z
ye the action.li
specify
a
ilp6) To create the decision table condition, perform the following steps:
sh
a) In the decision table Conditions, double-click the <insert condition> text.

Oracle SOA Suite 11g: Build Composite Applications 120


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
b) In the conditions pull-down menu, expand shippinginfo and click shipChoice.

b le
fer a
an s
n - t r
a no
) has ideฺ
Note: Adding and setting the condition creates
ฺ c om t G u template in the
the first rule
column titled R1.
h o o e n
a carrier
7) To set the comparison value for theyUPS
d
tuin the Rule for R1, perform the
@ s S
following steps:
e z zu thi
a) In the R1 column a y
and the u
C1s e
condition row, click the cell and select the
i l p t o
TWO_DAY
u (shoption n sfrom
e the pull-down menu.
e z z lice
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 121


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
Note: The value TWO_DAY is added to the selected cell. Have you considered
where the list of values for the shipChoice element has come from? If you are
curious, take a look at the Bucketsets definitions in the
shippingRules.rules dictionary. For example:

b le
fer a
ans
n - t r
offer any insight? a no
Ask yourself, how did those Bucketsets definitions get created? Do their names

) has ideฺ
Apart from the fact that these Bucketsets have
ฺ c om t G u type definition (refer
an XML Fact

h o o
to the Facts section in the ShippingRules.rules
e n definition), these XML
a Sintuthedordershipment.xsd, that
Facts were derived from XML elements,
y
z
Business Rules component.z u@andtOutput
were used to define the Input
h is variables for the ShippingRules
a y e s e
u
s hilp theseordershipment.xsd
If you (examine to file you can find the definitions for
u n
e with the associated enumerations. For example: here is
z typeslicshown
these
z
y e shipOptionType definition in the XSD:
i l p a
sh

If you are curious, consider editing the corresponding ShipOptionType Bucketset


to view how its definition resembles the XSD element definition.

Oracle SOA Suite 11g: Build Composite Applications 122


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
b) To create the action for the rule and set the action values, in the first column
under the Actions section, click the <insert action> text and select
Assert New.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
ya shippingcompany
tu
c) In the Action Editor window,
u@ select the
i s S entry in the Facts
z
z for the
section. In the Properties,
e h
tcarrier property select Parameterized. At
the bottom oflp a y s e
the window,uselect Always Selected and click OK.
( s h i e to
z z u cens
ye li
i l p a
sh

Note: The Value field is constructed from the selections you make. The Always
Selected option ensures the action is always selected for each rule.

Oracle SOA Suite 11g: Build Composite Applications 123


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
d) In the A1 row created for the assert new shippingcompany action, click
the cell under the R1 column and select the CarrierType.UPS value.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y
8) To create the second rule
z
e in the sdecision
e table for the USPS carrier, perform the
following steps:ilp
a u
( s h se to
u toolbar
a) Inzthe eatnthe top of the decision table, click the Create icon and select
ye z
Rule. l i c
il p a
sh

Oracle SOA Suite 11g: Build Composite Applications 124


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
b) To set the condition in the R2 column, click the cell in the C1 row and select the
FIVE_DAY option.

b le
fer a
ans
n - t r
a no
s ฺ
hacell
m )
c) In the A1 row for the R2 column, click the intersecting
iand
d eselect the
CarrierType.USPS option from the pull-down
ฺ co nmenu. G u
o o t
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 125


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
9) To create the third in the decision table for the FedEx carrier, perform the following
steps:
a) In the toolbar at the top of the decision table, click the Create icon and select
Rule.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
othe R3erule
b) To set the condition comparison valueoin
h n column, click the cell in the
y a Stu
C1 row, and select both the NEXT_DAY and d
INTERNATIONAL options.

z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 126


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-4: Define the ShippingRules Decision Table
(continued)
c) To set the action values, click the A1 and R3 cell and select
CarrierType.FED_EX from the pull-down menu.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
ya withSthetuimage shown here.
z @
10) Verify your decision table is consistent
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

11) Save the changes and close the ShippingRules.rules window.

Oracle SOA Suite 11g: Build Composite Applications 127


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process
In this practice, you modify the Fulfillment BPEL process implementation for
determining the carrier to be selected for the shipping request by using the ShippingRules
Business Rule component decision service.

To complete this task, perform the following steps:


1) In the composite.xml window, right-click the Fulfillment BPEL Process
component icon and select Edit to open the Fulfillment.bpel file in the BPEL
Editor window.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 128


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
2) In the Fulfillment.bpel Design window, drag a Business Rule component
between the Assign_shipaddress and Switch_shiporder activities, which are found in
the Scope_shiporder within the Switch_orderstatus activity. Use the following image
as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 129


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
3) In the Business Rule settings window, ensure the fields are set to the following
values:
Name: Business_shippingrule
Dictionary: ShippingRules
Service: ShippingRulesService
Operation: Execute function and reset the session

Use the following image as a guide, and click the Create icon in the Assign Input
Facts tab.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh 4) For the Assign Input Facts, on the Decision Fact Map window, copy the string value
of the shipMethod from the inputVariable to the shipChoice in the
org_example_ns_shippingrules_Shippinginfo_i variable.

Oracle SOA Suite 11g: Build Composite Applications 130


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
Note: Wrapping the shipMethod element in the string function as shown in the
following expression, is not really required. However, if you remove the string
function you would get a compiler warning about incompatible types for the specified
Assign Input Facts settings.

string(bpws:getVariableData('inputVariable','payload',
'/ns1:FulFillmentRequest/ns5:shipMethod'))

5) In the Business Rule settings window, click the Assign Output Facts tab and click the
Create icon.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 131


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
6) In the Decision Fact Map window, copy the carrier element value from the
org_example_ns_shippingrules_Shippingcompany_o variable to the carrier element
in the outputVariable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
asinput,eand
7) In the Business Rules window, having specified the settings,
) h ฺ output facts,
click OK to create the Business Rule.
om t Gu i d
o ฺ c n
h o d e
@ ya Stu
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 132


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
8) In the Fulfillment.bpel Design window, verify that the Business Rule appears
before the Switch_shiporder activity.

b le
fer a
ans
n - t r
a no
) has ideฺ
9) Like the ApproveCCOrder scenario, because ฺyou c m implemented
ohave G u a Business Rule
o t
oin eacheofnthe <case> branches of the
h
a Stud from the ShippingRules Business
you need to alter the conditional expressions
Switch_shiporder activity to use@ theyresults returned
Rule component, which returns
z z t h isinstead of the ship method. First expand
u the carrier
the Switch_shipordera y e
activity. s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

10) To change the condition for the UPS carrier, perform the following steps:
a) Double-click the <case UPS> heading to open the Switch Case settings.

Oracle SOA Suite 11g: Build Composite Applications 133


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
b) In the Switch Case settings window, replace the existing condition with the
following expression:

bpws:getVariableData('outputVariable','payload',
'/ns1:FulfillmentResponse/ns1:carrier') = 'UPS'

The expression compares the carrier element value in the outputVariable to the
literal case-sensitive string value 'UPS'. Use the following image as a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
h i lp
11) To change the condition for
t othe USPS carrier, perform the following steps:
(s thens<case
a) Double-click
u e USPS> heading to open the Switch Case settings.
ez z lic e
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 134


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
b) In the Switch Case settings window, replace the existing condition with the
following expression:

bpws:getVariableData('outputVariable','payload',
'/ns1:FulfillmentResponse/ns1:carrier') = 'USPS'

The expression compares the carrier element value in the outputVariable to the
literal case-sensitive string value 'USPS'. Use the following image as a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@ is perform the following steps:
u FedExthcarrier,
zthe
y z
12) To change the conditionefor e
a u s
( s hilpthe s<case
a) Double-click
e toFedEx> heading to open the Switch Case settings
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 135


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
b) In the Switch Case settings window, replace the existing condition with the
following expression:

bpws:getVariableData('outputVariable','payload',
'/ns1:FulfillmentResponse/ns1:carrier') = 'FedEx'

The expression compares the carrier element value in the outputVariable to the
literal case-sensitive string value 'FedEx'. Use the following image as a guide

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 136


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
13) In addition to the changes to the <case> branches, in their enclosed Assign activities
you no longer require a copy operation to set the carrier in the outputVariable. To
remove the associated copy operations perform the following steps:
a) In the <case UPS> branch, double-click the Assign_toUPS activity.
b) In the Assign window, select the third copy operation, with the Expression
'UPS' in the “From” section and click the Delete icon.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 137


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
c) In the <case USPS> branch, double-click the Assign_toUSPS activity.
d) In the Assign window, select the third copy operation, with the Expression
'USPS' in the “From” section and click the Delete icon.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@ is the Assign_toFedEx activity.
zu double-click
h
z
e) In the <case FedEx>ebranch,
e t
a y u s
( hinilpthe
f) In the Assign
s
window,to
s e
select the third copy operation, with the Expression
“From” section and click the Delete icon.
'FedEx'
z u e n
yez lic
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 138


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
14) Finally, there is no need to keep the <otherwise> branch in Switch_shiporder activity.
To delete the <otherwise> branch perform the following steps:
a) Right-click the <otherwise> branch and select Delete.

b le
fer a
ans
b) In the Confirm Delete dialog box, click Yes. n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 139


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-5: Implement ShippingRules in the Fulfillment BPEL
Process (continued)
15) In the Fulfillment.bpel Design window, verify that the Switch_shiporder
contains three <case> branches, one for each carrier. Use the following image as a
guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
16) Save the changes to the POProcessing project and POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 140


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
In this practice, you deploy the POProcessing composite application, which contains the
Business Rules implementations in the ApproveCCOrder and Fulfillment BPEL
Processes.

Deploy the POProcessing Composite Application


1) Deploy the modified POProcessing composite application, by right-clicking the
POProcessing project name and selecting Deploy > POProcessing > to soaserver.
Overwrite the existing version and ensure deployment is successful.
a) In the Deployment – Log window verify that deployment is successful.

Note: Since the process still has the Human Task component, you may ignore the
following compiler warnings, related to the Human Task configuration, when you b le
deploy the POProcessing composite application:
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a StBPEL
Note: You may also receive theyfollowing
d
u warning. This can also be safely
ignored. @
zu thi s
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
b) Select File > Save All to save changes to the POApplication application
workspace.

Test the Business Rule with the Human Task


In this section, you submit an order whose total is greater than 4000 to cause the
POProcessing application so that Business Rules returns a result that requires the Human
Task to be processed for manual approval of the order. As the employee jcooper, you
check your email to read the notification about the assigned task, and then login to the
Worklist application to approve order.
2) On the Oracle Enterprise Manager SOA home page, expand the SOA folder in the
Farm navigator, and click the “POProcessing [1.0]” link.
3) To perform a test and manually approve the order whose total is greater than 4000, on
the “POProcessing [1.0]” Test Web Service page under the Request tab Input
Arguments section, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 141


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
a) Replace the XML data with the contents of the file
D:\labs\files\xml_in\po-large-guitar.xml, and then click Test
Web Service.
b) On the Response tab, click the Launch Message Flow Trace link.
4) On the Flow Trace page, examine the Trace tree shown in the image provided and
answer the questions that follow the image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y z
eTrace image
e does not match those you see in your Web page,
Note: If the above a
Flow u s
then wait fors ilp teneseconds
habout to or more and click the Refresh icon at the top-right
(
u the Web
cornerzof s
npage.
z li c e
a ye
i l p Using the Flow Trace tree answer the following questions:
sh a) What was the input value to the ApprovalRules Decision Service component?
b) What was the result returned from the ApprovalRules component?

Q Answers to Step 4.
a. Click the ApproveRules Decision Service component link in the Flow Trace tree, and
you can see the input value provided for the totalPrice is 5200. For example:

Oracle SOA Suite 11g: Build Composite Applications 142


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
Q Answers to Step 4.
b. The result returned from the ApprovalRules is also shown in the “Instance Detail Of
ApprovalRules” audit information, which shows that the approvalRequired result is true.
This is consistent with that fact that the totalPrice is above the 4000 limit set in the
ApprovalRules dictionary.

Note: If the Flow Trace page does not display all rows listed in the image shown in step
4, then wait for about ten seconds or more and click the Refresh icon at the top-right
corner of the Web page.
5) Since the Manual approval is required, to approve the order in the Worklist
Application perform the following steps:
a) On a Web browser page, access the Oracle BPM Worklist application by entering b le
the URL http://localhost:8001/integration/worklistapp. fer a
ans
n - t r
b) On the Oracle BPM Worklist application page, enter jcooper in the Username
and welcome1 for the Password, and click Login.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
c) On li home page, the Inbox is selected and task with the title “Manual
ye the Worklist
i l p a Approval” should be present in the top-right pane on the page. Click the “Manual
sh Approval” task entry to display the order details in the lower-right pane.

Oracle SOA Suite 11g: Build Composite Applications 143


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
d) On the Worklist home page, in the lower-right pane containing the task details,
click Approve. Observe that the Ship Method value is two_day, this affects the
resulting shipping company used for the shipping request.

b le
fer a
ans
n - t r
a no
) has ideฺ
c o m Gu

o theeLogout
e) To Logout of the Worklist application, click
o n t link, and close the Web
page.
y h
a Stud
z z u@ this
a y e s e
u
( s hilp se to
6) On the
z z uWeb browser,
c e n return to the Flow Trace page, and click the refresh icon on the
l i
e corner of the page.
ytop-right
il p a
sh
7) On the Flow Trace page, scroll down the Trace tree and locate the ShippingRules
Decision Service Component and verify that the carrier selected is UPS. Perform the
following steps:

Oracle SOA Suite 11g: Build Composite Applications 144


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
a) Click the ShippingRules link.

b le
fer a
ans
n - t r
no
Note: Another indicator that the UPS carrier is selected is that the USPJmsService
a
has ideฺ
appears after the ShippingRules component in the Trace tree. You may have to
)
collapse the InternalStore and ExternalStore subtrees in the Flow Trace to see the
reset of the entries in the Trace tree.
ฺ c om t Gu
h o o page,everify
n that the shipChoice is
b) On the “Instance Detail Of ShippingRules” d
ya valueSreturned
tu is UPS.
two_day, and the resulting@ carrier
zu thi s
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

8) Optionally, open Thunderbird application window, and read the email sent to the
sking@soa11g.example.com account by performing the following steps:
a) In the “Enter your password:” window, enter welcome1 and click OK.
b) In the Inbox messages, click the message header with subject “Your order status:
completed” to display the message body in the bottom window pane. Close any
Web browser windows, with Flow Trace or Audit Trail pages still visible.

Test a Different Shipping Method without Human Task Processing


In this section, you submit an order that does not require manual approval.
9) To initiate another test with an order whose total price is less than 4000, thereby
avoiding the need for Human Task processing, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 145


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
10) On the Oracle Enterprise Manager page, in the “POProcessing [1.0]” Test Web
Services page, click the Request tab.

b le
fer a
ans
n - t r
a no
) h as eฺ
11) On the Oracle Enterprise Manager page, in the Request
o m replace u d XML View text
ithe
ฺ c
oelement n t
with the contents of the file D:\labs\files\xml_in\po-small- G
guitar.xml, and replace the shipChoicea h o d e
value with the lowercase text
value international. Then@ y t u
S Service.
click Test Web
z u h i s
a y ez se t
i lp t o u
h
(s nse
z z u c e
y e l i
sh ilpa

12) On the Response tab, click the Launch Message Flow Trace link.
13) On the Flow Trace page, to verify the process results perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 146


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
a) On the Trace tree, observe the absence of the ManualApprove Human Task
component, and click the ApproveRules link

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om tthat
b) On the “Instance Detail Of ApproveRules”, confirm G uthe totalPrice supplied as
input to the rule is less than 4000 ando
h o the approveRequired
that
e n is returned as the
value false. Click the Flow Trace ya Stu
breadcrumb d
link.
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
c) On the Flow Trace page, in the Trace tree scroll down and click the
ShippingRules link.

Oracle SOA Suite 11g: Build Composite Applications 147


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 13-6: Test the POProcessing with Business Rules
(continued)
d) On the “Instance Detail Of ShippingRules” page, confirm that the
international shipChoice was set and that the correct carrier of FedEx is
returned as the result.

14) Close the Flow Trace Web page. b le


fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 148


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 14
The goal of this practice is to create and execute a test suite containing one or more test
cases for a composite application.

Recall that you had modified CreditCardValidation process to include a BPEL process to
check if an order total exceeded the credit card limit. With that modification you
modified the original Mediator routing rule to the CreditCardDBService to process credit
cards that begin with the four digits ‘9000’. Since that modification that routing rule has
not been tested. The reason for that path not being tested is that the CREDITCARDS
database table, in the SOADEMO schema, does not have credit cards that begin with the
digits ‘9000’. However, with the use of test cases, you have the ability to emulate the
Database Adapter response to return a valid or invalid status for credit cards beginning
with ‘9000’ “as if” the credit card existed in the database. b le
fer a
With the above scenario in mind, in this practice you create a test suite for the
ans
CreditCardValidation composite process and the following three test cases: n - t r
no
• Test a credit card number starting with the digits 9000 and returning a VALID
a
status.
) has ideฺ
• Test a credit card number starting with the digits 9000 and returning an INVALID
status. ฺ c om t Gu
h o o e n
d
• Test a credit card that does not exist and check its response with a value-based
ya Stu
and an XML-based assertion.
@
z u this
The following image illustrates the first two of the above test case scenarios:
z
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: The first two test cases do not use assertions as shown in the image. Each test case
requires initiating an inbound message to provide data for starting the composite being
tested.

Oracle SOA Suite 11g: Build Composite Applications 149


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite
In this practice, your task is to create a test suite in the CreditCardValidation composite
application. When you create a test suite you also create its first test case. The test case
you create:
• Emulates a request containing a credit card number beginning with '9000' to
test the message flow path through the Mediator component to the
CreditCardDBService. This has not been tested since adding the CheckCCLimit
BPEL process.
• Emulates a VALID response being received as a reply from the
CreditCardDBService. The response is emulated because the CREDITCARDS
table in the database does not have any credit cards beginning with '9000'.
b le
To complete these tasks, perform the following steps:
fer a
1) In the JDeveloper window, ensure the POApplication name is selected in the an s
n -
Application Menu pull-down menu, and that the POProcessing project and its SOAt r
Content folder are expanded. a no
) h as eฺ
Create a Test Suite and its First Test Casem
o
File
u id
c
2) To create the test suite with it first test case,ouse n G
ฺ instructions
t in the following table
h o e
and associated screenshots as a guide:a
y S t ud
Step Screen/Page Description
z z u@Choices t h is or Values
a. y
Application Navigator
a e s eRight-click the testsuites folder under the SOA
u
ilp e to Content folder, and click Create Test Suite.
( s h
b.
z z u cens
Create Test Suite Name: testsuite_ccv
y e li Click OK.

ilpa
c. Create Composite Test Name: test_valid_9000
sh Optionally, enter a description for your test.
Click OK.
a)

Oracle SOA Suite 11g: Build Composite Applications 150


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite (continued)
b)

c)

b le
fer a
ans
n - t r
a no
) has ideฺ
Note: This action opens the test_valid_9000.xml
ฺ c om t Gufile in the test case
editor window, which resembles the composite
h o o assembly
e n model. The difference is
that the Exposed Services and External
y d
a Stu columns are a different color
References
to the real composite.xml
z z u@filethwhenis opened.
y e confirm
3) In the Application Navigator,
a s e that the testsuite_ccv folder has been added
ilp folder,
below the testsuites
u
toand that the test_valid_9000.xml file representing
( s h s e
the firstutest case isncontained in the test subfolder of the testsuite_ccv folder. Use the
z z
following li
image c e
as a guide:
a ye
sh ilp

Create the Components for the First Test Case


In this section, you create the initiating message and wire action to emulate a scenario
where you validate a credit card beginning with '9000'. This effectively creates a test
case for the Mediator component routing rule that sends data directly to the
CreditCardDBService.

Oracle SOA Suite 11g: Build Composite Applications 151


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite (continued)
4) To create the initiating message for the test_valid_9000 test case, perform the
following steps:
a) In the test_valid_9000.xml window, right-click the
ValidateCreditCard_ep (Exposed Services) icon and select Create Initiate
Messages.

b le
b) In the Initiate Message window, manually generate and modify the initiating
fer a
message contents by performing the following steps:
a n s
n
i) Observe that the Part can only be set to request as its selectedovalue.
r
-t With the
Enter Manually option selected, click Generate Sample.a n
ii) In the Enter Value section, replace the generated) as inside
hvalue e ฺ the
<CCNumber> element with 9000-1234-1234-1234, i d
om t Gu and replace the
ฺ c
o with n200.
h o
generated value in the <amount> element
d e
iii) Click OK. @ ya Stu
z z u a guidethtoisthe end result for the above steps:
a y e
Use the following image as
s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 152


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite (continued)
c) In the test_valid_9000.xml window, you can verify that the initiate
message created has been added by the presence of the blue circle containing a
darker blue arrow as an icon on the entry point. Use the following image as a
guide:

5) To create the emulated output of VALID from the CreditCardDBService for the e
test_valid_9000 test case, perform the following steps: a b l
s fer
with the CreditCardDBService and select Create Wire Actions. - t an
a) Right-click on the wire connecting the ValidateCreditCard Mediator component
r
no n
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
b) In the Wire Actions y z
ewindow,sfor
e the only operation provided click the Emulates
a u
hilpthe sAdd
tab and click
( s e o icon ( ).
tEmulate
z z u cen
ye li
i l p a
sh

c) In the Create Emulate window, observe that the Emulate Output option is
selected. With the Enter Manually option selected click Generate Sample and
perform the following steps to format the emulated response message:
i) The initial generated XML sample contains three <Creditcards> elements with
their associated child elements. Delete the last two <Creditcards> elements
along with the child elements that they contain.

Oracle SOA Suite 11g: Build Composite Applications 153


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite (continued)
ii) In the remaining single <Creditcards> element child replace the
<cardNumber> element with the value 9000-1234-1234-1234. Replace
the <creditLimit> element value with 10000, and most importantly replace
the <status> value with the (case-sensitive uppercase) string VALID.
iii) Click OK to create the emulated message.
Use the following image as a guide for the above steps:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a d) In the Wire Actions window, confirm the addition of the emulated output
sh (response) message and click OK.

Oracle SOA Suite 11g: Build Composite Applications 154


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-1: Create a Test Suite for the CreditCardValidation
Composite (continued)
e) In the test_valid_9000.xml window, you can visually verify that the
emulated output message has been added by the presences of a grey box icon
containing a green arrow pointing to the left. In addition, the wire between the
Mediator component and its target service is displayed as a dotted line.

6) Save the test case file configuration and close the test_valid_9000.xml
window. b le
fer a
7) Save all the changes to the POApplication workspace.
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 155


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite
In this practice, you create two more test cases for the testsuite_ccv test suite created in
the previous practice titled “Create a Test Suite for the CreditCardValidation Composite”.
The second test suite created is similar to the first one created in the practice titled
“Create a Test Suite for the CreditCardValidation Composite” except that the initiating
message data is slightly different and the emulated output (response) from the
CreditCardDBService is INVALID. The final test case, uses an initiating message to test
the message path flow through the CheckCCLimit BPEL process without emulated
responses, and uses assertions to check if the actual response that is returned to the
initiator is an expected value of VALID or INVALID.

To complete these tasks, perform the following steps: e


a b l
1) On the JDeveloper Application Navigator, to create another test case in the
s fer
testsuite_ccv test suite, perform the following steps:
- t r an
n
a) If needed, in the CreditCardValidation project folder expand the SOA Content >
no
a
testsuites folder, right-click on the tests folder and select Create Test.
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh b) In the Create Composite Test window, enter the Name: test_invalid_9000,
and click OK.

Note: This action creates and opens the test_invalid_9000.xml file in a


window.

Oracle SOA Suite 11g: Build Composite Applications 156


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
2) To create the initiating message for the test_invalid_9000 test case, use
instructions in the following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. test_invalid_9000.xml Right-click the ValidateCreditCard_ep Exposed
Services icon and select Create Initiate
Messages.
b. Initiate Messages With the Enter Manually option selected, click
Generate Sample.
Replace the <CCNumber> element value with
9000-1111-2222-3333, and replace the
<amount> value with 2500.
Click OK.
b le
a) fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
b)
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 157


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
3) To create the emulated output wire action for the INVALID response, use instructions
in the following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. test_invalid_9000.xml Right-click on the wire connecting the
ValidateCreditCard Mediator component with
the CreditCardDBService and select Create Wire
Actions.
b. Wire Actions Click the Emulates tab and click the Add
Emulate icon ( ).
c. Create Emulate Click Generate Sample, and replace the three
generated <Creditcards> elements with one
<Creditcards> element with the child element
b le
and their associated values:
fer a
<cardNumber>: 9000-1111-2222-3333
ans
<creditLimit>: 10000 n - t r
<status>: INVALID
a no
d. Wire Actions
Click OK.
) has ideฺ
Confirm the emulated output message has been
c
added, and click OK.
ฺ om t Gu
h o o e n
ya Stu d
a)
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
b)

Oracle SOA Suite 11g: Build Composite Applications 158


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d) ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

4) Save the test case created in the test_invalid_9000.xml window, and close
the file.

Oracle SOA Suite 11g: Build Composite Applications 159


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
5) On the JDeveloper Application Navigator, to create a third test case with assertions in
the testsuite_ccv test suite, perform the following steps:
a) If needed, in the CreditCardValidation project folder expand the SOA Content >
testsuites folder, right-click on the tests folder and select Create Test.

b le
fer a
ans
n - t r
a no
b) In the Create Composite Test window, enter the Name:as
test_response_9999, and click OK ) h ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
Note: This action creates and opens the test_response_9999.xml file in a
window.
6) To create the initiating message for the test_response_9999 test case, use
instructions in the following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. test_response_9999.xml Right-click the ValidateCreditCard_ep
Exposed Services icon and select Create
Initiate Messages.
b. Initiate Messages With the Enter Manually option selected, click
Generate Sample.
Replace the <CCNumber> element value with
9999-9999-9999-9999, and replace the
<amount> value with 3500.
Click OK.

Oracle SOA Suite 11g: Build Composite Applications 160


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
a)

b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
Create li
ye an XML-based Assertion in a Wire Action
il p a
sh 7) To create the wire action with an XML-based assertion for a possible VALID
response from the ValidateCreditCard Mediator component, use instructions in the
following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. test_response_9999.xml Right-click on the wire connecting the
ValidateCreditCard_ep Exposed Services icon
and the ValidateCreditCard Mediator and
select Create Wire Actions.
b. Wire Actions With the Asserts tab already selected, click the
Add Assert icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 161


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
Step Screen/Page Description Choices or Values
c. Create Assert Select the Assert Output option.
Click Generate Sample, and replace the
<status> element with the text VALID, in
uppercase.
Note: The Compare By option is set to “xml-
similar”.
Click OK.
Note: This returns you to the Wire Actions
window.
Do not close the Wire Actions window.
a)
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
b)
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 162


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
Create a Value-based Assertion ya Stu d
z @ is INVALID response from the
u for tahpossible
y z
8) To create a value-based assertion
e component,e
ValidateCreditCardaMediator
p u s use instructions in the following table and
i l t o
u (sh nse
associated screenshots as a guide:
z z liceDescription Choices or Values
Step Screen/Page
e
a. y Wire Actions With the Asserts tab already selected, click the Add
sh ilpa Assert icon ( ).
b. Create Assert Select the Assert Output option.
Assert Target: Click Browse.
c. Select Assert Target Expand the reply > CreditCheckResponse node,
select status and click OK.
d. Create Assert With the Assert Output option and Assert
Target selected, set the following values:
Compare By: string
Assert Value: INVALID
Click OK.

Oracle SOA Suite 11g: Build Composite Applications 163


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
a)

b le
fer a
ans
b)
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 164


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
c)

b le
fer a
d) ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
u cen
zzWire
9) yInethe li window, in the Asserts tab page confirm you have two assertions
Actions
a
ilp of the Assert Output type, and click OK.
sh

Oracle SOA Suite 11g: Build Composite Applications 165


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-2: Create Test Cases in the CreditCardValidation
Test Suite (continued)
10) On the test_response_9999.xml tabbed page, verify the creation of the wire
action.

11) Save the test_response_9999.xml test case and close its window.
12) Save all the changes to the CreditCardValidation project.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 166


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite
In this practice/task, you deploy the CreditCardValidation composite application along
with its test suite and test cases. Once deployed, by using Oracle Enterprise Manager
Fusion Middleware Control you can initiate and examine the results of the test suite and
test cases.

To complete these tasks, perform the following steps:


1) To deploy the CreditCardValidation composite application, right-click the
CreditCardValidation project name and select Deploy > CreditCardValidation > to >
soaserver.
Note: In the SOA Deployment Configuration Dialog, select the option to overwrite
the existing version, and monitor that the deployment is successful in the JDeveloper
b le
log windows.
fer a
2) On the Oracle Enterprise Manager SOA home page, expand the SOA folder in the ans
Farm navigator, and click the “CreditCardValidation [1.0]” link. n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
3) yOn li
e the “CreditCardValidation [1.0]” page, click the Unit Tests tab.
il p a
sh

Oracle SOA Suite 11g: Build Composite Applications 167


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
4) To run the test_valid_9000 test case, perform the following steps:
a) On the “CreditCardValidation [1.0]” Unit Tests > Test Cases tabbed page, if
needed expand the testsuite_ccv entry and select the option next to the row
with the test_valid_90000.xml test case. Click Execute.

b le
fer a
ans
n - t r
test_ccv_01. a no
b) In the “Details of test run” window, enter the Test Run Name value:

) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z
Note: n OK, the Web browser is refreshed with the Test Runs tabbed
u Aftercclicking
e
l i
ye page being displayed. It is a good idea to choose unique names for your test runs.
i l p a The Test Run Name selected can be used in the Test Runs search criteria to locate
sh the results for that test run instance.

Oracle SOA Suite 11g: Build Composite Applications 168


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
c) On the “CreditCardValidation [1.0]” Unit Tests > Test Runs tabbed page, collapse
the Search section to hide the search criteria entry fields. Under the “Results of
Test Run: testccv_01” section, click Refresh Test Status.
Note: You may need to click Refresh Test Status several times before the test run
results begin to appear in the page.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
d) On the “CreditCardValidation [1.0]” h o o Tests e> nTest Runs tabbed page, after
Unit
waiting a short time and clickingy aRefreshSTest
t udStatus enough times the
test_ccv_01 test row should
z z u@ is the Test Run Name column below the
appearhunder
t
y e Click
collapsed Search section.
a s ethe test_ccv_01 test run name (or row) entry
ilpTest eSuite
to display the t u
oand Test Cases tree below the “Results of Test Run:
( s h
z z u cens
test_ccv_01” section.

ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 169


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
e) On the “CreditCardValidation [1.0]” Unit Tests > Test Runs tabbed page, in the
“Results of Test Run: testccv_01” section, if needed expand the
testsuite_ccv test suite tree. In this case, the test_valid_9000.xml
entry is displayed and the Status column contains a green check mark with a
Passed result.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
Note: The Passed status indicates
d
ya thatSthetutest was successful for the conditions
created. In other words,zthe @ is in the Mediator component functions as it
u routingthrule
was designed to work.y e z e
a u s
5) To run all the
s ilpin the
htests e to suite, perform the following steps:
test
( ns
uthe “CreditCardValidation
a) z
e Onz l i c e [1.0]” Unit Tests > Test Runs tabbed page, click
y the Test Cases tab to return to the Test Cases tabbed page:
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 170


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
b) On the “CreditCardValidation [1.0]” Unit Tests > Test Cases tabbed page, select
the option in the testsuite_ccv row, and click Execute.
Note: Selecting the test suite entry causes all the test cases to be executed.

b le
fer a
c) In the “Details of test run” window, enter the Test Run Name value:
ans
test_ccv_all.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e[1.0]” Unit Tests > Test Runs tabbed page, wait for
a
d) On the “CreditCardValidation u s
( s hi(alpcouple
a short time e tofominutes) and click Refresh Test Status, until the
z u censtest run entry appears.
test_ccv_all
z
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 171


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
e) To narrow the displayed results to the test_ccv_all test run results, expand
the Search section. In the Search Test Run Name field enter test_ccv_all,
and click Search.

b le
f) On the “CreditCardValidation [1.0]” Unit Tests > Test Runs tabbed page,
fer a
s
navigate to the Test Run Name column below the collapsed Search section. Click
an
n - t r
the test_ccv_all test run name (or row) entry to display the Test Suite and
no
Test Cases tree below the “Results of Test Run: testccv_all” section.
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 172


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
g) If needed expand the testsuite_ccv tree under the “Results of Test Run:
testccv_all” section. In this test run, all tests have a Passed status except the
test_response_9999.xml test case, which shows the Failed status.
Click the test_response_9999.xml row to display more information about
the failure in the “Assertion details for testsuite_ccv” section.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
z
e assertion
theyfailures e failures? Well, if you remember the test-
Note: Why are a
u s
( s hilp se to test case is the only test case that contains assertions. It
response_9999.xml

z z u thatcan
appears
e nassertion failed. This could indicate a process execution problem
li
ye or data problem.
i l p a h) In the “Assertion details for testsuite_ccv” section, you can examine the cause for
sh the XML-based assertion failure by clicking either of the [XML] links in the row
entry that appears. Click the [XML] link in the Expected Value column.
Note: The value-based assertion also failed as it expected the valid INVALID
when the actual value return is an empty string. This is visible in the table row.

Oracle SOA Suite 11g: Build Composite Applications 173


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 14-3: Deploy and Execute the CreditCardValidation Test
Suite (continued)
i) On the Compare XML Values page, for the XML-based assertion details, you can
examine the actual XML value returned and compare it to the expected value.
This enables you to identify the reason for the test failure and determine the next
action to take, such as examining the process flow and logic to locate the cause of
the problem. In this case the assertion failed because the status element is an
empty element when the value VALID was expected inside the status element.

b le
fer a
an s
n - t r
a no
) has ideฺ
Note: The actual cause of the above problem ฺ c oismbuilttinto
G uthe course application
h o CreditCardDBService
othe e n
scenario. In this case, the cause isathat
y t u d returns an empty
status value if the credit card
u @valueonhdoes
i s Snot exist in the database table. The choice
of solution is varied and
e z zdepends t business requirements. You do not take
the
action to repair a y
this problem e
usin the course practices.
i l p t o
6) In addition,
u (sforh eachnsteste case, a composite instance is created and run as would be the
e z an instance
casezfor
l i c e created from receiving an actual message (rather than an
a y
emulated test) on initiation. In the “Assertion details” table you can click the instance
p
il id link in the Composite Instance column to view the Flow Trace for that composite
sh application instance to examine the process audit trail and flow pages.

7) Optionally, you can click the Composite Instance link to view the Flow Trace details.

Oracle SOA Suite 11g: Build Composite Applications 174


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 15
The goal of this practice is to apply security policies to Web Services end points.
Applying security policies is done in two ways:
• Post-deployment, by using Oracle Enterprise Manager Fusion Middleware
Control to attach a security policy to selected service end point.
• Before deployment (at design time), by attaching policies to service end points in
JDeveloper.
The following image illustrates the security policy attachments applied in this practice:

b le
fer a
an s
n - t r
a no
Your tasks in the practice are to: ) has ideฺ
ฺ c
• Secure invocation of the POProcessing composite om application
t G u entry point
h
(ReceivePO) by using the UsernameToken o o policy.e nThis requires that you enter a
d
yaand password)
tu to initiate the service.
valid set of credentials (username
@ s S
e z zu tcomposite
• Secure the CreditCardValidation hi application entry point
y
a o us
(ValidateCreditCard_ep) e
using SAML service tokens, which requires the security
li ppropagated.
identity tohbe t
(
• Propagate
u s s e
n using SAML client tokens on the ValidCCService, which is
identity by
z z c e
li reference for the ValidateCreditCard_ep entry point.
a
In yepractice
the
the external
you apply the policies to deployed applications by using Oracle Enterprise
sh ilpManager. After removing the policies in Oracle Enterprise Manager you use JDeveloper
to secure the CreditCardValidation service and ensure it is invoked securely using design-
time policy attachments. You remove design-time policies so that remaining practices in
the course do not require the addition step of providing the WS-Security credentials for
each test.

Note: For the purposes of this test you use an input data file with an invalid credit card.
The input file is sufficient for testing and observing the effects of applying the security
policies, without causing modification to the database data. It involves less time and
effort to run the tests because there are less process steps to execute and no need to
perform actions in the Worklist application.

Oracle SOA Suite 11g: Build Composite Applications 175


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
In this practice, you attach the WS-Security UsernameToken policy to the ReceivePO
service entry point of the POProcessing composite application. You test the service with
and without supplying security credentials. You then attach SAML policies the secure the
CreditCardValidation composite application entry point and its client to propagate the
security identity acquired through the use of the UsernameToken policy. You test to see
if execution is successful. Finally, you remove the UsernameToken policy and test to
observe what happens if you try propagate security credentials that have not been
supplied.

To complete these tasks, perform the following steps:


1) In a Web browser window, login to Oracle Enterprise Manager by using the
following steps: le
a b
a) Enter the URL http://localhost:7001/em to access the Oracle
s fer
Enterprise Manager Web application.
- t r an
no n
b) On the Login page, enter user name weblogic and password welcome1, and
click Login. a
) has ideฺ
Attach the UsernameToken Policy to POProcessing
ฺ c om t Gu
o o composite
2) To locate the policy page for the POProcessing
h e n application entry point
ya steps:
called ReceivePO, perform the following tu d
@ s S
a) On the Farm_soa_domain
e z zutree, expand
thi the SOA folder and click on the
“POProcessing a y composite
[1.0]” e
us link.
i l p t o
u (sh nse
e z z lice
y
sh ilpa

b) On the “POProcessing [1.0]” page, click the Policies tab.

Oracle SOA Suite 11g: Build Composite Applications 176


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
3) On the “POProcessing [1.0]” Policies page, use instructions in the following table to
attach the oracle/wss_username_token_service_policy to the
ReceivePO component:
Step Screen/Page Description Choices or Values
a. “POProcessing [1.0]” Click “Attach To/Detach From” and click ReceivePO.
Policies
b. “Attach/Detach Under the Available Policies section, next to Search select
Policies(POProcessing…)” Name from the Search pull-down menu, enter
wss_username, and click the Search icon ( ).
Note: Using the search feature makes it easier to locate the
desired policy, quickly.
c. “Attach/Detach Under the Available Policies section, select the row
b le
Policies(POProcessing…)” containing the Name
fer a
oracle/wss_username_token_service_policy,
ans
click Attach. n - t r
d. “Attach/Detach no
Under the Attached Policies section, verify the desired
a
e. “POProcessing [1.0]” Confirm that the has ideฺ
Policies(POProcessing…)” policy is attached, and click OK.
)
Policies ฺ c om t Gu
oracle/wss_username_token_service_policy
o o e n
is listed as an attached policy.
h
ya Stu d
a)
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 177


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
b)

b le
c)
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
d) zzu c e n
ye l i
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 178


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
e)

Test the WSS Username Token Security Policy b le


fer a
4) To perform a test of the attached security policy, perform the following steps:
an s
a) On the “POProcessing [1.0]” page, click Test. n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @ is Service page, in the Request tab Input
u TestthWeb
b) On the “POProcessingz[1.0]”
y
Arguments section,
a eselect XML
s e View from the pull-down menu and replace the
u
( s hilptext
supplied XML
e tothe contents of the file
with
u cens
D:\labs\files\xml_in\po-guitar-invalidcc.xml,
z z and click Test
li Use the following image as a guide:
ye Web Service.
i l p a
sh

c) What is the result of this test?

Oracle SOA Suite 11g: Build Composite Applications 179


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
i) Answer: The “Webservice invocation failed” window is displayed. For
example:

ii) In the “Webservice invocation failed” window, expand Show Additional


Trace Information. What does it tell you? Use the following image as a guide:
b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
Note: As shown in the z @
uimagettheh ishighlighted text stating “error in processing
the WS-Securityy z
esecuritysheader”
e is a hint at the answer. The answer is that
a u
( s h lpwhich
you did inot
password), s e tisothe
provide
sent
WS-Security information (a valid username and
in the request header.
z u e n
c “Webservice invocation failed” window.
a5) yeziii) Closelithe
i l p To execute another test, this time providing the WS-Security credentials for the WSS
sh Username Token style of security, perform the following steps:
a) On the “POProcessing [1.0]” Test Web Service page, at the top of the Request tab
area, under the Security section select the WSS Username Token option, and
enter weblogic in the Username field that appears, and enter welcome1 in the
Password. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 180


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
b) On the “POProcessing [1.0]” Test Web Service page, with the security
information supplied, click Test Web Service.
Note: The XML View text should have retained the data copied from the
D:\labs\files\xml_in\po-guitar-invalidcc.xml file for this test.
c) What happened this time?
i) Did you get an error message?
Answer: No error message is displayed. The POProcessing composite
instance is initiated successfully, as indicated by the appearance of the Launch
Message Flow Trace link in the Response tab page. Use the following image
as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
omonttheGsupplied
ii) Did the process complete successfully, based
ฺ c u data?
h o o Message
Answer: Yes, if you click the Launch
e nFlow Trace link you can view
y a Stu
the Flow Trace tree and confirm that the d
ValidateCCService, which has not
@ hsuccessfully
been secured yet, wasuinvoked
z is as well. Use the following image
as a guide: e z e t
a y u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Attach the SAML Service Policy to ValidateCreditCard_ep


In this section you attach the SAML service security policy to the ValidateCreditCard_ep
entry point of the CreditCardValidation composite application.

Oracle SOA Suite 11g: Build Composite Applications 181


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
6) On the Oracle Enterprise Manager home page, in the Farm_soa_domain navigation
section, click the “CreditCardValidation [1.0]” link.

b le
7) To attach the fer a
oracle/wss11_saml_token_with_message_protection_service_pol ans
n - t r
icy to the ValidateCreditCard_ep, use instructions in the following table and
associated screenshots as a guide: a no
Step Screen/Page Description )
Choices or Valueshas ideฺ
a. “CreditCardValidation [1.0] “ Click c m G
theoPolicies tabu
o ฺ
o “Attach t
nTo/Detach From” and click
b. “CreditCardValidation [1.0] “
hClick
d e
Policies
@ ya ValidateCreditCard_ep.
S tu
c. “Attach/Detach zu thiUnders the Available Policies, next to Search select
y e z e
Policies(CreditCardValidation…)” Name from the Search pull-down menu, enter
a u s
s h ilp e to wss11_saml, and click the Search icon ( ).
d. (
u cens
“Attach/Detach Under the Available Policies section, select the row
e z z li
Policies(CreditCardValidation…)” containing the Name
y
ilpa
oracle/wss11_saml_token_with_message_
sh e. “Attach/Detach
protection_service_policy, click Attach.
Under the Attached Policies section, verify the desired
Policies(CreditCardValidation…)” policy is attached, and click OK.
f. “CreditCardValidation [1.0] “ Confirm that the oracle/wss11_saml_token_
Policies with_message_protection_service_policy
is listed as an attached policy.

a) Click On the CreditCardValidation [1.0] and

Oracle SOA Suite 11g: Build Composite Applications 182


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
b)

b le
fer a
ans
c)
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a d)
sh

Oracle SOA Suite 11g: Build Composite Applications 183


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
e)

b le
f) fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
Attach
y e the li Client Policy to ValidationCCService
SAML
a
ilpIn this section, you configure the SAML client security policy on the
sh ValidationCCService external reference of the POProcessing composite application. The
SAML client security policy ensures the security credentials, received through the WS-
Security heading (from the attached UsernameToken security policy requirement), are
propagated to the ValidateCreditCard_ep entry point. Remember the
ValidateCreditCard_ep entry point is accessed through the ValidationCCService external
reference, which invoked by the ApproveCCOrder BPEL Process component.
8) To access the POProcessing composite application policies page, perform the
following steps:
a) On the Oracle Enterprise Manager home page, in the Farm_soa_domain
navigation section, click the “POProcessing [1.0]” link.

Oracle SOA Suite 11g: Build Composite Applications 184


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
b) On the “POProcessing [1.0]”page, click the Policies tab.

9) To attach the oracle/ wss11_saml_token_with_message_protection_client_policy (the


SAML client policy) to the ValidationCCService external reference in the
POProcessing composite application, use instructions in the following table and
associated screenshots as a guide:
b le
Step Screen/Page Description Choices or Values
fer a
a. “POProcessing [1.0]” s
Click “Attach To/Detach From” and click ValidateCCService.
an
Policies
n - t r
b. “Attach/Detach
Policies(POProcessing…)”
no
Under the Available Policies section, next to Search select
a
Name from the Search pull-down menu, enter wss11_saml,
) has ideฺ
and click the Search icon ( ).
c. “Attach/Detach om t Gu
Under the Available Policies section, select the row containing
ฺ c
Policies(POProcessing…)” the Name
h o o e n
ya Stu d
oracle/wss11_saml_token_with_message_
z @
u this
protection_client_policy, click Attach.
d. “Attach/Detach y e z e
Under the Attached Policies section, verify the desired policy is
a u s
e. ( hilp se to
Policies(POProcessing…)” attached, and click OK.
s
“POProcessing [1.0]” Confirm that the two policies
z z u cen
Policies oracle/wss_username_token_service_policy and
ye li
ilp a the newly attached oracle/wss11_saml_
sh token_with_message_protection_client_policy
are listed in the policy table.

Oracle SOA Suite 11g: Build Composite Applications 185


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
a)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a b)
sh

Oracle SOA Suite 11g: Build Composite Applications 186


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
c)

b le
fer a
ans
d)
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh e)

Test Security Propagation with Username Token and SAML Policies


In this section, you initiate a test of the POProcessing composite application and provide
security credentials to test if the process works indicating that the security credentials are

Oracle SOA Suite 11g: Build Composite Applications 187


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
successfully propagated. To verify this, you then perform another test after disabling the
Username Token security policy to observe what happens when you perform a test when
the credentials are not enforce and therefore not propagated.
10) To initiate a security propagation test of the POProcessing composite application
through to the CreditCardvalidation composite application, perform the following
steps:
a) On the “POProcessing [1.0]” home page, click Test.
b) On the “POProcessing [1.0]” Web Service Test page, under the Request tab in the
Security section, select the WSS Username Token option, and enter the
Username: weblogic and Password: welcome1.

b le
fer a
ans
n - t r
a no
) as down
hscroll e ฺ to the Input
c) On the “POProcessing [1.0]” Web Service Test page,
othemXML i d
u mode, and replace
Arguments section in the Request tab, select ฺ c
oof the filen t G
View
the supplied XML text with the contentsh o d e
ya Stu
D:\labs\files\xml_in\po-guitar-invalidcc.xml,
@ and click Test
u i s
Web Service.
y e zz e th
d) Provided youp
i l a the
entered
t o us credentials in for the WSS Username Token
correct

u sh nsection,
in the Security
(using s e the process should execute successfully. You can verify
z z
this by
l i c e the following steps:
a ye i) Observe that the Response tab page is displayed with Launch Message Flow
i l p
sh Trace link.

Oracle SOA Suite 11g: Build Composite Applications 188


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
ii) On the Response tab page, click the Launch Message Flow Trace link and
confirm from the Flow Trace tree that all appropriate process components
executed with a Completed status. Use the following image as a guide:

b le
fer a
an s
n - t r
a no
) h as eฺ
11) Now, if you are not convinced by the above success
o m result, you
u d now disable the
ican
WSS Username Token policy in the POProcessing
o ฺ c t G
composite
n application. This
eliminates the need to provide the security o
h credentials
aTherefore, de when initiating the
POProcessing composite application. y t u
S security identity information can
no
z u @ i s
e zprove e th the
be propagated to the ValidateCreditCard_ep entry point of the CreditCardValidation
composite application.
p a y To
u sit, perform following steps:
l
hi Enterprise o
t Manager, on the Farm_soa_domain navigation section,
s
a) On the(Oracle
n s e
uthe “POProcessing
e z z
click
l i c e [1.0]” link.
y
sh ilpa

b) On the “POProcessing [1.0]” home page, click the Policies tab.

Oracle SOA Suite 11g: Build Composite Applications 189


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
c) On the “POProcessing [1.0]” Policies tab page, in the list of attached policies
select the oracle/wss_username_token_service_policy row, and
click Disable.

b le
fer a
ans
n - t r
d) In the Confirmation window, click Yes.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y z
e [1.0]”spage,
e) On the “POProcessing e click Test.
a u
( s hilp se to
z z u cen
ye li
i l p a
sh
f) On the “POProcessing [1.0]” Test Web Service page, there is no need to provide
the WS Username Token credentials because you disabled the policy. In the
Request tab section, scroll down to the Input Arguments section in the Request
tab, select the XML View mode, and replace the supplied XML text with the
contents of the file D:\labs\files\xml_in\po-guitar-
invalidcc.xml, and click Test Web Service.

Oracle SOA Suite 11g: Build Composite Applications 190


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
g) To confirm that the process instance terminated with a fault condition, perform
the following steps:
i) On the Response page, click the Launch Message Flow Trace link.

Note: The POProcessing instance was successfully created.


b le
ii) Did security credentials get propagated?
fer a
s
Answer: No. On the Flow Trace page in the Trace tree, you can observe that
an
t r
the ApproveCCOrder BPEL Process component failed with a fault that was
n -
of the fault, click the ApproveCCOrder link. a no
caused by a fault on the ValidateCCService reference. To examine the cause

) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 191


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
iii) On the “Instance of ApproveCCOrder” Audit Trail page, scroll down and
expand the <payload> for the Invoke_validatecc activity, which has faulted.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u that youh isget an error indicating that the end point
Note: You can observer
e z e t
y
cannot be accessed.
a u s
s
Note: (This
ilp iseexpected
hresult to because you did not provide any credentials to the
z u cecomposite
POProcessing
z ns application, and therefore there is no authenticated
y e security l i
identity that can be propagated to the CreditCardValidation service entry
i l p a point, which still enforces the requirement to provide security information
sh because of the attached SAML security policies.

Detach all Security Policies


In this section, you use Oracle Enterprise Manager to detach the security policies so that
you can perform the same security attachment tasks at design-time in the JDeveloper
Composite Editor in the next practice titled “Apply Security Policies at Design-Time.”

Oracle SOA Suite 11g: Build Composite Applications 192


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
12) To detach the security policies from the POProcessing composite application,
perform the following steps:
a) On the Farm_soa_domain navigator section, click the “POProcessing [1.0]” link.

b le
fer a
b) On the “POProcessing [1.0]” page, click the Policies tab.
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u Policies
c) On the “POProcessing [1.0]” h ispage, click “Attach To/Detach From” >
e z e t
a y
ValidateCCService.
u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 193


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
d) On the “Attach/Detach Policies(POProcessing…)” page, under Attached Policies,
select the
oracle/wss11_saml_token_with_message_protection_client
_policy entry, and click Detach.

b le
e) On the “Attach/Detach Policies(POProcessing…)” page, under Attached Policies,
fer a
confirm that no policies are attached and click OK.
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya page, d
tuclick “Attach To/Detach From” >
f) On the “POProcessing [1.0]” Policies
@ s S
ReceivePO.
e z zu thi
a y u s e
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 194


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
g) On the “Attach/Detach Policies(POProcessing…)” page, under Attached Policies,
select the oracle/wss_username_token_service_policy entry, and click Detach.

h) On the “Attach/Detach Policies(POProcessing…)” page, under Attached Policies,


confirm there are not policies attached, and click OK.
b le
fer a
ans
n - t r
a no
) haalls security
i) On the “POProcessing [1.0]” Policies page, verify that
i d e ฺ policies have
ฺ c om t Gu
been detached from the composite application.

h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

13) To detach the SAML service policy from the CreditCardValidation composite
application, perform the following steps:
a) On the Farm_soa_domain navigator section, click the “CreditCardValidation
[1.0]” link

b) On the “CreditCardValidation [1.0]” page, click the Policies tab.

Oracle SOA Suite 11g: Build Composite Applications 195


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
c) On the “CreditCardValidation [1.0]” Policies page, click “Attach To/Detach
From” > ValidateCreditCard_ep.

b le
fer a
an s
n - t r
Policies, select the a no
d) On the “Attach/Detach Policies(CreditCardValidation…)” page, under Attached

) has ideฺ
oracle/wss11_saml_token_with_message_protection_servic
e_policy entry, and click Detach.
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a e) On the “Attach/Detach Policies(CreditCardValidation…)” page, under Attached
sh Policies, confirm that no policies are attached and click OK.

Oracle SOA Suite 11g: Build Composite Applications 196


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-1: Apply Security Policies Post Deployment
(continued)
f) On the “CreditCardValidation [1.0]” Policies page, verify that all security policies
have been detached from the composite application.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 197


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
In this practice, you effectively repeat the attachment of the policies used in the previous
practice titled “Apply Security Policies Post Deployment.” However, this time you attach
the policies to component end points at design-time to the composite.xml files by
using the Composite Editor. After deploying the secured composite applications you
initiate a test, and then disable the security and redeploy the applications so that
remaining course practices do not require security credentials to be supplied for every test
subsequently performed.

Note: In JDeveloper, to attach policies to end points, right-click on a exposed service,


external references, and components in the Composite Editor and select Configure WS-
Policies.

To complete these tasks, perform the following steps: b le


fer a
1) On the JDeveloper window, open the CreditCardValidation composite.xml
ans
application file (if required, because it may already be open).
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p aAttach the SAML Service Policy to ValidateCreditCard_ep
sh 2) To attach the
oracle/wss11_saml_token_with_message_protection_service_p
olicy to the ValidateCreditCard_ep exposed service, use instructions in the
following table and associated screenshots:
Step Screen/Page Choices or Values
Description
a. composite.xml Right-click the ValidateCreditCard_ep exposed service
icon, and select Configure WS-Policies.
b. Configure SOA WS For the Security section, click the Add Security
Policies Policy icon.
c. Select Service Security Scroll down and select the
Policies oracle/wss11_saml_token_with_message_
protection_service_policy entry, and click
OK.

Oracle SOA Suite 11g: Build Composite Applications 198


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
Step Screen/Page Choices or Values
Description
d. Configure SOA WS Confirm the addition of the
Policies oracle/wss11_saml_token_with_message_
protection_service_policy entry to the
Security section, and click OK.
Note: The check box next to the policy indicates that
the policy is enabled.
e. composite.xml In the Exposed Services column, observe that the
ValidateCreditCard_ep icon contains a lock icon, to
indicate it has been secured.
a)
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 199


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a c)
sh

Oracle SOA Suite 11g: Build Composite Applications 200


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
d)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a e)
sh

3) Save the changes to the CreditCardValidation composite application project.


4) Close the CreditCardValidation composite.xml window.

Attach the SAML Client Policy to ValidateCCService


In this section you, modify the POProcessing composite application and attach the
appropriate security policies to propagate the SAML security to the CreditCardValidation
composite from the ValidateCCService external reference.

Oracle SOA Suite 11g: Build Composite Applications 201


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
5) In the JDeveloper Application Navigator, under the POProcessing > SOA Content
folder, right-click the composite.xml file and click Open.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
6) To attach the oracle/wss11_saml_token_with_message_protection_client_policy to
o o n
y ah use
the ValidateCCService external reference, de in the following table and
instructions
t u
associated screenshots:
z u @ his S
Step Screen/Page ez Choices
e t or Values
Description lp a y u s
h i t o
a. (s nse Right-click
composite.xml
u
the ValidateCCService external reference
zz ice
b. yeConfigurel SOA WS
icon and select Configure WS-Policies.
For the Security section, click the Add Security
sh ilpa Policies Policy icon.
c. Select Service Security Scroll down and select the
Policies oracle/wss11_saml_token_with_message_
protection_client_policy entry, and click
OK.
d. Configure SOA WS Confirm the addition of the
Policies oracle/wss11_saml_token_with_message_
protection_client_policy entry to the
Security section, and click OK.
e. composite.xml In the External References column, observe that the
ValidateCCService icon contains a lock icon, to
indicate it has been secured.

Oracle SOA Suite 11g: Build Composite Applications 202


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
a)

b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 203


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
c)

b le
fer a
ans
d)
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 204


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
e)

Attach the UsernameToken Policy to POProcessing


In this section you enforce the requirements for obtaining credentials for the
POProcessing composite by using the Username Token policy on its ReceivePO entry
point. Credentials are required so that they can be propagated to the ValidateCCService.
b le
7) To attach the oracle/wss_username_token_service_policy to the ReceivePO exposed
fer a
service, use instructions in the following table and associated screenshots:
ans
Step Screen/Page Choices or Values n - t r
Description
a no
a. composite.xml Right-click the ReceivePO exposed
Configure WS-Policies. ) h
as service
e ฺ icon, and select

b. Configure SOA WS For the Security section, c o m Guid


Policies h o oฺ click e n tthe Add Security Policy
c. Select Service
icon.
Scroll@down tudthe
yaand select
S
Security Policies z z u this
oracle/wss_username_token_service_policy
a y e entry,sand
e click OK.
d. Configureh SOA
u
ilp WSe tConfirm
o the addition of the
( s
u cen
Policies s oracle/wss_username_token_service_policy
z z li
a ye entry to the Security section, and click OK.
Note: The check box next to the policy indicates that the
sh ilp policy is enabled.
e. composite.xml In the Exposed Services column, observe that the
ReceivePO icon contains a lock icon, to indicate it has been
secured.
a)

Oracle SOA Suite 11g: Build Composite Applications 205


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a c) Select wss_username_token_service_policy, and click OK.
sh

Oracle SOA Suite 11g: Build Composite Applications 206


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
d)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a e)
sh

8) Save the changes to the POProcessing composite application project.


9) Close the POProcessing composite.xml window.

Deploy CreditCardValidation, Deploy and Test POProcessing


10) In the JDeveloper window, to deploy the CreditCardValidation project with the
security attachments, perform the following steps:
a) In the Application Navigator, right-click CreditCardValidation and select Deploy
> CreditCardValidation > to > soaserver.

Oracle SOA Suite 11g: Build Composite Applications 207


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
composites with the same revision ID.” option, and click OK.
11) In the JDeveloper window, to deploy the POProcessing project with the security
attachments, perform the following steps:
a) In the Application Navigator, right-click POProcessing and select Deploy >
POProcessing > to soaserver.
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
composites with the same revision ID.” option, and click OK.
c) In the Compiler – Log window, you can ignore the three warning indicators
shown, and ensure deployment is successful in the Deployment tab.
b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
Test the Design-Time Security
z @
u Settings
h is in Oracle Enterprise Manager
z t
eToken security
e is enforced, perform the following steps:
12) To test if the Username
a y u s
s hilpEnterprise
a) On the(Oracle e to Manager, on the Farm_soa_domain navigation section,
z z
click
c ns [1.0]” link.
uthe “POProcessing
e
li
yb)e On the “POProcessing
ilp a [1.0]” page, click Test.
sh

Oracle SOA Suite 11g: Build Composite Applications 208


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
c) On the “POProcessing [1.0]” Test Web Service page, do not specify the WS
Username Token credentials. In the Request tab section, scroll down to the Input
Arguments section in the Request tab, select the XML View mode, and replace
the supplied XML text with the contents of the file
D:\labs\files\xml_in\po-guitar-invalidcc.xml, and click Test
Web Service.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
d) After a short delay,y z
ethe “Webservice
e invocation failed” window is displayed. This
a u s
indicates that
h i lp
the invocation
t o of the POProcessing application failed because
(scredentials
security
u n sewere not provided when they are required.
z lic e
a yez
i l p
sh

13) To repeat the test, and this time supplying a valid username and password in the WSS
Username Token settings, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 209


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
a) On the “POProcessing [1.0]” Test Web Service page, click the Request tab. Under
the Security section, select the WSS Username Token option, enter the
Username: weblogic and Password: welcome1.

b) On the “POProcessing [1.0]” Test Web Service page, after entering the security
credentials, click Test Web Service (at the top or bottom of the page).
b le
c) This time, the “POProcessing [1.0]” Test Web Service > Response tab page is
fer a
displayed with the Launch Message Flow Trace link indicating the service
an s
invocation is successful. Use the following image as a guide:
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s h ilp e tofo the Response tab is an indication that the security
Note: The appearance
(
u censauthenticated and processing is allowed to proceed.
credentials were
z z li
a yd)e On the “POProcessing [1.0]” Test Web Service > Response tab, click the Launch
i l p Message Flow Trace link to verify that the process completed as expected,
sh indicating that the ValidateCCService propagated the credentials to the
ValidateCreditCard_ep in the CreditCardValidation composite application.

Oracle SOA Suite 11g: Build Composite Applications 210


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
14) Close the Web browser window containing the Flow Trace page.

Disable Security Policies and Redeploy Applications


15) To disable the Username Token security policy so that they are not enforced by the
POProcessing composite application, perform the following steps:
a) In the JDeveloper Application Navigator, under the POProcessing > SOA Content
folder, double-click the composite.xml file.
b) In the composite.xml window, right-click ReceivePO icon, and select
Configure WS-Policies.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 211


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
c) In the Configure SOA WS Policies window, in the Security section deselect the
option next to the oracle/wss_username_token_service_policy
entry. This disables the security policy so that it is not enforced. Click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
d) In the composite.xml window, to confirm the security policy is disabled, on
the ReceivePO icon verify the lock icon on is displayed in an unlocked state.

16) To disable the SAML client security policy on the ValidateCCService external
reference of the POProcessing composite application, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 212


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
a) In the composite.xml window, right-click ValidateCCService icon, and select
Configure WS-Policies.

b) In the Configure SOA WS Policies window, in the Security section to disable the
b le
security, deselect the option next to the
fer a
oracle/wss11_saml_token_with_message_protection_client
ans
_policy entry.
n - t r
Click OK.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 213


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
c) In the composite.xml window, to confirm the security policy is disabled, on
the ValidateCCService icon verify the lock is displayed in an unlocked state.

17) Save the changes to the POProcessing composite application project, and close the
composite.xml window.

18) To disable the SAML service security policy on the CreditCardValidation composite b le
application exposed service (entry point), perform the following steps: fer a
ans
t r
a) In the Application Navigator, expand the CreditCardValidation > SOA Content
n -
folder, and double-click the composite.xml file.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh b) In the composite.xml window, right-click ValidateCreditCard_ep icon, and
select Configure WS-Policies.

Oracle SOA Suite 11g: Build Composite Applications 214


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
c) In the Configure SOA WS Policies window, in the Security section to disable the
security, deselect the option next to the
oracle/wss11_saml_token_with_message_protection_servic
e_policy entry.
Click OK

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

d) In the composite.xml window, to confirm the security policy is disabled, on


the ValidateCreditCard_ep icon verify the lock is displayed in an unlocked state.

19) Save the changes the changes to the CreditCardValidation composite application
project, and close the composite.xml window.

Oracle SOA Suite 11g: Build Composite Applications 215


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 15-2: Apply Security Policies at Design-Time
(continued)
Redeploy Composite Applications with Security Policies Disabled
20) In the JDeveloper window, to deploy the CreditCardValidation project with the
security attachments, perform the following steps:
a) In the Application Navigator, right-click CreditCardValidation and select Deploy
> CreditCardValidation > to soaserver.
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
composites with the same revision ID.” option, and click OK.
21) In the JDeveloper window, to deploy the POProcessing project with the security
attachments, perform the following steps:
a) In the Application Navigator, right-click POProcessing and select Deploy >
POProcessing > to soaserver. b le
fer a
s
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
an
composites with the same revision ID.” option, and click OK.
n - t r
no
c) In the Compiler – Log window, you can ignore the three warning indicators
a
has ideฺ
shown, and ensure deployment is successful in the Deployment tab.
)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 216


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 16
The goal of this practice is to create and implement event publication and subscription
services to support the POProcessing application.

The business needs to implement fulfillment processing and shipping for products with a
waiting status, which indicates that they were placed in waiting until the products for
that order are available in the stores. To assist you with this implementation the following
composite applications are provided:
• The AddStockToStore composite application, which accepts a stored indicate, the
product ID and the amount of product to add to the specified store database table.
• The FulfillWaitingPO composite application, that contains a BPEL process that:
o Accepts a product ID and finds all order Ids whose status is waiting and
contains the specified product ID. b le
o Retrieves the full order details and prepares it in an internal order XML fer a
structure ready to be sent to the Fulfillment BPEL process in the ans
POProcessing composite application. n - t r
no
The following image illustrates the composite application interactions, and the Mediator
a
has ideฺ
components used for publishing and subscribing to the stock update business event:
)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
To implement the business requirement to manage the fulfillment of waiting orders, you
perform the following tasks:
• Copy the AddStockToStore composite application project folder, from the
D:\labs\files, into the POApplication workspace in the
D:\labs\mywork\POApplication folder. You modify the composite
application to publish a stock update event containing the product ID of the stock
item updated.
Note: When updating the AddStockToStore project you create the event
definition language files and XML schema.

• Copy the FulfillWaitingPO composite application project to the POApplication


workspace, and modify it to subscribe to the stock update event. You first test that
an event is delivered from the AddStockToStore composite application to the
FulfillWaitingPO composite application. You then modify the FulfillWaitingPO

Oracle SOA Suite 11g: Build Composite Applications 217


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
composite application to invoke a new Fulfillment BPEL component entry point
that you create in the POProcessing composite application.
Note: Creating the new Fulfillment BPEL process entry point in the POProcessing
composite application requires that you modify its process flow to determine if the
internal order received has a waiting status, and if so, you use a Bind Entity activity to
retrieve an existing order, instead of inserting an order that is already present.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 218


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event
In this practice, you copy the AddStockToStore composite application project folder,
from the D:\labs\files, into D:\labs\mywork\POApplication folder. You
modify the composite application to publish a stock update event containing the product
ID of the stock item updated.

To complete these tasks, perform the following steps:

Open the AddStockToStore Composite Application


1) In a Windows Explorer window, make a copy the
D:\labs\files\AddStockToStore folder and paste it in the
D:\labs\mywork\POApplication folder.
b le
2) In the JDeveloper window, ensure the POApplication name is selected in the fer a
an s
Application Menu pull-down menu.
n - t r
no
3) To add the AddStockToStore composite application project to the POApplication
a
has ideฺ
workspace, perform the following steps:
)
c om Menu
a) In the Application Navigator, click the Application
ฺ t G uicon ( ) and select
Open Project.
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh b) In the Open Project window, navigate to the
D:\labs\mywork\POApplication\AddStockToStore folder, select
AddStockToStore.jpr and click Open.
Note: If an Open Warning window is displayed, click Yes, and on the Migration
Status window, click OK.
c) Select File > Save all to save the changes to the POApplication workspace.

Create the Stock Update Event in the AddStockToStore Composite


In this section you create the Event Definition Language (EDL) file with the StockUpdate
event and define its payload.
4) In the Application Navigator, to open the AddStockToStore composite application
assembly model, expand the AddStockToStore > SOA Content folder, and double-
click the composite.xml file.

Oracle SOA Suite 11g: Build Composite Applications 219


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
5) To create the StockUpdate event definition and payload structure, use instructions in
the following table and associated screenshots:
Step Screen/Page Description Choices or Values
a. composite.xml Click the Event Definition Creation icon ( ) on the
composite.xml window toolbar.
b. Event Definition Creation Event Definition name: managestock
Accept default values for other fields, and click the
“Add an Event” icon ( ) in the Events table.
c. Add an Event
Element: Click the “Browse typechooser” icon ( ).
d. Type Chooser Expand the Project Schema Files >
UpdateStock.xsd, select productID, and click
b le
OK.
fer a
e. Add an Event Name: Replace Event1 with StockUpdate.
ans
Click OK. n - t r
f. Event Definition Creation no
Confirm that the StockUpdate event appears in the
a
has ideฺ
Events table, and click OK.
)
a)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
b)
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 220


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
c)

d)
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye)e li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 221


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
f)

b le
fer a
ans
n - t r
a no
6) In the JDeveloper window, after creating the event definition the
has ideฺ
managestock.edl file is opened in its own window, which displays the event
)
definitions in the EDL file.
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh a) On the JDeveloper menu, select File > Save the event definition file.
b) Close the managestock.edl window.

Oracle SOA Suite 11g: Build Composite Applications 222


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
7) In the Application Navigator, confirm the creation of the managestock.edl,
which includes the file under the SOA Content folder.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
Note: The managestock.edl file can h o oopenedetoncreate, modify, or delete event
be
y a Syou
definitions. If you expand the xsd sub-folder t d find the StockUpdate.xsd
ucan
file.
z z u@ this
8) Save the changesp yeAddStockToStore
toathe u se project.
i
h se l t o
Publish u (sStockUpdate
the n Event from AddStockToStore
z z l i c e
yesection, you modify the AddStockToStore composite application assembly model
In this
a
p
il to include a Mediator component that publishes the StockUpdate event. You modify the
sh BPEL process to invoke the Mediator component after the specific product stock quantity
has been updated.
9) In the AddStockToStore composite.xml window, create a Mediator component
that publishes the StockUpdate event. Use instructions in the following table and
associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Composite.xml Drag a Mediator component from the Component
Palette into the Components column.
b. Create Mediator Name: PublishUpdateEvent
Template: One-way Interface
Ensure the “Create Composite Service with SOAP
Bindings” option is deselected.
Input: Click the Browse Input Elements icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 223


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
Step Screen/Page Description Choices or Values
c. Type Chooser Expand Project Schema Files >
UpdateStock.xsd, select productID and
click OK.
d. Create Mediator Confirm your settings are as specified in step (b)
and (c) in this table, and click OK.

a)

b le
fer a
ans
n - t r
a no
) has ideฺ
b) ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 224


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
c)

b le
fer a
ans
n - t r
a no
) h as eฺ
d)
c o m Guid
h o oฺ ent
y a Stud
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 225


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
10) In the AddStockToStore composite.xml window, create a wire connecting the
UpdateStock BPEL Component to the new PublishUpdateEvent Mediator
component. Use the following image as a guide to the result:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
h i lp
11) To edit the PublishUpdateEvent
t o Mediator component so that it publishes the
(s event,nperform
UpdateStock
u se the following steps:
a)ez z lic e
In the composite.xml window, right-click the PublishUpdateEvent Mediator
a y component icon and select Edit. Alternatively, double-click the
sh ilp PublishUpdateEvent Mediator component.

Oracle SOA Suite 11g: Build Composite Applications 226


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
b) In the PublishUpdateEvent.mplan window, in the Routing Rules section
for the execute operation, click Add ( ) > “static routing rule”.

b le
fer a
ans
n - t r
c) In the Target Type window, click Event.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
p a u s
s hilChooser
d) In the Event
( e to observe that the StockUpdate event is already
window,
z u ascbeing
detected
z e nsdefined and selected. Click OK.
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 227


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
12) In the PublishUpdateEvent.mplan window, to create a transformation map
for the routing rule, use instructions in the following table and associated screenshots
as a guide:
Step Screen/Page Description Choices or Values
a. PublishUpdateEvent.mplan In the routing rule containing the
Event::StockUpdate as its target:
Transform Using: Click the “Select an
existing mapper file or create a new
one.” icon ( ).
b. Request Transformation Map Select the “Create New Mapper File”
option, accepting the file name
generated. b le
Click OK. fer a
c. productID_To_StockUpdate.xsl Map the productID element from the ans
Source column to the productID n - t r
no
element in the (target) XSLT File:
a
has ideฺ
UpdateStock.xsd column.
)
a)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
b)

Oracle SOA Suite 11g: Build Composite Applications 228


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
c)

13) Select File > Save All to save the changes to the XSLT Mapper file and the
composite.xml, and close the productID_To_StockUpdate.xsl window.
14) In the AddStockToStore composite.xml window, confirm that the StockUpdate
event is displayed in the PublishUpdateEvent Mediator component icon, which also
displays a “publish event” lightning bolt icon on its right-hand edge. Use the
following image as a guide: b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a Invoke
yto d
tuPublishUpdateEvent
Modify the UpdateStock BPEL @
u thi s S
In previous steps, you wired e z
thezPublishUpdateEvent Mediator component to the
UpdateStock BPEL lcomponenta y s e
u a partner link in the BPEL process. In this
creating
h i p UpdateStock
t o
u s nse
section, you modify
(invoke the BPEL Process, in the AddStockToStore composite
z z
application, to
l i c e the PublishUpdateEvent Mediator component so that the event can
a ye
be published with the productID assigned to the invoke activity input variable.
il p
sh 15) In the AddStockToStore composite.xml window, right-click the UpdateStock
BPEL component icon and select Edit. Alternatively, double-click the UpdateStock
BPEL component.

Oracle SOA Suite 11g: Build Composite Applications 229


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
16) In the UpdateStock.bpel Design window, to modify the process flow drag an
Assign and Invoke activity into the process flow after the Flow_updstore_qty activity
(which you may need to collapse for visual clarity). Rename the activities and use the
sequence listed in the following table:
Seq. Activity Type Activity Name Purpose
a. Assign Assign_evt_prodid This assigns the productID whose
quantity has been updated to the input
variable of the Invoke_evt_publish
activity.
b. Invoke Invoke_evt_publish This activity invokes the
PublishUpdateEvent Mediator component
to send it the productID for which the
b le
StockUpdate event must be published.
fer a
ans
Use the following image as a guide:
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 230


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
17) To configure the Invoke_evt_publish activity use the following field settings and
image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s h ilp help
Note: If you require
e ttooconfigure the Invoke_evt_publish activity, perform the
(
u steps:cens
following
z z li
a ya)e In the UpdateStock.bpel Design window, double-click the
i l p Invoke_evt_publish activity.
sh b) In the Invoke settings window, click the Browse Partner Links icon.
c) In the Partner Links Chooser window, select the PublishUpdateEvent partner link.
d) In the Invoke settings window, the Operation is set to execute, next to the Input
field click the Automatically Create Input Variable icon ( ).
e) In the Create Variable window, accept the default name, type, and Global
Variable option, and click OK.
f) In the Invoke settings window, click OK.

18) To configure the Assign_evt_prodid activity to populate the


Invoke_evt_publish_execute_inputVariable with the productID supplied in the
process inputVariable, perform the following steps:
a) In the UpdateStock.bpel Diagram window, double-click the
Assign_evt_prodid activity.

Oracle SOA Suite 11g: Build Composite Applications 231


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
b) In the Assign settings window, create one copy operation that copies the
productID element from the process inputVariable to the productID element in the
Invoke_evt_publish_execute_inputVariable. Use the following Create Copy
Operation image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ytoa applySthe d
tucopy operation created.
@
c) In the Assign window, click OK
zu thi s
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 232


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-1: Modify a Composite Application to Publish an
Event (continued)
19) Verify that your UpdateStock.bpel Diagram window contains the process flow
as shown in the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilpto the
20) Save the changes s e to
AddStockToStore composite application project.
z u e n
21)yClose lic
ez the AddStockToStore composite.xml, the UpdateStock.bpel, and the
a
ilp PublishStockEvent.mplan windows (if they are still open).
sh
Deploy the AddStockToStore Composite Application
22) To deploy the modified AddStockToStore composite application project, perform the
following steps:
a) In the Application Navigator, right-click the AddStockToStore project name, and
select Deploy > AddStockToStore > to > soaserver.
b) In the SOA Deployment Configuration Dialog, click OK.
Note: If the Authorization Request dialog box is displayed, enter the Username:
weblogic and Password: welcome1 and click OK.
c) In the Deployment – Log window, confirm that deployment was successful.
23) Save all the changes to the POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 233


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event
In this practice, you copy the FulfillWaitingPO composite application project to the
POApplication workspace. You modify FulfillWaitingPO to subscribe to the stock update
event.

To complete these tasks, perform the following steps:


1) In the JDeveloper window, open the POProcessing composite.xml application
file (if required, because it may already be open).

Open the FulfillWaitingPO Composite Application


2) In a Windows Explorer window, make a copy the
D:\labs\files\FulfillWaitingPO folder and paste it in the b le
D:\labs\mywork\POApplication folder. fer a
a n s
3) In the JDeveloper window, ensure the POApplication name is selected from
n r
-t the
Application Menu pull-down menu. n o
a
asto theePOApplication
4) To add the FulfillWaitingPO composite application project,
) h ฺ
workspace, perform the following steps:
om t Gu i d
o ฺ c nMenu icon ( ) and select
a) In the Application Navigator, click h o
the d e
Application
Open Project. @ ya Stu
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh
b) In the Open Project window, navigate to the
D:\labs\mywork\POApplication\FulfillWaitingPO folder, select
FulfillWaitingPO.jpr and click Open.
Note: If an Open Warning window is displayed, click Yes, and on the Migration
Status window, click OK.
c) Select File > Save all to save the changes to the POApplication workspace.

Modify FulfillWaitingPO to Subscribe to the StockUpdate Event


5) Create a Mediator component as a Subscriber to an event. To modify the assembly
model with a Mediator component that subscribes to an event, perform the following
steps:
a) In the Application Navigator, expand the FulfillWaitingPO project and SOA
Content folder. Right-click the composite.xml file and select Open.

Oracle SOA Suite 11g: Build Composite Applications 234


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
b) In the FulfillWaitingPO composite.xml window, drag a Mediator component
into the Components column.

6) To configure the Mediator component as a subscriber to the StockUpdate event, use


instructions in the following table and associated screenshots as a guide: b le
fer a
Step Screen/Page Description Choices or Values
ans
a. Create Mediator Name: SubscribeUpdateEvent
n - t r
Template: Subscribe to Events
a no
) h as eฺ
Above the Event table, click the “Subscribe to a new
event.” icon (
o ).m u id
b. Event Chooser Accept theo c
ฺ settings
default n G
t provided. Confirm the
h o e
following:
y aDefinition:
S t udmanagestock.edl (including
z z u@Event
t h
its folder
isfull pathname).
a y e s e
u Event: StockUpdate
( s hilp se to Type: productID, fully qualified by its namespace.
z z u cen Click OK.
l i
c. yeLocalize Files Copy Options: Deselect the “Maintain original
il p a directory structure for imported files” option.
sh Observe the two files listed and click OK.
Note: The Localize Files window is displayed
because JDeveloper detected the EDL and XSD files
for the StockUpdate event are located in the
AddStockToStore project folder. This window is
displayed to enable JDeveloper to copy the files to
the FulfillWaitingPO project.
d. Create Mediator Confirm the StockUpdate event is added to the
subscription table list, and click OK.

Oracle SOA Suite 11g: Build Composite Applications 235


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
a)

b le
fer a
ans
n - t r
n o
b) a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 236


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
c)

b le
fer a
ans
n - t r
a no
Note: This copies the event definition and XSD from the AddStockToStore

) has ideฺ
project into the current project as local copies. Ideally, these EDL and XSD files
should be centralized in the Metadata Server (MDS) or a Service Registry.
ฺ c om t Gu
d)
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 237


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
7) In the FulfillWaitingPO composite.xml window, confirm that the
SubscribeUpdateEvent Mediator icon is added and contains the StockUpdate event as
the Subscribed event, and that a subscriber icon is displayed on the left-hand side of
the Mediator icon. Use the following image as a guide:

8) To complete the changes to the FulfillWaitingPO composite application assembly b le


model, create a wire from the SubscribeUpdateEvent Mediator component to the fer a
an
FulfillWaitingOrders BPEL Process component. Use the following image as a guide:s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 238


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
9) In the FulfillWaitingPO composite.xml window, verify that your assembly
model resembles the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o oalternative
e nentry point, through events, to
Note: The SubscribeUpdateEvent provides
ya process d
tucomponent.
initiate the FulfillWaitingOrders@BPEL
s S
10) Select File > Save Allyto e zzuthe echanges
save thi to the project.
i l p a o us
s h se t for the SubscribeUpdateEvent Routing Rule
Create a Transformation
(
z z u youcconfigure
In this section, e n the required transformation to copy the productID value
l i
ye as the payload with the StockUpdate event to the request message of the
received
p a
il FulfillWaitingOrders BPEL process.
sh
11) To create a new transformation in the SubscribeUpdateEvent Mediator component
routing rule, use instructions in the following table and associated screenshots as a
guide:
Step Screen/Page Description Choices or Values
a. composite.xml Right-click the SubscribeUpdateEvent
Mediator component icon and select
Edit.
b. SubscribeUpdateEvent.mplan Under the StockUpdate event section, in
the Static Routing rule, next to
Transform Using click the “Select an
existing mapper file or create a new
one.” icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 239


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
Step Screen/Page Description Choices or Values
c. Event Transformation Map Select the “Create New Mapper File”
option and accept the default file name
generated.
Click OK.
d. StockUpdate_To_process.xsd Map the productID element from the
Source column to the productID element
in the (target) XSLT File:
FulfillWaitingOrders.xsd
column.
a)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
b)
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

c)

Oracle SOA Suite 11g: Build Composite Applications 240


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-2: Modify a Composite Application to Subscribe to
an Event (continued)
d)

12) Save changes to the FulfillWaitingPO project including the mappings created in the
XSLT mapper file, and close the StockUpdate_To_process.xsl and
SubscribeUpdateEvent.mplan, and composite.xml windows.

b le
fer a
ans
n - t r
Deploy the FulfillWaitingPO Composite Application
a no
13) To deploy the modified FulfillWaitingPO project, perform s following
hathe ฺ steps:
) i d e
m Gu project name, and
a) In the Application Navigator, right-click the
ฺ c oFulfillWaitingPO
t
o
select Deploy > FulfillWaitingPO > toosoaserver.
h e n
y
b) In the SOA Deployment Configuration
a Dialog,
S t udclick OK.
z @ hdialog
uRequest is box is displayed, enter the Username:
Note: If the Authorization
z
e welcome1 e t
p y
weblogic andaPassword: u s and click OK.
l
hi se– Log o
t window, confirm that deployment was successful.
( s
c) In the Deployment
uthe changes n to the POApplication workspace.
z
14) Save z
all l i c e
a ye
il p
sh

Oracle SOA Suite 11g: Build Composite Applications 241


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
In this practice, you perform a test of the event publication and subscription logic you
created in previous practices titled “Modify a Composite Application to Publish an
Event” and “Modify a Composite Application to Subscribe to an Event.” You initiate a
test of the AddStockToStore composite application publishes a StockUpdate event, and
that the FulfillWaitingPO composite application receives the event as a subscriber to the
event.

Note: The FulfillWaitingPO composite application has not been modified to send the
actual request to the Fulfillment BPEL process in the POProcessing composite.
Therefore, the database data you insert and modify to create the data conditions for an
order with a waiting status are retained for a test performed in the last practice section of
this lesson.
b le
To complete these tasks, perform the following steps: fer a
a n s
Modify Database Data with Zero Quantity for Product ID SKU106 n -t r
o
n (a Gibson Les
a
In this section you reduce the quantity to zero for the product ID SKU106
Paul guitar – a very popular item) in the internal and online h
) asdatabase
store e ฺ tables. This
m product
creates the data conditions so that an order for the SKU106 i d
u causes the order to be

stored in the database with a waiting status, andonotcofulfilled
n t G
yet.
h
a S o d e
1) To query the store quantities for theyGibson
@ LestuPaul guitar, with product ID
zu steps:thi
SKU106, perform the following s
y e z e the files application, expand the files >
a
a) In the Application u
Navigator,s select
lp >tosql folder, and open the gibson_query.sql file.
hiSources
u ( s
Application
n se
ez z lic e
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 242


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
b) In the gibson_query.sql window, click the Execute Statement icon.

c) In the Select Connection window, use the soademo(POApplication)


connection and click OK.
b le
d) In the gibson_query.sql window, under the Results tab confirm that the
fer a
product ID row for SKU106 has a value of 3 in the ONLINE column, and a value
ans
of 0 in the INTERNAL column.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@
zu this
Note: Do not close e thezgibson_query.sql window because you return to this
window to execute a y the u s
query
e
again.
h i lp t o
u s online
2) To update (the
n e and internal store data so that the product ID with SKU106
sstore
z e
c stock at all, perform the following steps:
eznot haveliany
does
y
sh ilpa a) In the Application Navigator, under the files > Application Sources > sql folder,
and open the gibson_update.sql file.

Oracle SOA Suite 11g: Build Composite Applications 243


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
b) In the gibson_query.sql window, click the Run Script icon, or press F5.

c) In the Select Connection window, us the soademo(POAppliation)


connection and click OK.
d) In the gibson_update.sql window, under the Script Output tab confirm you
get two lines with the text “1 rows updated” and the text “commit succeeded.” b le
Use the following image as a guide: fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
e) Close the gibson_update.sql ya window. tu d
@ s S
f) In the gibson_query.sqle z zu window, thi click the Execute Query icon again, and
a
in the Resultslptab
e
yconfirm uthats the product ID row for SKU106 has a value of 0 in
both the s hi sand e o
tINTERNAL columns. Use the following image as a guide:
u ( ONLINE
n
e z z lice
a y
i l p
sh

Execute POProcessing to Create a new Order for product SKU106


In this section, you run the POProcessing composite application to create an order for the
product ID SKU106, which cannot be fulfilled so the order is saved in the database with
its status set to waiting.

Oracle SOA Suite 11g: Build Composite Applications 244


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
3) In a Web browser window, open the Oracle Enterprise Manager Web application by
entering the URL http://localhost:7001/em.
Note: At the login window, enter the Username: weblogic and Password:
welcome1, and click Login.
4) To create an order for the product with ID SKU106, perform the following steps:
a) In the Farm_soa_domain navigation tree, expand the SOA folder and click
“POProcessing [1.0]”.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to[1.0]” home page, click Test.
b) On the “POProcessing
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 245


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
c) On the “POProcessing [1.0]” Test Web Service page, in the Input Arguments on
the Request tab page, use XML View and replace the supplied XML data with the
contents of the D:\labs\files\xml_in\po-large-guitar.xml file.

Note: Ensure that you delete the first <ns0:item> containing product ID SKU200
along with its child elements and that the remaining <ns0:item> item element
contains a productId with SKU106 with a quantity of 1. Click Test Web Service.

Use the following image as a guide.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 246


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
d) On the Response tab, confirm that the process instance was successfully created,
and click the Launch Message Flow Trace link to view and Refresh the Flow
Trace page until you confirm that the order has completed.

Note: Optionally, use the links for various components Flow Trace to confirm
that the order has been inserted into the database with a waiting status.
b le
Hint: Locate and click Fulfillment BPEL Component link, and examine activities
fer a
s
in the Audit Trail or Flow windows. The callbackClient should indicate that the
an
product’s shipStatus is waiting.
n - t r
no
5) To confirm that a new order has been created with the waiting status in the
a
database tables, perform the following steps:
) has ideฺ
ฺ c om t Gworkspace
a) In the Application Navigator, in the files application u expand files >
Application Sources > sql folder, ando
h o
open n
the waitingorders.sql
e file.
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

b) In the Select Connection window, use the soademo(POApplication)


connection and click OK.
c) In the waitingorders.sql window, click Execute Statement icon.

Oracle SOA Suite 11g: Build Composite Applications 247


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
d) In the waitingorders.sql window, under the Results tab confirm that one
order with the waiting status has been created in the ORDERS table.
Note: Use the following image as guide, and be aware that your results will be
different from those shown for the ORD_ID, and DATE_ORDERED columns:

Note: Make a record of the ORD_ID value to match results in subsequent steps.
6) Do not close the SQL windows yet.
b le
fer a
Update the Product Quantities for Waiting Orders
a n s
r
In this section, you run the AddStockToStore composite to increase the stock-tcount in the
n as
n
internal store to see if the event publishing and subscribing logic created oworks
s a product in either
intended. At this stage there is zero quantity available for the SKU106
of the stores. ) a
h ideฺ
7) To increase the internal store quantity for the ฺ c om product
t G u ID, and send the
h o ocomposite
SKU106
e napplication to process waiting
StockUpdate event to the FulfillWaitingPO
ya Stu d
z @
orders, perform the following steps:
u this
a) On the Oracle Enterprise
y z
e Managere Web page, on the Farm_soa_domain navigator
a u s
section, click
h i lp
“AddStockToStore
t o [1.0]”.

u (s nse
e z z l i c e
y
sh ilpa

b) On the “AddStockToStore [1.0]” home page, click Test.

Oracle SOA Suite 11g: Build Composite Applications 248


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
c) On the “AddStockToStore [1.0]” Test Web Service page, in the Input Arguments
of the Request tab section, with the Tree View mode selected, enter the following
field values (where string values are case-sensitive, and must entered as shown):

store: internal
productID: SKU106
amount: 1

Click Test Web Service.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @ is page, click Launch Message Flow
u[1.0]” tResponse
h
y e z
d) On the “AddStockToStore e
Trace. a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 249


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
8) On the Flow Trace page for “AddStockToStore [1.0]”, examine the Flow Trace tree
and answer the questions that follow this image:

b le
fer a
ans
n - t r
no
a) From the Flow Trace tree information how do you know that the StockUpdate
a
event was delivered?
) has ideฺ
b) What is the product ID value sent in the event
c m Gforuthe published
opayload
o ฺ
StockUpdate? How did you find this information
o n t using the Flow Trace
through
and component links? h
a Stud e
y
c) On the JDeveloper window,
z z u@ t h is the query in the gibson_query.sql
re-execute
window. Explain y
a e the internal
why s e store is still showing a value of 1 in the
u
( s h p secolumn?
INTERNALil(store) to
d) What
z z u product c e n was received in the SubcribeUpdateEvent Mediator component
ID
l i
ye of the FulfillWaitingPO composite application? Explain how you determined this
i l p a information.
sh e) Using the Flow Trace tree and component links, how can you determine the order
ID and the status of the order being processed?

Oracle SOA Suite 11g: Build Composite Applications 250


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
Q Answers for Step 8.
a. From the Flow Trace tree information the indication that the StockUpdate event was
delivered is due to the presence of both the PublishUpdateEvent and
SubscribeUpdateEvent components, both showing the Completed state.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 251


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
Q Answers for Step 8.
b. The product ID value sent in the event payload with published StockUpdate event is
SKU106.
To determine the information using the Flow Trace, click the PublishUpdateEvent link:

b le
fer a
ans
n - t r
a no
) has ideฺ
In the Audit Trail for the PublishUpdateEvent,ฺ c om the
expand t G u
<payload> entry after the line
o o n
that contains the text:
y ah Stude
“Published event {http://schemas.oracle.com/events/edl/managestock}StockUpdate” :
u @ i s
y e zz e th
i l p a o us
( s h se t
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 252


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
Q Answers for Step 8.
c. To re-execute the query in the gibson_query.sql window, click the Execute
Statement. The Results tab shows the following values:

b le
fer a
ans
n - t r
a no
The internal store shows a value of 1 in the INTERNAL (store) column because the
Fulfillment BPEL process has not been invoked to process the order yet. You have not
has ideฺ
yet modified the POProcessing composite to expose the service entry point for the
)
ฺ c om t Gu
Fulfillment BPEL process, and therefore have not been able to invoke the process from

h o o e n
the FulFillWaitingOrders BPEL process, which does not perform the fulfillment
processing tasks. ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 253


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
Q Answers for Step 8.
d. The product ID received in the SubcribeUpdateEvent Mediator component is SKU106.
You can verify this by clicking the FulfillWaitingOrders BPEL Component link in the
Flow Trace tree:

b le
fer a
an s
n - t r
a no
) has ideฺ
On the “Instance of FulfillWaitingOrders” page,
c m the
oexpand G u<payload> of the
o o ฺ n t
receiveInput activity.
h d e
@ ya Stu
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: Alternatively, you can click the SubscribeUpdateEvent to view similar


information.

Oracle SOA Suite 11g: Build Composite Applications 254


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
Q Answers for Step 8.
e. To determine the order ID and the status of the order being processed, click the
FulfillWaitingOrders link the Flow Trace tree, and in the “Instance of
FulfillWaitingOrders” page, expand the <payload> of the Invoke_getwaiting_po activity
to view the order ID (or list of Ids if there is more than one):

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n activity you can view the
If you expand the <payload> of the Transform_internal_po
status of the order is waiting, andyathat it does d
tucontain the SKU106 product in the
@ s S
items:
e z zu thi
a y u s e
( s hilp se to
z z u cen
ye li
i l p a
sh

9) To view the Business Event information in Oracle Enterprise Manager in the


Business Events monitoring section, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 255


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
a) On the Oracle Enterprise Manager page, in the Farm_soa_domain pane, expand
the SOA folder, right-click the soa-infra link and select Business Events

b le
fer a
ans
n - t r
a no
) has ideฺ
c m page
otabbed G uverify that you can see
o ฺ
b) On the Business Events page, on the Events
o and Events t
n table. Optionally, select the
h
the StockUpdate event in the Namespace d e
event and click Show Event@ ya Stu
Definition.
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 256


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-3: Test Event Publication and Subscription
(continued)
c) On the Business Events page, click the Subscriptions tab. On the Subscriptions
tabbed page, collapse both the Search and the Database Subscription section, and
you can view the StockUpdate event listed in the Component Subscriptions table:

b le
fer a
ans
10) On the Farm_soa_domain pane, under the SOA folder click the soa-infra link.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 257


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status
In this practice, you modify the POProcessing composite application assembly model by
creating an entry point for the Fulfillment BPEL Process. You then modify the
Fulfillment BPEL Process to check the status for the internal order it receives and for
waiting orders read the existing order from the database instead of inserting it into the
database. You modify the FulfillWaitingPO composite application with an external
reference to the Fulfillment BPEL process entry point and invoke the Fulfillment BPEL
component to perform the final processing for processing waiting orders.

To complete these tasks, perform the following steps:


1) On the Application Navigator, select the POApplication application workspace from
the Application Menu. Expand the POProcessing project and its SOA Content folder.
b le
2) To open the POProcessing composite application assembly model, double-click the f er a
composite.xml file. an s
- t r
Modify the POProcessing with an Exposed Service a
on
fornFulfillment
) hasentry
In this section you create the exposed service (another composite
i d e ฺ in the
point)
POProcessing composite application for the Fulfillment
ฺ c omBPEL t G u
process.
3) To create the exposed service entry pointo
h othe Fulfillment
for e n BPEL process, perform
the followings steps: ya Stu d
z @
u this
a) On the composite.xml y z
e window, e click and drag the interface icon ( ) from
a u s
s h p Services
the left-handiledge
on the (Exposed s e toFulfillment
of the
column (on
BPEL Process component icon and drop it
the left side of the composite.xml
z u e n
c the following image as a guide:
y ezwindow).liUse
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 258


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
b) On the composite.xml window, verify the creation of an exposed service
component called fulfillment_client, with two operations: process and
processResponse. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
4) Save the changes to the POProcessing composite project. as
) h ideฺ
Modify the Fulfillment BPEL Process to c m GOrder
oManage u Status
o ฺ
o activities t
n must be modified to check
In this section, the initial Fulfillment BPELhprocess
a received d e
the status of received orders. Therefore,
@ yorders S tu from the FulfillWaitingPO
composite with a waiting status i s
zu are notthinserted into the ORDERS (and ITEMS)
y e z e
database table a secondatime. Waiting
p s orders should already exist having been created
uFulfillment
when they are first i l
h se
received byt othe BPEL process as approved orders.
(
u cens
e z z
Theyfollowing li illustrates the final result of the changes made to
image
a
ilpFulfillment.bpel:
sh

Oracle SOA Suite 11g: Build Composite Applications 259


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
In this diagram, the Switch has been added to check the order status, and waiting orders
are handled in the <case status = waiting> branch, and order with another status are
handled by the <otherwise> branch.
5) To modify the Fulfillment.bpel process flow, perform the following steps:
a) On POProcessing composite.xml window, double-click the Fulfillment
BPEL Process component icon to open its implementation in the BPEL Editor.
b) On the Fulfillment.bpel Design window, drag a Switch activity into the
process flow after the receiveInput activity (at the start of the process), and
rename the Switch to Switch_initialstatus. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
c)ez
zu licethen Switch_initialstatus activity, expand the Switch activity and
To configure
a y double click the <case> branch title to open the Switch Case settings window.
i l p
sh d) On the Switch Case settings window, set the fields as follows:
Name: status = waiting
Expression: bpws:getVariableData('inputVariable',
'payload', '/ns1:FulfillmentRequest/ns5:status') =
'waiting'

Oracle SOA Suite 11g: Build Composite Applications 260


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
Use the following image as a guide:

b le
fer a
ans
n - t r
a no
h a s ฺ by selecting
Note: You can use the Expression Builder to create the expression
the status element from the inputVariable and append
o m ide
) = u'waiting'.
ฺc perform
6) To create the activities inside Switch_initialstatus,
o n t Gthe following steps:
o
a) Drag a Bind Entity activity intoythe t ude= waiting> branch, and rename
ah<caseSstatus
the BindEntity_1 activityu to@ is
BindEntity_order.
e z z t h
y
b) Drag the Scope_insertorder
a u s e the Switch) into the <otherwise> branch.
(below

( s hilp simage
Use the following
e to as a guide for the two steps:
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 261


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
c) On the composite.xml Design window, verify that the Switch_initialstatus
activity is structured as shown in the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
c o m inGtheufollowing table and
7) To configure the BindEntity_order activity, use settings
associated image as a guide:
o o ฺ n t
h ud e
Field Valueya S t
Name z @ his
uBindEntity_order
Entity variable ye
z e t
a s
orderEV
uClick the Create icon (and see the next step)
Unique Keys:
h i lp t o
u (s nse
e z z l i c e
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 262


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
8) To set the Unique Keys entry, on the Specify Key window, using the following image
as a guide:

b le
Perform the following steps to configure the field values: fer a
ans
a) For Key Local Part, click the Browse Entity Variable icon ( ) n - t r
a
b) On the Browse Entity Variable window, expand the Variables
n> oordersEV >
has iprefix
ordersViewSDO and select the OrdID with the namespace
) d e ฺ (such as
ns9:OrdId), and click OK.
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: Selecting the Key Local Part sets the Key Namespace URI field as well.

Oracle SOA Suite 11g: Build Composite Applications 263


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
c) To select Key Value, click the Expression Builder icon, and in the Expression
Builder window select the orderId element from the inputVariable > payload >
FulfillmentRequest structure. Click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
9) Save the changes to the Fulfillment.bpel o
c m and
process G uthe POProcessing
project, and close their windows. o o ฺ n t
h d e
@ ya SProject tu
Deploy the POProcessinguComposite
z s
thi composite project so that we can modify the
In this section, you deploy e z
the e
POProcessing
y withuansexternal reference to the fulfillment_client interface
l p a o
exposed by the(s hi se tcomposite
FulFillWaitingPO composite
POProcessing application.
z u c e n
y ezdeploy thelimodified
10) To POProcessing project, perform the following steps:
a
ilp a) On the Application Navigator window, right-click the POProcessing project
sh name, and select Deploy > POProcessing > to soaserver.
b) On the SOA Deployment Configuration Dialog, select the “Overwrite any
existing composites with the same revision ID.” option, and click OK.
c) On the Deployment – Log window, confirm that deployment was successful. You
can ignore the three warning messages displayed.

11) Save all the changes to the POApplication workspace.

Oracle SOA Suite 11g: Build Composite Applications 264


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
Modify FulfillWaitingOrders to Invoke Fulfillment
In this section, you complete the implementation of the processing of waiting orders by
modifying the FulfillWaitingPO composite to include an external reference to the
Fulfillment BPEL process (deployed to the SOA Server), wire the external reference to
the FulfillWaitingOrders BPEL process, and implement the activities to invoke the
Fulfillment service after receiving the StockUpdate event.
12) To modify the FulfillWaitingPO composite application assembly model, perform the
following steps:
a) On the Application Navigator, expand the FulfillWaitingPO project SOA Content
folder, and double-click the composite.xml file.
b) On the FulfillWaitingPO composite.xml window, drag a Web Service
b le
component from the Component Palette into the External References column.
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 265


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
c) To configure the Web Service settings, use following image as a guide:

b le
fer a
ans
n - t r
a no
To set the Create Web Service fields, perform the following steps:
has idasethe
i) In Name enter: FulfillmentService, and accept)Reference ฺ Type.
ฺ c om t Gu
h o o WSDLs
ii) In WSDL URL: Click the Find Existing e n icon ( ), and on the SOA
a Stu
Resource Browser window,yselect Resourced Palette from the pull-down menu,

z z u@ >tsoaserver
expand Application Server
h is OK.> SOA > POProcessing, select
e
fulfillment_client
a y s eand click
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 266


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
13) On the composite.xml window, create a wire from the FulfillWaitingOrders
BPEL Process component to the new FulfillmentService external reference:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @ is
u thFulfillmentService
y e z
14) To create the activities that invokes the
e in the
FulfillWaitingOrders
p a u s
BPEL Process, perform the following steps:
i l t o
u sh nse
a) On the(composite.xml file, double-click the FulfillWaitingOrders BPEL
z lic
ezProcess icon. e
y
sh ilpa b) On the FulfillWaitingOrders.bpel Diagram window, after the
Transform_internal_po activity drag an Invoke and Receive activity inside the
Scope_getorder nested in the FlowN activity. Use the names and sequence listed
in the following table:
Activity Type Activity Name Purpose
Invoke Invoke_fulfillment To invoke the
FullfillmentService to process
orders with a waiting status
Receive Receive_fulfillment To obtain the response from the
FulfillmentService.

Oracle SOA Suite 11g: Build Composite Applications 267


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
z
ye use activity, perform the following steps:
15) To configure thelp a
Invoke_fulfillment
i e to
( s h
a) On u
z z c e ns
the composite.xml window, double-click the Invoke_fulfillment activity.
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 268


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
b) In the Invoke settings window, using the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
In the Invoke settings window, use h o
theofollowinge n to set the fields:
steps
d
ya Stu by clicking the Browser
z @
i) Set Partner Link to FulfillmentService
is FulfillmentService in the Partner Link
uselectingththe
Partner Link icon zand
Chooser. pay
e se
il selecting u
to the partner link the Operation is set to process.
Note:
( s hAfter e
ii)zu
z c e ns section, next to Input click the Automatically Create Input
In the iVariables
ye Variable l icon, and in the Create Variable window accept the default name and
i l p a select the Local Variable option:
sh

Note: You must create a local variable so that each FlowN branch has its own
copy of this variable, when multiple waiting orders are being processed.
16) To configure the Receive_fulfillment activity, perform the following steps:
a) On the composite.xml window, double-click the Receive_fulfillment activity.

Oracle SOA Suite 11g: Build Composite Applications 269


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
b) On the Receive settings window, using the following image as a guide:

b le
fer a
ans
n - t r
a no
) h as eฺ
On the Receive settings, use the following steps
o mto set G id
the fields:
u
i) Set Partner Link to FulfillmentService c
oฺ by clicking
n t the Browser Partner Link
h o e
a Stuind the Partner Link Chooser.
icon and selecting the FulfillmentService
Note: After selecting uthe
y
@ hilink
partner verify that the Operation is set to
z s
processResponse.
a y ez se t
i lp section,
ii) In the Variables t o u next to Input click the Auto-Create Variable icon,
and(s
h se Variable window accept the default name and select the
in the Create
z u e n
yez lc
Local iVariable option:

i l p a
sh

Note: You must create a local variable so that each FlowN branch has its own
copy of this variable, when multiple waiting orders are being processed.

Oracle SOA Suite 11g: Build Composite Applications 270


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
17) On the FulfillWaitingOrders.bpel Diagram window, add another
Transform activity called Transform_to_fulfillment between the
Transform_internal_po and Invoke_fulfillment activities. Use the following image as
a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a Note: The additional transformation is required to populate the
sh Invoke_fulfillment_process_inputVariable from the internalOrder variable.
18) To configure the Transform_to_fulfillment activity perform the following steps:
a) Double-click the Transform_to_fulfillment activity.
b) On the Transform window, in the Transformation tab page:
i) In the Source settings click the Create icon and select the internalOrder
variable.
ii) For Target Variable, select the Invoke_fulfillment_process_inputVariable
from the pull-down menu.
iii) For Mapper File: Set it to xsl/Transformation_fulfillment, and
click the Create Mapping icon.

Oracle SOA Suite 11g: Build Composite Applications 271


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
Use the following image as a guide:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
Note: When you click the Create Mapping
h o o icon,ethen settings are saved and the
Transformation_fulfillment.xsl y a Stufile d is created and opened in the
XSLT Mapper window. u@ is
e z z t h
a y s e
19) To configure the Transformation_fulfillment.xsl,
u perform the following
steps: l p
hi se t o
( s
u the order nelement from the Source column to the FulfillmentRequest
a) z z
Drag
l i c e
a ye element in the XSLT File column:
il p
sh

b) On the Auto Map Preferences window, accept the default settings and click OK.
c) Select File > Save to save the XLST Mapper settings and close the
Transformation_fulfillment.xsl window.

Oracle SOA Suite 11g: Build Composite Applications 272


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-4: Implement Fulfillment for Orders with a Waiting
Status (continued)
20) On the FulfillWaitingOrders.bpel Diagram, verify the process flow
matches the following image

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
e changes
21)ySave the li to the FulfillWaitingPO project and close the related windows.
ilp a
sh Deploy the Completed FulfillWaitingPO Composite Application
22) To deploy the modified and completed FulfillWaitingPO project, perform the
following steps:
a) On the Application Navigator window, right-click the FulfillWaitingPO project
and select Deploy > FulfillWaitingPO > to soaserver.
b) On the SOA Deployment Configuration Dialog, select the “Overwrite any
existing composites with the same revision ID.” option, and click OK.
c) On the Deployment – Log window, confirm that deployment was successful.

Oracle SOA Suite 11g: Build Composite Applications 273


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
In this practice, you finally test the completed course application composite applications.
Here you initiate the POProcessing composite application to process the existing order
that has the waiting status, and observe that it is processed by the Fulfillment BPEL
process, shipped and the order status is set to 'complete'.
1) On the JDeveloper window, select the files application workspace in the
Application Menu, and expand the files > Application Sources > sql folder.

Confirm there is an Order with the Waiting status


2) To confirm that there is an order with the waiting status, and products available to
fulfill the order perform the following steps:
a) If the file is not already open, double-click the gibson_query.sql file, le
a b
fer
otherwise click the gibson_query.sql window, and click the Execute
Statement icon.
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a Note: Verify that the product with PROD_ID=SKU106 has a value of zero and
sh one in the ONLINE and INTERNAL columns, respectively.
b) On the waitingorders.sql window, click the Execute Statement icon, and
verify that an order exists with the waiting value in the STATUS column.
Note: If needed, double-click the waitingorders.sql in the sql folder to
open and execute the query.

Oracle SOA Suite 11g: Build Composite Applications 274


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
c) Note: If you have more than one order with a 'waiting' status, you may want
to update the status of all but one of those orders (all but the order with the
highest ORD_ID value) to 'approved'. Although, the composite application
has been designed to process multiple waiting orders, if you want your results to
resemble the results for this practice it is recommended to have one order with the
'waiting' status. To change the order status to 'approved' for all waiting
orders except the order with the highest ORD_ID, perform the following steps:
i) In the JDeveloper window, open the update_waitingorders.sql file
from the files application (or from the D:\labs\files\sql folder) in
new SQL Worksheet window.
ii) In the new SQL Worksheet window, click the Run Script (F5) icon to execute
the following two SQL statements: b le
fer a
ans
UPDATE orders SET status = 'approved'
n - t r
no
WHERE status = 'waiting'
AND ord_id < (SELECT max(ord_id)
a
has ideฺ
FROM orders WHERE status ='waiting');
)
COMMIT;
ฺ c om t Gu
iii) In the Select Connection dialogh o oselect the
box, e n
d
ya Stu and click OK. Use the following
image as a guide forzthe
@
soademo(POApplication)connection
u result:this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

iv) Close the update_waitingorders.sql SQL Worksheet window.


3) Do not close the gibson_query.sql and waitingorders.sql windows.

Test Fulfillment of the Waiting Order


In this section, we execute the AddStockToStore composite application to update the
stock quantity for product SKU106 in the online store. This sends a StockUpdate event to

Oracle SOA Suite 11g: Build Composite Applications 275


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
a FulfillWaitingPO composite instance, which now invokes the Fulfillment BPEL
process to complete the order, because the stock is available.
4) To initiate the test perform the following steps:
a) On the Oracle Enterprise Manager Web browser home page, in the
Farm_soa_domain section, click “AddStockToStore [1.0].”
Note: If required, due to a session timeout you may need to login to the Oracle
Enterprise Manager again.

b le
fer a
ans
n - t r
a no
) has ideฺ
b) On the “AddStockToStore [1.0]” page, click
c m Gu
oTest.
o o ฺ n t
h
a Stud e
y
z z u@ this
a y e s e
u
( s hilp se to
c)ez
zu licen
On the “AddStockToStore [1.0]” Test Web Service page, scroll down to the
a y Request tab Input Arguments section, with the Tree View mode selected enter the
i l p
sh following payload values, ensuring you use the correct case-sensitive string
values:
store: online
productID: SKU106
amount: 1

Oracle SOA Suite 11g: Build Composite Applications 276


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
Click Test Web Service.

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
5) Before you examine the Flow Trace through the Response tab, return to the
JDeveloper gibson_query.sql window, to check that the AddStockToStore has
has ideฺ
incremented the quantity to one in the ONLINE (store) column, by clicking the
)
ฺ c om t Gu
Execute Statement icon. Use the following image as a guide:
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: Do not close the gibson_query.sql window.

Oracle SOA Suite 11g: Build Composite Applications 277


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
6) Return to the “AddStockToStore [1.0]” Test Web Service page and perform the
following steps to view the process execution flow in Oracle Enterprise Manager:
a) On the “AddStockToStore [1.0]” Test Web Service Response tab page, click the
Launch Message Flow Trace link.

b le
fer a
ans
n - t r
a no
) has ideฺ
c o m Gu
b) On the Flow Trace page, in the Trace tree
o ฺ n t refresh the page until you
o and ifeneeded
h
a Stud
confirm the process flow has completed.
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

c) Using the Trace tree make the following observations:

Oracle SOA Suite 11g: Build Composite Applications 278


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
i) The PublishUpdateEvent executed successfully, causing the
SubscribeUpdateEvent to receive the product information to use to locate the
waiting orders.
ii) How do you know if the FulfillWaitingOrders BPEL Process sent the order
for fulfillment?
Answer: In the tree below the FulfillWaitingOrders row, the
FulfillmentService Reference appears followed by the Fulfillment BPEL
component. If you scroll down the Trace tree you should see the rest of the
components involved leading to the order being sent to the FedexJmsService.
d) To examine the results in the FulfillWaitingOrders process, perform the following
steps:
i) On the Flow Trace tree, click the FulfillWaitingOrders BPEL Component link b le
fer a
s
ii) On the “Instance of FulfillWaitingOrders” page, scroll down and examine the
an
- t r
Receive_fulfillment activity, and click the View XML Document link to view
n
the payload received.
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y z
e window e that displays the XML Document you can
iii) In the Web a browser u s
confirm lp the FulfillmentResponse
hithat to contains the shipStatus value completed,
(
u cen
and s
carrier s e
valued FedEx.
z z li
a ye
i l p
sh
e) To examine the ShippingStatus Business Rules component, perform these steps:
i) On the “Instance of FulfillWaitingOrders” page, click the Flow Trace
breadcrumb link at the top of the page.

Oracle SOA Suite 11g: Build Composite Applications 279


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
ii) On the Flow Trace page, click the ShippingRules component link.

iii) On the “Instance Detail Of ShippingRules” page, observe that the shipChoice
is set to next_day, resulting in the FedEx carrier being selected as the
shipping company. b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
Question: Wherey z
e was theseshipChoice value next_day set?
i a u is set in the FulfillWaitingOrders BPEL process to
lpThe shipChoice
o
Answer:
h
(s waiting t
z expedite
u e n seorders as quickly as possible. However, if you examine the
lic data closely, you will find that there is no record of the shipping
yez database
i l p a choice or method saved for the original order.
sh Note: This oversight can be seen as design problem or just that the business
decided that a waiting order, when fulfilled, should be shipped as soon as
possible. Ultimately the implementation depends on the business rules. In this
case, recording the ship choice for a waiting order was not conceived in the
course application design, so it was easier to choose the path to expedite
waiting orders as quickly as possible (just an afterthought). Hopefully, this
discussion stimulates your thinking about your composite application designs.

Oracle SOA Suite 11g: Build Composite Applications 280


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
7) Return to the JDeveloper window, and on the gibson_query.sql window, click
the Execute Statement icon to confirm that the INTERNAL (store) column has been
reduced to zero, as a result of the order being fulfilled. Remember that if both stores
have sufficient stock the internal store is preferred to fulfill the order. Use the
following image as a guide:

b le
fer a
ans
n - t r
a no
8) In the waitingorders.sql window, click the Execute s ฺ icon to confirm
haStatement
that no rows are returned, indicating that there are
o m ) u ide to be fulfilled.
no orders waiting
Use the following image as a guide:
o o ฺc nt G
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 281


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 16-5: Test Fulfillment for an Order with a Waiting Status
(continued)
9) In the waitingorders.sql window, replace the condition
status='waiting' in the WHERE clause with the text: ord_id = 107, and
click the Execute Statement icon.
Note: The value of the ord_id may be different for your order example.
If you did not remember to write down the order id from the earlier execution of this
waitingorders.sql file, then you can use the Flow Trace and click the
Fulfillment BPEL Component link, and retrieve the order ID from the inputVariable
payload it received.

b le
fer a
ans
n - t r
a no
) has ideฺ
m Gu
coDATE_SHIPPED
Note: The order displayed should show thatothe
o ฺ n t value is now set,
h
a STATUS
and no longer a null value, and that the e
d contains the value
ucolumn
y S t
completed.
z z u@ this
y
10) In the JDeveloper window,
a e to prevent
s e updating the original waitingorders.sql
p modified u
( s hilthe
file on disk with
e to query, perform the following steps:
a) To
z z ns
uclose thecewaitingorders.sql window, click the close (X) icon on the tab.
ye l i
il p a
sh

b) In the Save Files window, click No.

11) Close the gibson_query.sql window.


12) Close the Web browser window containing Flow Trace, unless you wish to examine
the process flow further.

Oracle SOA Suite 11g: Build Composite Applications 282


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 17
The goal of this practice is to send information from the SOA composite components to
an Oracle Business Activity Monitoring (BAM) server instance, by using the Oracle
BAM Web Service interface and BAM Sensor Actions. Data sent to the Oracle BAM
Server is viewed by displaying a BAM Report (called a dashboard) to observe order
information being received and its status changing in real-time as it flows through the
POProcessing composite application. The BAM report (dashboard) and its associated
data object definitions are first imported into the BAM Server to enable order data to be
received by the BAM Server and monitored with the BAM Active Viewer application.

Note: Oracle BAM Active Studio enables creation of real-time business dashboards,
which provide a dynamic real-time visual presentation of business process activity. BAM
Web applications must be accessed and used in the Internet Explorer Web browser.
b le
fer a
The following image illustrates the key changes to the POProcessing composite
ans
application to support business activity monitoring:
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
lp
himodifying
Your tasks involve tothe POProcessing composite in the following ways:
( s
u a cBAM
• Creating
e
nsAdapter in the POProcessing composite assembly model that is
z z e
li EnrichPO Mediator component
a y•e wired to the

sh ilp Modifying the transformation from the RoutePO Mediator component to acquire
an order ID from the database ORDER_SEQ sequence before the order is routed to
the EnrichPO Mediator component.
Note: Obtaining the unique order ID here enables the entire POProcessing
application to track changes to the same order in the BAM Server.
• Creating a transformation for the new wire on the EnrichPO Mediator component
to send initial order data to the BAM Server though the BAM Adapter.
• Modifying the ApproveCCOrderBPEL component with a sensor for the
outputVariable to monitor changes to order data through a BAM Sensor Action.
• Modifying the Fulfillment BPEL component to remove an Assign activity that
obtains an order ID from a database sequence. The order ID obtained from
executing the XSLT transformation between the RoutePO and EnrichPO
components. A variable sensor with a BAM Sensor Action is created for
monitoring order status changes to the inputVariable.
• Adding a composite sensor and a BPEL process activity sensor that use a
Database sensor action, to enable viewing sensor data with Oracle Enterprise
Manager.

Oracle SOA Suite 11g: Build Composite Applications 283


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server
In this practice, you configure the BAM Adapter in the WebLogic Administration Server
run-time environment. The configuration involves setting connection pool properties for
the SOAP connection factory used by the BAM Adapter and BPEL sensors to
communicate with the BAM run-time environment.

To complete these tasks, perform the following steps:


1) On a Web browser, to access the BAM Adapter component in the WebLogic
Administration Server Web application, perform the following steps:
a) To access the WebLogic Server Administration Console, on a Web browser
window enter the URL http://localhost:7001/console.
Note: In the development environment configuration provided for your practices, b le
fer
the first time you access the WebLogic Server Administration Console after it has
a
ans
been started, it is normal to observe the “Deploying application for /console”
n - t r
message before the WebLogic Server 11g Administration Console login page is
displayed. For example: a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya SConsole d
tu login page, enter the Username:
@
b) On the WebLogic Server Administration
s
zu welcome1,
z
weblogic and Password:
e e thi and click Login.
p a y us
i l t o
u (sh nse
e z z lice
a y
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 284


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
c) On the WebLogic Server Administration Console home page, click on the
Deployments link in the Domain Structure pane.

d) On the Summary of Deployments page, on the Control Tab in the Deployments


table heading click the Next link (usually four times) to find the
OracleBamAdapter entry (when the entries “Showing 41 to 50 of 54” appears). b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s hilp sofeDeployments
e) On the(Summary to page, on the Control Tab in the Deployments
z z u
table, click e
the
c n
OracleBamAdapter link.
ye l i
i l p a
sh

2) To configure the OracleBamAdapter settings for your environment, use instructions


in the following table and associated images as a guide:
Step Screen/Page Description Choices or Values
a. Settings for Click the Configuration tab.
OracleBamAdapter >
Overview
b. Settings for Click the Outbound Connection Pools sub-tab.
OracleBamAdapter >
Configuration

Oracle SOA Suite 11g: Build Composite Applications 285


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
Step Screen/Page Description Choices or Values
c. Outbound Connection Pool Expand the
Configuration Table oracle.bam.adapter.adc.SOAPConnectionFactory
entry, and click the eis/bam/soap link.
d. Outbound Connection Set the following Property Value entries, by
Properties clicking in the Property Value cell, entering the
value shown, and ensure you press Enter after
typing each value:
Hostname: localhost
Password: welcome1
PortNumber: 9001
UserName: weblogic
b le
Click Save.
fer a
e. Save Deployment Plan Path: D:\oracle\fmw\11.1.1.1
an s
Assistant \Oracle_SOA1\soa\PlanBAMAdapter.xml
n - t r
BAMAdapter to Plan. a no
Note: Edit the file name in the path by appending

Click OK. ) has ideฺ


ฺ c
Note: If you require help to complete the steps listedoinmthe ttable,
G uuse the following
screenshots as guide: h o o e n
ya Stu d
a)
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh b)

Oracle SOA Suite 11g: Build Composite Applications 286


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
c)

d)
b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye)e li
i l p a
sh

3) After getting the confirmation that your deployment plan has been successfully
created, to check that the soa_server1 is the target specified for the new
deployment plan, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 287


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
a) On the Settings for oracle.bam.adapter.adc.soap.SOAPConnectionFactory page,
click the Targets tab.

b) On the Settings for oracle.bam.adapter.adc.soap.SOAConnectionFactory Targets


b le
fer
tabbed page, ensure that the soa_server1 option is selected in the Servers table, a
and click Save.
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh c) Confirm that a Messages response page displays that all changes have been
activated and updated successfully.

4) To restart your OracleBamAdapter after updating its deployment so that the run-time
environment activates the changes, perform the following steps:
a) Click the Deployments link in the Domain Structure pane.

Oracle SOA Suite 11g: Build Composite Applications 288


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
b) On the Summary of Deployments page, in the Deployments table, click the Next
link (about four times) until you see the OracleBamAdapter entry.

c) To stop the OracleBamAdapter component, on the Deployments Summary page,


in the Deployments table select the checkbox next to the OracleBamAdapter entry
and click Stop > Force Stop Now.

b le
fer a
ans
n - t r
a no
d) On the Summary of Deployments page, in the Deployments
) h as table,e ฺ click the Next

c o m Guidentry.
link (about four times) until you see the OracleBamAdapter

h o oฺ ent
y a Stud
z z u@ this
a y e
e) To restart the OracleBamAdapters e component, on the Deployments Summary
lp
page, in the iDeployments u
o table select the checkbox next to the OracleBamAdapter
t“Servicing
(
entry ands hclick s e
Start > all requests”
z u e n
yez lic
i l p a
sh

f) Optionally, to confirm that the OracleBamAdapter Resource Adapter has started


successfully, by checking if the State column contains Active and the Health
column contains OK in the Summary of Deployment table, perform the following
steps:
i) On the Summary of Deployments page, in the Deployments table, click the
Next link (about four times) until you see the OracleBamAdapter entry.

Oracle SOA Suite 11g: Build Composite Applications 289


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-1: Configure the BAM Adapter in WebLogic
Administration Server (continued)
ii) On the Deployments Summary page, in the Deployments table, confirm that
the OracleBamAdapter Resource Adapter State column contains Active and
the Health column contains OK.

5) On the WebLogic Administration Server Console page, click the Log Out link, and
close the Web browser page or window. b le
fer a
an s
n - t r
a no
6) You can close the Web browser page with the WebLogic
) as Administration
hServer e ฺ
Console or enter the URL http://localhost:7001/emm
o to access i d
uOracle Enterprise
Manager. o ฺ c n t G
h o d e
@ ya Stu
z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 290


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection
In this practice, you start the BAM Server so that you can import the BAM Data Object
and BAM Report (Dashboard) by running a command line script that uses the
icommand utility to import the structures from XML file definitions into the BAM
Server. In the POApplication workspace Application Resources section, you create a
BAM Connection that is required to browse for BAM Data Objects when configuring the
BAM Adapter in the composite application and the BAM Sensor Actions in BPEL
Process components.

Note: To import the BAM Data Object and BAM Report (Dashboard) definitions into the
BAM Server, you use a script called D:\labs\files\bam\import_tobam.bat
to execute the BAM ICommand command line tool. e
a b l
To complete these tasks, perform the following steps: s fer
- t r an
Start the BAM Server
n on
a
In this section you start the BAM Server instance.
) h as eฺ
1) To start the BAM Server instance, which is neededm
o id Connection,
to create a BAM
u
perform the following steps: c
oฺ ent G
h o
a) On the Desktop, double-click thea
y “Start BAM
S t udServer.bat” icon.
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye Note: Wait li until the BAM Server is started. This could take from three to several
ilp a minutes depending on the resources on your machine. Wait until you see a line in
sh the BAM Server window containing text similar to the following:

<Sep 1, 2009 11:20:55 PM MST> <Notice>


<WebLogicServer> <BEA-000360> <Server started in
RUNNING mode>
b) When you are satisfied that the BAM Server is running, minimize the BAM
Server window.

Import BAM Definitions into the BAM Server


In this section, you execute the command line script to import a supplied BAM Data
Object definition, and a BAM Dashboard (report) into the BAM Server. You take this
opportunity to use the Oracle BAM Web interface to view the definitions created.
2) To create the Orders BAM Data Control Object and the PO Order Report
BAM Dashboard definition in the BAM Server, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 291


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
a) On the desktop, double-click the Command Prompt icon.

b) In the Command Prompt window, execute the following commands:

D:\> cd D:\labs\files\bam
D:\> import_tobam.bat
Enter Password: welcome1

Note: The import_tobam.bat script executes the BAM ICommand b le


command line with the –username weblogic command line parameter. The fer a
ans
n - t r
password (welcome1) must be entered at the prompt as shown in the text here.
However, the password is not echoed in the command window.
a no
) hasand
Use the following screenshot as a guide to the commands
i d e ฺ results you
output
can expect:
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: The colors of the command prompt window may be different from what
you have on your system. The colors were reversed to capture the above
screenshot.
c) In the command window, you can observe that a Data Object called Orders is
created in a BAM Server folder called /Training/POProcessing, and that
a Report (a Dashboard), called PO Order Report is created in a folder called
/public/Report/Training/POProcessing.
d) Close the command prompt window.

Oracle SOA Suite 11g: Build Composite Applications 292


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
View BAM Definitions in the BAM Web Applications
In this section, you use Internet Explorer to connect to the BAM Web application
interface. You use the BAM Architect component to view the Orders Data Object
definition, and you use the BAM Active Studio component to view the “PO Orders
Report” definition.
3) To login to the Oracle BAM Web interface, perform the following steps:
a) Open a new Internet Explorer Web browser page, and enter the URL
http://localhost:9001/OracleBAM.
b) On the Oracle BAM Login page, enter the Username: weblogic and Password:
welcome1, and click Go.
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
c) The Oracle BAMy z
e page sdisplays
start e buttons for four BAM components:
a u
( s hilp se to
z z u cen
ye li
i l p a
sh

Components are:
i) By using the Active Viewer you can view and run real-time reports.
ii) By using the Active Studio you can create, edit, and delete reports.
iii) By using the Architect you can create and manage Data Objects and their data
caches.
iv) By using the Administrator you can do BAM Server administration tasks.
Note: You use all except the Administrator tool.

Oracle SOA Suite 11g: Build Composite Applications 293


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
4) Optionally, you might wish to change the link and pop-up window handling in
Internet Explorer, otherwise clicking the BAM component buttons create new
Internet Explorer windows. To enable Internet Explorer to use Tab pages in the
current window, perform the following steps:
a) On Internet Explorer, click Tools > Internet Options.
b) In the Internet Options dialog box, click Settings in the Tabs section:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

c) In the Tab Browsing Settings dialog box, make the following changes:
i) Select the “Always switch to new tabs when they are created” option (the
third option, from the top of the window)

Oracle SOA Suite 11g: Build Composite Applications 294


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
ii) In the “When a pop-up is encountered” section, select the “Always open pop-
ups in a new tab” option.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
iii) Click h
s ilp e to
OK.
(
u and view s Orders Data Control definition, perform the following steps:
nthe
5) To z z
locate
li c e
a ya)e On the Oracle BAM start page, click Architect.
sh ilp Note: If you altered the Tab Browsing Settings window options, then the
Architect opens a new tab page, otherwise Internet Explorer opens it in a new
window. This would be the same for the other tools as well.

Oracle SOA Suite 11g: Build Composite Applications 295


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
b) On the Oracle BAM Architect page, in the Folders pane, expand the Training
folder and click the POProcessing folder link.

b le
fer a
ans
n - t r
a no
c) On the Oracle BAM Architect page, under the Folders pane in the Data Objects
pane click the Orders link.
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 296


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
d) On the Oracle BAM Architect Orders data object General information page,
observe the description and zero row count indicating there is no data in the data
object. Click the Layout link.

b le
fer a
ans
n - t r
a no
e) On the Oracle BAM Architect Orders data object )Layout haspage, i d e ฺ can view (and
you
ฺ c om
edit) the data object structure. In this case, you view the
t G u
structure made of various
columns for information about order data.
h o o Someeofnthe Tip Text columns provide
a brief explanation for data itemsy a Stnot
that may udbe intuitive. To view the contents
click the Contents link. u@ is
e z z t h
a y u s e
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 297


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
f) On the Oracle BAM Architect Orders data object Contents page, you can
normally view any data received by the BAM Server for this data object. At this
stage the contents are empty.

g) Do not close this Architect page, because you return to this page later in this
lesson’s practice to view values written to this data object by the POProcessing
composite application, after you make the necessary modifications.
b le
6) To locate and view the PO Orders Report Dashboard definition, perform the f er a
an s
following steps:
- t r
a) Return to the Oracle BAM start page, in either a separate Webn on window or
browser
another Web browser tab page. Click Active Studio. s a
) a
h ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
b) z z
On uthe Oraclec e n
BAM Active Studio page, to locate the public (shared) report that
e l i
i lpa y has been designed to monitor the Orders data object information, click the Shared
Reports tab.
s h

c) On the Oracle BAM Active Studio Shared Reports page, use the following steps
to navigate to the Training/POProcessing folder containing the report:
i) On the right-hand pane, double-click the Training entry.

Oracle SOA Suite 11g: Build Composite Applications 298


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
ii) On the right-hand pane, double-click the POProcessing entry.

Note: Above the right-hand pane, there is pull-down menu that can be used to
navigate up through the folder structure you are in.
d) On the Oracle BAM Active Studio Shared Reports page, to view the design of the b le
report (also called a dashboard), double-click the PO Orders Report entry, fer a
in the Report Name column. ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 299


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
e) On the Oracle BAM Active Studio Shared Reports page, the POProcessing Orders
report is opened. In this page, you can create, modify, and delete components in
the report structure. In this case, you just view the structure shown in the
following image, and explained briefly in the text appearing after the image:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
ureport page
h isuse the Orders data object as the source of
Note: All sections of z the
e (insreal-time)
e t
data for results a
p y
displayed u by the report when viewed in the Active
l
i Studio.
hdata
View or Active o
t All charts and data are updated dynamically with the
changes
u ( sto n s
as e
it arrives. The POProcessing Orders report has the following
z z li c e
a ye three sections:
i l p i) The top section contains an updating list of order rows, which is sorted by
sh ascending Order ID, and updated as the data is feed into the Orders data object
is populated with data.
ii) The bottom-left pane displays a three-dimensional pie-chart showing the total
sales, percentage of sales by payment type, order paid by credit or by using
PayPal.
iii) The bottom-right pane displays a three-dimensional bar-chart showing the
status of orders and the number of orders with a given status.
f) On the Oracle BAM Active Studio Shared Reports page, close the PO Orders
Report tabbed page, or Web browser window containing the page.

Note: Instead of viewing the dashboard in the Active Studio, you use the Active
Viewer to view the run-time display of this report at an appropriate time.

Oracle SOA Suite 11g: Build Composite Applications 300


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
Create a JDeveloper BAM Connection as an Application Resource
In this section, you create a JDeveloper BAM Connection in the POApplication
Application Resources section. This BAM connection is needed for the BAM Adapter
and BAM Sensor Action that you create in the subsequent practices for this lesson.
7) To create a BAM Connection as an Application Resource in the POApplication
workspace, perform the following steps:
a) In the JDeveloper window, ensure that the POProcessing application name is
selected in the Application Navigator window.
b) In the JDeveloper Application Navigator, click the Application Resources pane
(below the POApplication Projects pane):
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
lp Connection
c) To create a iBAM
h Resources,toright-click
on the JDeveloper Application Navigator >
( s
Application
u n s e Connections, and select New Connection >
z
BAM. lic e
a yez
i l p
sh

8) To configure the BAM Connection, on the BAM Connection Wizard window use
instructions in the following table and the associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Name Connection Name: BAMServerConnection1
Accept the default name, and click Next.
b. Connection BAM Web Host: localhost
BAM Server Host: localhost
HTTP Port: 9001
JNDI Port: 9001
Username: weblogic
Password: welcome1
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 301


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
Step Screen/Page Description Choices or Values
c. Test Connection Click Test Connection, and verify you get a
Success Status, and click Finish.
a)

b le
fer a
ans
n - t r
a no
b)
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 302


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-2: Create BAM Objects and a JDeveloper BAM
Connection (continued)
c)

b le
fer a
ans
n - t r
no
9) In the Application Navigator, under the Application Resources pane, verify that new
a
section under the BAM node. ) has ideฺ
BAM Server connection (BAMServerConnection1) is listed in the Connections

ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

10) Do not close the main Oracle BAM Internet Explorer page, because you will return to
this page and start the Active Viewer application when ready to see the results of the
POProcessing composite application sending data to Oracle BAM.

Oracle SOA Suite 11g: Build Composite Applications 303


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
In this practice, you define the BAM service adapter, which contains the parameters
needed to communicate with BAM. You create a wire from the EnrichPO Mediator
component to the BAM Adapter and configure the transformation for the Routing Rule it
creates to send the correct order data to the BAM Adapter service.

You also modify the Routing Rule between the RoutePO and EnrichPO Mediator
components to obtain the next order ID from the ORDER_SEQ in the SOADEMO schema
in the Oracle Database server instance, and delete the Assign activity in Fulfillment that
performs the same task.

Note: The reason why you obtain the order ID from the database sequence earlier in the
process is that you use the order ID for the unique order ID to be stored in the BAM Data
Control Object that receives the data sent to the BAM Server through the BAM Adapter. b le
This enables the BPEL Sensor to send updates to the same order to modify the fer a
appropriate in memory information maintained by the BAM Server, enabling the BAM ans
dashboard to dynamically track changes to the order status in real-time. n - t r
a no
To complete these tasks, perform the following steps:
) has ideฺ
1) In the JDeveloper window, if the POProcessing o
c m Gu file is not open
composite.xml
ฺ t Navigator, expand the
then ensure the POApplication is selectedoinothe Application
n
h
a folder e
uddouble-click composite.xml.
y
POProcessing project and SOA Content
S tand

z z u@ this
Modify the POProcessing
a y e Composite
s e Assembly Model
u
( s h lp the
In this section, you iadd
e to Adapter and wire the EnrichPO Mediator component to
BAM

z z u cens
the BAM Adapter.
li
2) yInethe POProcessing composite.xml window, drag the BAM Adapter component
a
ilp from the Component Palette (under Service Adapters) into the External References
sh column in JDeveloper.

Note: The drag action causes the Adapter Configuration Wizard to be displayed.

Oracle SOA Suite 11g: Build Composite Applications 304


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
3) To configure the BAM Adapter in the Adapter Configuration Wizard, use instructions
in the following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Welcome Click Next.
b. Service Name Service Name: OrdersBAMAdapter
Click Next.
c. Data Object Operation and Keys Next to the Data Object field, click Browse.
d. BAM Data Object Chooser Expand the BAMServerConnection1 >
Training > POProcessing folders, select
Orders and click OK.
Note: If the BAM Connection has not been
created as an Application Resource, and you do
b le
fer
not see the connection. It can be created by a
clicking the BAM Connection icon ( ). ans
e. Data Object Operation and Keys Data Object: n - t r
a no
/Training/POProcessing/Orders
has ideฺ
Operation: Upsert
)
ฺ c om t Gu
Operation Name: writetoBAM (the default)
Selected: _Order_ID (This is the key field
h o o e n
ya Stu d
copied from the Available section)

z @
u this Select the Enable Batching option.
e z Click Next.
f. JNDI Name pay u se JNDI Name: eis/bam/soap
( s hil se to Click Next.
g. z u cen
Finish
z Click Finish.
ya)e li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 305


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
b)

b le
c) fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh d)

Oracle SOA Suite 11g: Build Composite Applications 306


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
e)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
Note: The Upsert operationz @
u insertsthaisrow to the Data Object, if doesn’t exist
otherwise it updatesy z
ethe DatasObject
e row based upon the specified key. The
a u
s hilp soption
Enable Batching
server (unavailable. e toallows messages to be captured even when the BAM
When the BAM server becomes available, messages
z z u while
generated c e nthe server was down are sent.
ye l i
i l p a f)
sh

Oracle SOA Suite 11g: Build Composite Applications 307


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
g)

4) In the composite.xml window, confirm the presence of the OrdersBAMAdapter b le


icon in the External References column. fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 308


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
5) Drag a wire from the EnrichPO Mediator component right-hand edge to the
OrdersBAMAdapter component, and verify that your POProcessing assembly model
resembles the following change:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
6) Save the changes to the POProcessing project.

Send Initial Order Data to the BAM Adapter


In this section, you modify the transformation file for the routing rule between the
RoutePO Mediator and the EnrichPO Mediator components to obtain a new order ID
from the Oracle Database sequence. Obtaining the order ID earlier in the application (in
the initial transformation) means that:
• An Assign activity in the Fulfillment BPEL Process, which performs the same
function, can be deleted.
• The order ID, which is used by BAM as a key to uniquely identify each Data
Object, can easily track changes to the order throughout the POProcessing
composite application.

Oracle SOA Suite 11g: Build Composite Applications 309


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
You also configure a transformation on the routing rule (created by the wire) between the
EnrichPO Mediator and OrdersBAMAdapter components to send the initial order data to
the Orders BAM Data Object.
7) To obtain the order ID in the transformation between the RoutePO and EnrichPO
Mediator components perform the following steps:
a) In the Application Navigator, under the POProcessing > SOA Content folder
expand the xsl folder, right -click PurchaseOrder_To_order.xsl and
select Open. Alternatively, double-click PurchaseOrder_To_order.xsl.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@
u this
b) In the PurchaseOrder_To_order.xsl
z window, select and delete the line
mapping the ID element
y z
e in the esource column to the orderId in the target column.
a u s
h i lp
The image shows right-clicking
t o the line and clicking Delete.
u (s nse
e z z l i c e
a y
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 310


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
c) With the PurchaseOrder_To_order.xsl window active, on the
Component Palette in the Advanced selection click the Database Functions pane
group, and drag the sequence-next-val function into the middle column.

b le
fer a
Note: Ensure that you drop the sequence-next-val function in a blank ans
space and not on an existing line. n - t r
n o
d) In the PurchaseOrder_To_order.xsl window, drag a
s the right-hand edge
handle of the sequence-next-val function onto h a
) uide
the orderIdฺ in the target
column. Use the following image as a guide.o m
o o ฺc nt G
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

e) To edit the parameters of the sequence-next-val function, double-click the


sequence-next-val function icon in the middle column.

f) In the “Edit Function - sequence-next-val” window, enter the following case-


sensitive values (including the single-quotes):
sequence: 'ORDER_SEQ'

Oracle SOA Suite 11g: Build Composite Applications 311


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
datasource: 'jdbc/soademo'
Click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
ya Stu window, verify that your mappings
@
g) In the PurchaseOrder_To_order.xsl
zu this
y z
match the followingeimage:
e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

h) Save the changes to the PurchaseOrder_To_order.xsl file, and close the


PurchaseOrder_To_order.xsl window.
8) To delete the Assign activity that also obtains an order ID from the database
sequence, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 312


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
a) In the POProcessing composite.xml window, right-click the Fulfillment
BPEL Process component icon and select Edit. Alternatively, double-click the
Fulfillment BPEL Process component icon.

b) In the Fulfillment.bpel Design window, near the start of the BPEL process
flow, expand the Scope_insertorder activity (which is inside the b le
Switch_initialstatus activity). Use the following image as a guide: fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
u cen
Inzthe Fulfillment.bpel
c)ez
y li Design window, inside the Scope_insertorder
i l p a activity, right-click the Assign_orderid activity and click Delete.
sh

Oracle SOA Suite 11g: Build Composite Applications 313


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
d) In the Confirm Delete dialog box, click Yes.

e) In the Fulfillment.bpel Design window, verify that Scope_insertorder


activity (inside the <otherwise> branch) has only two activities: The
Transform_order and CreateEntity_order activities. Use the following image as a
guide:
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

f) Save the changes to the Fulfillment BPEL Process and the POProcessing
composite project.
g) Close the Fulfillment.bpel window.
9) To send the appropriate order data to the BAM Adapter, edit the EnrichPO Mediator
component and create a transformation for the routing rule with the
“OrdersBAMAdapter::writetoBAM” target operation, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 314


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
a) In the composite.xml window, right-click the EnrichPO Mediator component
icon and click Edit.

b) In the EnrichPO.mplan window, locate the routing rule (most likely the last
one in the list) with the “OrdersBAMAdapter::writetoBAM” target operation, and b le
fer a
click the “Select an existing mapper file or create a new one.” icon ( s
) next to
an
Transform Using field.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u Map h s box, select the Create New Mapper
idialog
c) In the Request Transformation
z t
e defaultsefile name provided and click OK.
File option, accepta ythe u
h i lp t o
u (s nse
e z z l i c e
a y
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 315


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
d) On the order_To__Orders2Collection.xsl window create the mapping
shown in the following image, and use the instructions below the image that
describe the specific element and functions to map.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u in the
To create the mapping shown h s image, use the following table of basic
iabove
z t
e as yoursguide:
e
a y
one-to-one mappings
u
hilp se to (mapped to) XSLT File: OrdersBAMAdapter.wsdl
Source:sEnrichPO.wsdl
(
z z u cen
customerId _Customer_ID
ye orderId l i _Order_ID
i l p a payMethod _Payment_Type
sh shipMethod _Shipping_Choice
Status _Status

For the remaining mappings (qty and itemTotal) perform the following steps:
i) In the source column, expand the items > item nodes.
ii) Drag a sum Mathematical Function into the middle column, and map the qty
source element to the left-side of the sum function, and map the right-side of
the sum function to the _Item_Count element in the target column.
iii) Drag another sum Mathematical Function into the middle column, and map
the itemTotal source element to the left-side of the sum function, and map
the right-side of the sum function to the _Order_Total element in the
target column.
iv) Save the mapping changes to the
order_To__Orders2Collection.xsl file, and close the
order_To__Orders2Collection.xsl window.

Oracle SOA Suite 11g: Build Composite Applications 316


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-3: Create and Use a BAM Adapter in POProcessing
(continued)
e) In the EnrichPO.mplan window, verify that the Transform Using field is
populated with the name of the new XSL file, and save the changes to the
POProcessing project.

f) Close the EnrichPO.mplan window.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 317


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard
In this practice, you test the addition of the BAM Adapter and wire to the POProcessing
composite application and ensure that the Enrich Mediator component sends the order
data through the BAM Adapter to the BAM server. Your tasks are:
• Deploying the POProcessing composite application to the SOA Server
• Initiating a test of the POProcessing composite application by using Oracle
Enterprise Manager, while viewing the BAM Dashboard in the Active Viewer to
display the order status and sales information.
To complete these tasks, perform the following steps:

Deploy the POProcesssing Composite Application


1) To deploy the modified POProcessing project, perform the following steps:
b le
a) In the Application Navigator, right-click the POProcessing project name, and fer
a
select Deploy > POProcessing > to soaserver. a n s
n t r
-any
n o
b) In the SOA Deployment Configuration Dialog, select the “Overwrite existing
a
composites with the same revision ID.” option, and clicksOK.
c) In the Deployment – Log window, confirm thatm ) ha uidwas
deployment eฺsuccessful. You
ฺ co nt G
can ignore the three warning messages displayed.
o
a h o de
y t u
z u@ his S
a y ez se t
i lp t o u
h
(s nse
z z u c e
y e l i
i l p a
sh Open PO Order Report in the BAM Active Viewer
In this section, you must use Internet Explorer to run BAM Web applications, which
should still be open from earlier steps in this lesson practices. You return to BAM start
page and open the BAM Active Viewer and open the PO Order Report dashboard to
monitor the business activity information sent to the BAM Server when a test instance is
created in Oracle Enterprise Manager.
Note: You may wish to perform this all in Internet Explorer tab windows, or separate
windows.
2) In the Internet Explorer window, to open the PO Orders Report in the Active
Viewer, perform the following steps:
Note: If you do not have Oracle BAM open in Internet Explorer, then enter the URL
http://localhost:9001/OracleBAM in Internet Explorer and login with Username:
weblogic and Password: welcome1.

Oracle SOA Suite 11g: Build Composite Applications 318


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
a) On the Oracle BAM start page, click Active Viewer to browse for and view
reports.

b) On the Oracle BAM Active Viewer page, click Select Report.

b le
fer a
a n s
c) In the “Select a Report – Webpage Dialog,” in the Look In pull-downn r
-tmenu,
select Shared Reports, to navigate to the Shared n o
a
Reports/Training/POProcessing folder, double-click
) h as eฺthe Training
folder, then the POProcessing folder, then m
o select the PO
u idOrders Report
entry and click OK. c
oฺ ent G
h o
a Stud
y
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 319


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
d) On the Oracle BAM Active Viewer page, the POProcessing Orders report
is opened and displayed. Initially, since there is no data in the Orders Data Object
that provides information for this report there is no data to view.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a Active
yBAM d
tuViewer page, because you return to
Note: Do not close this Oracle @
u asthyou s S
i begin to initiate order processing by
this window to monitor
e z zactivity
y composite
initiating POProcessing
a u e
s application tests in Oracle Enterprise Manager.
l p
i et o
Initiate auTest(shof the
ns POProcessing Composite Application
z z c e
esection youli initiate a test instance of the POProcessing composite application and
In this
a y
sh ilpview the results in real-time in the BAM Active Viewer.
Note: For the best results to make the best of your screen space consider resizing the
BAM Active Viewer window so that you can see the Active Viewer most of the time
while initiating and running tests in Oracle Enterprise Manager.
3) On another Web browser window or tabbed page, if you do not have Oracle
Enterprise Manager open, enter the URL http://localhost:7001/em and login with the
Username: weblogic and Password: welcome1.
4) On the Oracle Enterprise Manager home page, to initiate a test to process an order
perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 320


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
a) On the Farm_soa_domain pane, expand the SOA folder and the soa-infra entry,
and click the “POProcessing [1.0]” link.

b le
fer a
ans
b) On the “POProcessing [1.0]” page, click Test > ReceivePO.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y z
e you created
e a second entry point (exposed service) for the
Note: Remember a that
u s
POProcessing
s h ilpcomposite
e to to enable Fulfillment to be initiated when a StockUpdate
event (
u occurs. ns is page.
This why you now have two entry points to test from the
z z li
POProcessingc e home
a ye
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 321


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
5) On the “POProcessing [1.0]” Test Web Service page, scroll down to the Request tab
Input Arguments section, with the XML View mode selected replace the supplied
XML text with the contents of the file D:\labs\files\xml_in\po-medium-
guitar.xml, and click Test Web Service.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
u patient
Note:zBe
z c e n the process is initiated, this may take a couple of minutes.
while
ye l i
i l p a
6) On the Web browser page, wait for the Response tab page to be refreshed with the
sh Launch Message Flow Trace link displayed.

Oracle SOA Suite 11g: Build Composite Applications 322


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
7) With Internet Explorer, click on the tab window or separate window containing the
Oracle BAM Active Viewer, to see the report (dashboard) contents being updated as
the order is submitted for processing, and the EnrichPO sends the initial order
information to the BAM Adapter. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
uyou take h itosclick the BAM Active Viewer window you
Note: Depending on howzlong t
eupdatedsase it arrives or after it has already arrived. The
a
might see the data beingy u
h
following changesi lpin BAMtoActive Viewer report are displayed:
( s
u“General s e
n Information” pane contains a row for the order just
a) z z
The
l i c eOrder
a ye processed. You can confirm that the values reflect the data you used in the test.
i l p
sh b) The “Total Sales by Payment Type” pane is updated to contain the single order
indicating that 100% of the orders have been paid by credit, including the order
total as well.
c) The “Count of Orders by Status” pane is also updated to show a bar height of one
for an order status of initial.
8) On the Oracle Enterprise Manager “POProcessing [1.0]” Response tab page, wait
about ten seconds before you click the Launch Message Flow Trace link to view the
Flow Trace.

Oracle SOA Suite 11g: Build Composite Applications 323


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
9) Using the “POProcessing [1.0]” Flow Trace tree and the BAM Active Viewer results
answer the following questions:
a) What is the final status of the order when the POProcessing instance completed?
Hint: Click the Fulfillment BPEL Component link in the Trace tree, and expand
the <payload> for the callbackClient activity.
Note: There are other places to view the same information.
b) On the BAM Active Viewer page, why is the order status still being displayed as
initial?
A Answers for Step 9.
a. The final order status is changed to completed. If you clicked the Fulfillment link on
the Flow Trace Tree as shown in the following image: e
a b l
s fer
- t r an
no n
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
Note: If the process Flow
y z
e Tracestree
e does not resemble the above image, wait a few
a
ilp theepage u
seconds and refresh
few times.(sh
to before you continue. You may need to refresh the page a
z z u cens
li of Fulfillment” Audit Trail page, scroll down to the last activity
e the “Instance
yOn
i l p a (callbackClient) in the flow and expand the <payload> you can view the final status of
sh the order.

b. The BAM Active Viewer continues to display the order status as initial because the
POProcessing composite application has not sent additional messages to the BAM Server
to indicate the changes to the order have been made. Therefore, the data in Orders Data
Object in the BAM Server has not been modified since the initial data was sent by the
EnrichPO Mediator activity.

Oracle SOA Suite 11g: Build Composite Applications 324


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
10) On the Internet Explorer page, return to the window or tab page that contains the
BAM Architect where you are displaying the contents of the Order Data Object and
view the order information that is stored in the Data Object cache.
Note: Click the Refresh link or the Contents link again to update the page contents.
The Contents page for the Orders Data Object should display the order information
received by BAM from the EnrichPO Mediator component. Use the following image
as a guide:

b le
fer a
ans
n - t r
a no
Note: If you do not have the Order Data Object Contents
) h as displayed,
page
eฺ you can
access this page by performing the following steps:m
o t Gu i d
a) On the Oracle BAM start page, click o o ฺ c
Architect. n
h d e
a Stupane expand the Training folder
b) On the BAM Architect page, inythe Folders
z
and then click POProcessing
@
u tfolder.
h is
y e z e
a u s
c) On the BAM
h i lp
Architect
t page
o under the Folders pane click the Orders link in the
(s pane.
Data Objects
u n se
z e
lic pane displaying the General page for the Orders Data Object,
a yd)ezOn the right-hand
click the Contents link.
i l p
sh 11) Optionally, before you close the Oracle BAM Architect you might notice there is an
Edit Contents button. If you click Edit Contents you are able to modify the data in the
Orders Data Object and view the change reflected in the Active Viewer. If you make
a change then reinstate the original values supplied. For example, you might want to
modify the Payment Type value from credit to paypal.
Note: If you changed this value please reset it to the value credit before you close
the Architect page.
12) Close the Oracle BAM Architect window.

Oracle SOA Suite 11g: Build Composite Applications 325


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
13) On the “POProcessing [1.0]” Test Web Service page, click the Request tab to process
another order, this time with the paypal payment option, by performing the
following steps:

a) On “POProcessing [1.0]” Test Web Service Request page, the scroll down Input
Arguments section, with the XML View mode selected replace the existing XML
text with the contents of the file D:\labs\files\xml_in\po-small-
ipod.xml, and make the following changes to the data before you click Test
Web Service.
b le
i) Change the custID value to 1 fer a
ans
ii) Change the payOption value to paypal (in lowercase text)
n - t r
no
iii) Change the shipChoice to next_day (in lowercase text)
a
Use the following image as a guide: ) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 326


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-4: Test the BAM Adapter and View the BAM
Dashboard (continued)
14) After successfully submitting a new order to the POProcessing application, return to
Internet Explorer where the BAM Active Viewer window is still running the
POProcessing Orders report and monitor the changes that occur (in real-time). Use
the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y z
e the following
e changes to the POProcessing Orders report
Note: You should notice
a u s
page:
( s hilp se to
z
a) The
z u“Generalc e n Information” pane now contains an additional row (two
Order
l i
ye rows) for the orders being monitored.
i l p a
sh b) The “Total Sales by Payment Type” pane is updated to contain the fact that over
94% of the orders have been paid by credit and approximately 5% of the
orders have been paid by using paypal.
c) The “Count of Orders by Status” pane is updated to show a bar height of two for
the two orders that have the initial status.

Oracle SOA Suite 11g: Build Composite Applications 327


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
In this practice, you create a BPEL variable sensor for the outputVariable in the
ApproveCCOrder BPEL process, and another one for the inputVariable in the Fulfillment
BPEL process. These variable sensors are designed to monitor changes to the order status
by sending changes to the order information in those variables to the BAM Server by
through a BAM Sensor Action. In addition, you create a composite sensor on the
ReceivePO exposed service and a BPEL activity sensor on the Fulfillment callbackClient
activity. Both of these additional sensors make use of a Database Sensor action for
storing information in the SOA database tables, whose data can be viewed in the Flow
Trace page for composite and component instance pages in Oracle Enterprise Manager.

To complete these tasks, perform the following steps:


1) In the JDeveloper window, the POProcessing composite.xml should already be
b le
open in a window. If it is not open then on the Application Navigator, double-click
fer a
the composite.xml under the POApplication > SOA Content folder.
ans
n - t r
no
Create a Variable Sensor in ApproveCCOrder BPEL Process
a
a s
Before you can create a BAM Sensor Action you first create a BPEL variable sensor with
h ideฺ
)
which the BAM Sensor action is associated. In this section you create the variable sensor
for the outputVariable in the ApproveCCOrder process.
ฺ c om t Gu
o o e n
Note: Remember you use the outputVariable to maintain order data in this BPEL process.
h d
a Stuthe ApproveCCOrder BPEL Process
ydouble-click
2) In the composite.xml window, @
component icon, to open z inu
it z a BPELth is window.
Editor
a y e s e
i lp
3) To create and configure the
t o u
variable sensor on the process outputVariable, use
instructions h
(sin the nfollowing
se table and associated screenshots:
z u e
z
Step eScreen/Page
y lic Description Choices or Values
sh ilpaa. ApproveCCOrder.bpel Click the Variables icon ( ) on the main
ApproveCCOrder process scope.
b. Variables Select the outputVariable in the Variables table, and
click the Edit icon ( ).
c. Edit Variable –
outputVariable Click the Sensors tab, and click the Add icon ( ).
d. Create Variable Sensor Name: VariableSensor_outputVariable
Target: Click the Variable XPath Builder icon ( ).
e. Variable XPath Builder Expand the Process > Variables folder, select
outputVariable and click OK.
f. Create Variable Sensor Click OK.
Note: The Sensor Action is not created yet.

Oracle SOA Suite 11g: Build Composite Applications 328


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
a)

b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
c)
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 329


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
d)

b le
fer a
ans
n - t r
a no
) h as eฺ
e)
c o m Guid
h o oฺ ent
y a Stud
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 330


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
f)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om dialog
Note: Although you should not see the following
t G u the “Edit Sensor
box,

h o o if you
Action error” message window is displayed
e nattempt to create a BAM
ya Stu
Sensor Action from Create Variable Sensor d
window.
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh 4) To save the variable sensor created for the ouputVariable, perform the following
remaining steps:
a) In the Edit Variable – ouputVariable window, click OK.

Oracle SOA Suite 11g: Build Composite Applications 331


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
b) In the Variables window, click OK.

b le
fer a
5) Save the changes to the ApproveCCOrder BPEL process window. ans
n - t r
noProcess
Create a BAM Sensor Action in ApproveCCOrder BPEL
a
a s
h ideฺ
In this section, you use the Sensor Actions folder in the JDeveloper Structure window for
)
the ApproveCCOrder BPEL process to create the BAM Sensor Action that is associated
with the VariableSensor_outputVariable. ฺ c om t Gu
h o o e n
6) To create a BAM Sensor Action forythea Stu d
VariableSensor_outputVariable variable
@ his
sensor, perform the followingusteps:
z
e z e t
a y u s
a) Ensure that the ApproveCCOrder.bpel Diagram window is selected and
displayed.hilp t o
( s
u JDeveloper s e
n window, locate the Structure pane window in the bottom left
b) Inzthe
z l i c e
a ye corner, you must first click the Sensor Actions folder, and then right-click the
il p Sensor Actions folder to select Create > BAM Sensor Action.
sh

Oracle SOA Suite 11g: Build Composite Applications 332


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
7) To configure the BAM Sensor Action use instructions in the following table and
associated images as a guide:
Step Screen/Page Choices or Values
Description
a. Create Sensor Action Name: SensorAction_orderstobam
Action Sensor: VariableSensor_outputVariable
Data Object: Click the Browse Data Objects icon ( ).
b. BAM Data Expand BAMServerConnection1 > Training > POProcessing,
Object Chooser select Orders and click OK.
c. Create Sensor Data Object: /Training/POProcessing/Orders
Action Under BAM Operation and Keys section:
Operation: Upsert b le
Selected Keys: _Order_ID (copied from the Available Keys fer a
section) ans
BAM Connection Factory JNDI: eis/bam/soap n - t r
a no
Note: Please set the BAM Connection Factory JNDI string
has ideฺ
before clicking the Create Mapping icon for the Map File. In
)
Map File enter:
ฺ c om t Gu
h o o e n
bam\SensorAction_approveccorder_to_bam.xsl
y a Stu ( ).
Click the Create Mapping d
icon
a)
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 333


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
b)

b le
fer a
ans
n - t r
no
c) Note: The Enable Batching option is selected by default.
a
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 334


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
8) In the SensorAction_approveccorder_to_bam.xsl window, create
mappings from SensorActionSensorAction_1.xsd elements to the XSLT
File: Orders.wsdl elements, using the following image as a guide.
Note: The order data is contained in the payload > variableData element in the
sources. You can use instructions that appear after this image to create the mappings:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
In the SensorAction_approveccorder_to_bam.xsl window, in the
Source column expand the actionData > payload > variableData > data > order >
items > item elements to reveal all the fields to be mapped to elements in the
_Orders2Collection > _Orders2 in the target as described in the following table:
Map Source: actionData > payload Target: _Orders2Collection > _Orders2
> variableData > data > order
a. customerId _Customer_ID
b. orderId _Orders_ID
c. payMethod _Payment_Type
d. shipMethod _Shipping_Choice
e. orderTotal _Order_Total
f. Status _Status
g. Item > qty To sum function in the middle column,
whose result is mapped to the
_Item_Count

Oracle SOA Suite 11g: Build Composite Applications 335


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)

9) Optionally, in the Application Navigator, if you expand the SOA Content > bam >
Training folder you can see the SensorAction XSL file and related JCA Adapter
configuration files added to the project.

Note: The project folder now contains the SensorActionData.xsd and


SensorActionSensorAction_1.xsd files. b le
fer a
an s
n - t r
10) Save the changes to the SensorAction_approveccorder_to_bam.xsl and
a no
the ApproveCCorder.bpel files.
) has ideฺ
11) Close the SensorAction_approveccorder_to_bam.xsl
c o m Gu and the
ApproveCCorder.bpel windows.
o o ฺ n t
h ud e
Create a Variable Sensor u in@
ya StBPEL
Fulfillment Process
z h i s
t process by creating another variable
In this section, you edit thee
y z
Fulfillment eBPEL
a s
u sensor for the inputVariable with a BAM Sensor
sensor. This time you
h i lpcreate atovariable
(s in ansimilar
Action configured
u seXSLway as performed in previous steps. However, there is less
mapping
ez z
to be done
lic e
in the file.
y
sh ilpa12) In the composite.xml window, double-click the Fulfillment BPEL Process
component icon, to open it in a BPEL Editor window.

Oracle SOA Suite 11g: Build Composite Applications 336


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
13) To create and configure the variable sensor on the process outputVariable, use the
following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
Use instructions in the following table to createฺ c omsettings
the t G u
shown:
h o o e n
Step Screen/Page Description Choices ya or S tu
Valuesd
Fulfillment.bpel u@ s
a.
e z z Click
e ththeiscope.
process
Variables icon ( ) on the main Fulfillment

Variables ilpa
y usSelect the inputVariable in the Variables table, and
b.
t o
u (sh nse click the Edit icon ( ).
z
c. eEditz Variable
li c e

a y inputVariable Click the Sensors tab, and click the Add icon ( ).
il p
sh d. Create Variable Sensor Name: VariableSensor_inputVariable
Target: Click the Variable XPath Builder icon ( ).
e. Variable XPath Builder Expand the Process > Variables folder, select
inputVariable and click OK.

Oracle SOA Suite 11g: Build Composite Applications 337


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
Step Screen/Page Description Choices or Values
f. Create Variable Sensor Click OK.
Note: The Sensor Action is not created yet.
g. Edit Variable – Click OK.
inputVariable
h. Variables Click OK.
14) Save the changes to the Fulfillment.bpel file.

Create a BAM Sensor Action in Fulfillment BPEL Process


In this section, you create the BAM Sensor Action to send changes to order status in the
inputVariable (which contains order data) to the BAM Server.
15) To create a BAM Sensor Action for the VariableSensor_inputVariable variable b le
sensor, perform the following steps: fer a
a n s
a) In the Fulfillment BPEL Structure pane, click the Sensor Actions folder
n -t r
b) In the Fulfillment BPEL Structure pane, with the Sensor Actions
o
n folder selected,
a
) has idAction.
right-click Sensor Actions and select Create > BAM Sensor
e ฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u window,
h isuse the following table to set the fields as
c) In the Create Sensor Action
z
e screenshott
e shown after this table as a guide:
described, and usea ythe u s
s
Field Name
( hilp se Valueto
z z u Name
Action c e n SensorAction_orderstatus_to_bam
e l i
i lpa y SensorData Object
VariableSensor_inputVariable
/Training/POProcessing/Orders
s h
Note: Click the Browse Data Object icon ( ) to select this
data object.
Operation Upsert
Selected Keys: _Order_ID
Note: This value is copied from the Available Keys.
BAM Connection eis/bam/soap
Factory JNDI Note: Ensure you change this value before you create the
Map file.
Map File bam\SensorAction_fulfillorder_to_bam.xsl
Click the Create Mapping icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 338


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
Note: The Enable Batching option is selected by default.

Oracle SOA Suite 11g: Build Composite Applications 339


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
16) In the SensorAction_fulfillorder_to_bam.xsl window, create
mappings for the SensorActionSensorAction_1.xsd elements to the XSLT
File: Orders.wsdl elements, using the following image as a guide.
Note: The order data is contained in the payload > variableData element in the
sources. You can use instructions that appear after this image to create the mappings

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z u cen
In thezSensorAction_fulfillorder_to_bam.xsl window, in the Source
y e
column l
expand
i the actionData > payload > variableData > data > FulfillmentRequest
i l p a elements to reveal all the fields to be mapped to elements in the _Orders2Collection >
sh _Orders2 in the target as described in the following steps:
a) Map the orderId element from the source column to the _Order_ID element
in the target column.
b) Map the status element from the source column to the _Status element in
the target column.

Create an Assign to Update the Orders Status


In this section, you create an Assign activity to ensure the status element in the
inputVariable is updated to reflect the order stats changes that can monitored by the BAM
Server by using the BAM Sensor Action you associated with the inputVariable variable
sensor.
Note: Presently, the BPEL process updates the order status in the outputVariable, which
does not hold the orderId information. Therefore, it is not a suitable variable for the
sensor information.

Oracle SOA Suite 11g: Build Composite Applications 340


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
17) To store the final order status in the inputVariable create an Assign activity with an
appropriate copy operation by performing the following steps:
a) In the Fulfillment.bpel Design window, drag an Assign activity just before
the last activity in the process, that is, before the callbackClient Invoke activity at
the end of the process. Rename the Assign activity to Assign_finalstatus.
Use the following image as a guide:

b le
fer a
an s
n - t r
a no
s ฺ
htheaAssign
b) In the Fulfillment.bpel Design window, edit
m ) i d eactivity and create
o tvalue
a copy operation that assigns the shipStatuscelement
ฺ u
G from the
outputVariable to the status element in
h o e n
othe inputVariable. Use the following
image as a guide: y a t u d
u @ i s S
z
ez se t h
a y u
h i lp t o
u (s nse
e z z l i c e
a y
i l p
sh

Note: Expand the outputVariable and inputVariable trees as needed.


18) Save the changes to the Fulfillment BPEL process window. Do not close the window.

Oracle SOA Suite 11g: Build Composite Applications 341


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
Create an Activity Sensor in the Fulfillment BPEL Process
In this section, you create an activity sensor, which uses a Database sensor action, on the
callbackClient activity in the Fulfillment BPEL process.
19) To create an activity sensor for the callbackClient activity, use instructions in the
following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Fulfillment.bpel Right-click the callbackClient activity and select
Edit.
b. Invoke Click the Sensors tab.
c. Invoke > Sensors Click the Create icon ( ).
d. Create Activity Sensor Name:
b le
ActivitySensor_fulfillment_callback
fer a
Evaluation Time: Activation
an s
t r
Under the Activity Variable Sensors section, click the
n -
Create icon ( ).
a no
e. Create Activity Variable
Sensor has ideฺ
Variable XPath: Click the Variable XPath Builder
)
f. Variable XPath Builder
icon ( ).
ฺ c om t Gu
Expand Process > Variables > ouputVariable >
h o o e n
d
payload, select the FulfillmentResponse element and
ya Stu
click OK.
@
g. Create Activity Variablez z u this
Observe that all fields are populated with the
Sensor a y e s e
selection made in the Variable XPath Builder and
u
( s hilp se to click OK.
a) zzu c e n
ye l i
il p a
sh

b)

Oracle SOA Suite 11g: Build Composite Applications 342


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
c)

b le
d) fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

e)

Oracle SOA Suite 11g: Build Composite Applications 343


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
f)

b le
fer a
an s
n - t r
a no
has ideฺ
g)
)
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a20) In the Create Activity Sensor window, which should still be open, to create configure
sh the Sensor Action for the callbackClient activity sensor, use instructions in the
following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Create Activity Sensor Under the Sensor Actions section, click the Add
icon ( ).
b. Sensor Action Chooser First select the Sensor Actions folder, then right-
click Sensor Actions and select Create > Sensor
Action.
c. Create Sensor Action Name: SensorAction_to_database
Publish Type: Database
Accept all other settings, and click OK.
d. Sensor Action Chooser Ensure the newly created
SensorAction_to_database entry is
selected, and click OK.
e. Create Activity Sensor Verify that the sensor settings are as instructed to
configure from previous steps and click OK.

Oracle SOA Suite 11g: Build Composite Applications 344


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
Step Screen/Page Description Choices or Values
f. Invoke > Sensors Click OK.
a)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
b) zzu c e n
ye l i
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 345


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
c)

b le
fer a
ans
d) n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 346


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
e)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
f) y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 347


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
21) Optionally, in the Fulfillment.bpel – Structure pane, you can click the Refresh
icon and collapse all entries except the Sensor Actions, Sensor > Activity, and Sensor
> Variable folders to confirm you have configured the two sensor actions and sensors
shown in the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
ya Stuentry does not appear, try clicking
Note: If the ActivitySensor_fulfillment_callback
z @
u this
the refresh icon ( ) on the
y e z “Fulfillment.bpel
e – Structure” window toolbar.
22) Save the changes i l p t o us
toathe Fulfillment.bpel process file and close the
h
(s nsewindow.
Fulfillment.bpel
z z u c e
e l i
y a Composite Sensor for the ReceivePO Exposed Service
Create
sh ilpa
In this section, finally create a composite sensor, which can only use a database sensor
action. This sensor uses an XPath expression to track the payment type used for each
order received by the composite application.
23) If the POProcessing composite.xml file is not already open, on the Application
Navigator, under the POProcessing project folder, double-click the
composite.xml file.
24) To create the composite sensor for the ReceivePO exposed service, use instructions in
the following table and associated images as a guide:
Step Screen/Page Description Choices or Values
a. composite.xml Right-click the ReceivePO exposed service
icon, and click Composite Sensors.
b. Composite Sensors: ReceivePO Click the “Create new Composite Sensor” icon
( ).

Oracle SOA Suite 11g: Build Composite Applications 348


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
Step Screen/Page Description Choices or Values
c. Create Composite Sensor Name: CompositeSensor_receivepo
In the Service Configuration section:
Service: ReceivePO
Operation: execute
In Expression: Click the “Define expression”
icon ( ) and click Variables.
d. Select XPath Expression Expand the in > request > PurchaseOrder
folder, select payOption and click OK.
e. Create Composite Sensor Confirm your settings are as designed, observe
that the Composite Sensor Actions section
specifies DBSensorAction as the only option b le
(it cannot be changed), and click OK. fer a
f. Composite Sensors: ReceivePO Click OK. ans
n - t r
a)
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
b)ez
zu licen
a y
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 349


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
d) a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 350


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-5: Create BPEL Sensors to Use a BAM Sensor Action
(continued)
e)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
f)
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
25) In the composite.xml window, verify that the sensor icon appears in the
ReceivePO exposed service icon. Use the following image as a guide:

26) Save the changes to the POProcessing composite.xml file and project.

Oracle SOA Suite 11g: Build Composite Applications 351


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard
In this practice, you deploy the modified POProcessing composite application with all the
Sensors added in the previous practices. You initiate instances of the POProcessing
application with different test data, use the BAM Active Viewer to monitor business
process activity, and use Oracle Enterprise Manager to view database sensors
information.

To complete these tasks, perform the following steps:

Deploy the POProcesssing Composite Application


1) To deploy the modified POProcessing project, perform the following steps:
a) In the Application Navigator, right-click the POProcessing project name, and b le
select Deploy > POProcessing > to soaserver. fer a
ans
t r
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
n -
no
composites with the same revision ID.” option, and click OK.
a
can ignore the three warning messages displayed. ) h
as was
c) In the Deployment – Log window, confirm that deployment
e ฺsuccessful. You

c o m Guid
h o oฺ ent
y a Stud
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye
d) Close theliJDeveloper application.
i l p a
sh Initiate a Test of the POProcessing Composite Application
In this section you initiate an instance of the POProcessing composite application using
the Test Web Service page and view the results in real time in the BAM Active Viewer.
2) On another Web browser window or tabbed page, if you do not have Oracle
Enterprise Manager open, enter the URL http://localhost:7001/em and login with the
Username: weblogic and Password: welcome1.
3) On the Oracle Enterprise Manager home page, to initiate a test to process an order
perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 352


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
a) On the Farm_soa_domain pane, expand the SOA folder and the soa-infra entry,
and click the “POProcessing [1.0]” link.

b le
fer a
ans
b) On the “POProcessing [1.0]” page, click Test > ReceivePO.
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@
zuTest Web h is Request page, the scroll down Input
c) On “POProcessing e z
[1.0]” t Service
e View mode selected replace the existing XML
a
Arguments section,
p y with u
the s
XML
s
text with
( hilcontents
the e tofothe file D:\labs\files\xml_in\po-large-
s click Test Web Service.
z z u cenand
guitar.xml,
ye li
i l p a d) On the Web browser page, wait for the Response tab page to be refreshed with the
sh Launch Message Flow Trace link displayed.

Oracle SOA Suite 11g: Build Composite Applications 353


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
e) On the Web browser page, click the window or tabbed page containing the BAM
Active View to view the changes.
Note: The BAM Active Viewer dashboard is either updated while you view the
page or it may have already been updated. Use the following image as a guide to
the results:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
lp
hiobserve tofollowing changes in the BAM Active Viewer:
( s
You should
u cens e the
z z
a ye i) In theliGeneral Order Information section, a new order row is added as the last
row in the table, with the initial status 5,200.00 as the Order Total.
i l p
sh ii) In the “Total Sales by Payment Type” section, percentages should have
changed based on an increase in the number of credit card payments.
iii) In the “Count of Orders by Status” section, the bar size representing the
number of orders with an initial status is increased to a value of three.
f) To the access Worklist application and reject the order, which is waiting for
human intervention, perform the following steps:
i) On a new Web browser page, enter the URL:
http://localhost:8001/integration/worklistapp.

Oracle SOA Suite 11g: Build Composite Applications 354


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
ii) On the Worklist application login page, enter the Username: jcooper and
Password: welcome1, and click Login.

iii) On the BPM Worklist My Tasks tab page, click the new task appearing in the
Inbox, and from the Actions menu, click Actions > Reject.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
o
iv) On the Information page, click OK.
h o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a v) Do not log out from the Worklist application, and do not close the Worklist
sh application window or tabbed page.

Oracle SOA Suite 11g: Build Composite Applications 355


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
g) Return to the Web browser window or tabbed page containing the BAM Active
Viewer, to watch or observe the changes to the dashboard.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
@ is in the BAM Active Viewer:
u thchanges
You should observe thezfollowing
y e z e section, in the last row in the table has its
i) In the Generala u s
Order Information
status
s ilp eto tthe
hmodified o value rejected.
( nsSales by Payment Type” section, there is no change.
ii)zu
z c e
In the i“Total
ye l
i l p a iii) In the “Count of Orders by Status” section, an additional bar is created for the
sh rejected status with a size of one, and the bar with the initial status
has a size of two.
4) On the Web browser window or tabbed page containing the Oracle Enterprise
Manager Test Web Service Response page, to resubmit the same order and this time
approve the order in the Worklist application, by performing the following steps:
a) Oracle Enterprise Manager Test Web Service Response page, click the Request
tab.

Oracle SOA Suite 11g: Build Composite Applications 356


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
b) On “POProcessing [1.0]” Test Web Service Request page, the Input Arguments
section should already be containing the XML text with the contents from the file
D:\labs\files\xml_in\po-large-guitar.xml (if not ensure you
replace it accordingly), and click Test Web Service.
c) On the Web browser page, wait for the Response tab page to be refreshed with the
Launch Message Flow Trace link displayed.
d) Return to the Web browser page containing the BAM Active Viewer, to watch or
observe the changes to the dashboard.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
You should observe the following changes in the BAM Active Viewer:
i) In the General Order Information section, a new row is added as the last row
in the table with the status value initial.
ii) In the “Total Sales by Payment Type” section, there is an increase in the
percentage and total values for the credit section of the pie-chart.
iii) In the “Count of Orders by Status” section, the bar with the initial status
has its size increase to three. The rejected status bar size is still a value of
one.
e) Return to the BPM Worklist My Tasks tab page click the Refresh icon (next to the
Actions menu).

Oracle SOA Suite 11g: Build Composite Applications 357


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
f) On the BPM Worklist My Tasks tab page, select the new task assignment added
to the Inbox. In the task details display pane below the task assignment entry,
click Approve.

g) On the BPM Worklist, click the Logout link and close the BPM Worklist Web
page.
b le
fer a
ans
n - t r
a no
h a s theฺ BAM Active
h) Return to the Web browser window or tabbed page containing
) uide
Viewer, to watch or observe the changes to the dashboard.
m
o
ฺc nt G
o o
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
i l p a
sh

You should observe the following changes in the BAM Active Viewer:
i) In the General Order Information section, a new row is added as the last row
in the table with the status value approved.
ii) In the “Total Sales by Payment Type” section, there is no change.
iii) In the “Count of Orders by Status” section, a new bar with a size of one is
added for the approved status. The bar with initial status is decreased
to a size of two. The bar with the rejected status remains a size of one.

Oracle SOA Suite 11g: Build Composite Applications 358


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
i) Remain watching BAM Active Viewer page, to observe the changes to the
dashboard. The order submitted has sufficient stock to fulfill and complete the
order. The BAM Active Viewer page should be updated to reflect this change.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
yaobserveSthe d
tu following changes in the BAM
@
Within a minute or so youushould s
Active Viewer: e z z
e thi
p a y us
i l
i) In the General
hcompleted.Order
t o Information section, the last row status updated with the
( s
u cens
value e
z z
a ye ii) In theli“Total Sales by Payment Type” section, there is no change.
i l p iii) In the “Count of Orders by Status” section, a new bar is added with a size of
sh one for the completed status. The bar with the approved status is
removed. The bar with the initial status remains a size of two, and the bar
with the rejected status remains a size of one.

Viewing Sensor Information in the Database


In this section, you open the process Flow Trace page to view sensor information written
to the Database Sensor Actions.
5) To view the database sensor information generated by Composite Sensor perform the
following steps:

Oracle SOA Suite 11g: Build Composite Applications 359


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
a) Return to the Web browser page, containing the Oracle Enterprise Manager Test
Web Service Response tab page, and click the Launch Message Flow Trace link.

b) On the “POProcessing [1.0]” Flow Trace page, click the “Show this panel” icon
next to the Sensors heading to expand that section.
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh c) On the “POProcessing [1.0]” Flow Trace page, under the expanded Sensors
section, a row for the composite instance appears. In the Value column click the
“View XML” link.

Oracle SOA Suite 11g: Build Composite Applications 360


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
d) In the “XML Viewer – CompositeSensor_receivepo” window, you can view the
data stored in the database by the composite sensor created on the ReceivePO
exposed service. In this case, the payOption element value is credit. Click
Close to close the XML Viewer window.

6) To view the activity sensor information published to the Database Sensor Action for
the Fulfillment BPEL process callbackClient activity, perform the following steps:
a) On the “POProcessing [1.0]” Flow Trace page, in the Trace tree, click the b le
Fulfillment BPEL Component link. fer a
ans
Note: If the process Flow Trace tree does not resemble the supplied image, wait
n - t r
several seconds and click the refresh icon at the top-right of the page before you
no
continue. Clicking the refresh icon may be required more than once to view the
a
complete Flow Trace.
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

b) On the “Instance of Fulfillment” page, click the Sensor Values tab link.

Oracle SOA Suite 11g: Build Composite Applications 361


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
c) On the “Instance of Fulfillment” Sensor Values page, if needed expand the
Activity Sensors section. The ActivitySensor_fulfillment_callback should appear
as an entry. Click the ActivitySensor_fulfillment_callback entry and scroll down
to the bottom of the page and to access the XML data that was stored click the
More link in the Sensor Values entry.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
s h ilp e to
d) In the
u ( ns you can view the sensor data and confirm that the
Details window,
z z c e
a ye shipStatusli contains the text completed, and carrier contains the text UPS.
Close the Details window.
i l p
sh
e) Close the Details window and the Flow Trace window.

Create an Order with a Waiting Status


In this section, you initiate another process instance to create an order whose status is set
to waiting due to the out-of-stock results returned for the product ordered, the
popular Gibson Les Paul guitar. You use the BAM Active Viewer to observe the changes
to the BAM Report, and then use the AddStockToStore composite to enable the order to
be fulfilled and watch the changes in the BAM Active Viewer again.

Oracle SOA Suite 11g: Build Composite Applications 362


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
7) To initiate another order that waits for fulfillment due to an out-of-stock condition
returned from both the internal and online stores, you check that the product with
PROD_ID=SKU106 has a zero quantity in the internal and online store database
tables. You can use the Run SQL Command Line application or JDeveloper to
perform this task. The Run SQL Command Line application instructions are shown
first followed by the JDeveloper instructions.
Note: There is no requirement to use both tools and it is recommended to keep
JDeveloper closed to conserve memory for all WebLogic Admin Server, SOA Server,
and BAM Server instances.
a) To do this task with the Run SQL Command Line application, perform the
following steps:
i) On the windows desktop, click Start > Programs > Oracle Database 10g b le
Express Edition > Run SQL Command Line.
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 363


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
ii) In the Run SQL Command Line window, enter the following commands at the
SQL> prompt:

SQL> connect soademo/soademo


SQL> @d:\labs\files\sql\gibson_query.sql

b le
Note: The result should display a zero value in the ONLINE or INTERNAL f er a
an s
columns for the row with PROD_ID=SKU106. (Refer to the JDeveloper
- t r
instructions for a screenshot of the data values). If the ONLINE
n onand
a
INTERNAL columns do not have a zero value for thesPROD_ID=SKU106
then enter the following command at the SQL> ) a
h ideฺ
prompt:

ฺ c om t Gu
h o o
SQL> @d:\labs\files\sql\gibson_update.sql
e n
ya Stu d
iii) Optionally execute the @d:\labs\files\sql\gibson_query.sql
@ is been stored in the in the ONLINE or
u valuethhas
again to confirm thezzero
INTERNALacolumns y z
e forsthee row with PROD_ID=SKU106.
i u
lpRun SQLtoCommand
iv) Close h
(s nse
the Line window.
b)ez
u
z not performc e this step if you have performed the instructions in step a).
y Do l i
i l p a Alternatively, to check the quantity for product ID SKU106 in JDeveloper
sh perform the following steps:
i) Open the JDeveloper application by double-clicking the JDeveloper desktop
icon.
ii) In the JDeveloper window, select the files application workspace, expand
the files > Application Sources > sql folder and open the
gibson_query.sql file.

Oracle SOA Suite 11g: Build Composite Applications 364


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
iii) In the gibson_query.sql window, click the Execute Statement icon to
confirm that the internal and online stores have zero stock for the Gibson Les
Paul with product ID SKU106. Use the following image as a guide:

b le
fer a
ans
Note: If the numbers in the ONLINE or INTERNAL columns (or both) are not
n - t r
a no
displayed as numbers then close the gibson_query.sql window, and
reopen the gibson_query.sql file using one of the other two soademo
connections provided.
) has ideฺ
c o m Gu
If the ONLINE and INTERNAL columns
o ฺ
o stilledo n tnot have a value of zero for
the PROD_ID=SKU106 then y h
aperformSttheudfollowing steps:
z u@Navigator,
(1) In the Application
z t h is under the files > Application Sources >
y
sql folder,
a e open the
s egibson_update.sql file.
u
( s
(2)hInilpthesgibson_update.sql
e to window, click the Run Script icon.
z u n
z (3)licInethe Select Connection window, use the
y e
i l p a soademo(POApplication) connection and click OK.
sh iv) Close the gibson_update.sql and gibson_query.sql windows.
v) Close JDeveloper, because it is no longer required.
c) Return to the Web browser page, containing the Oracle Enterprise Manager Test
Web Service Response tab page, and click the Request tab.

Oracle SOA Suite 11g: Build Composite Applications 365


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
d) On “POProcessing [1.0]” Test Web Service Request page, in the Input Arguments
section replace any XML text with the contents from the file
D:\labs\files\xml_in\po-gibson-only.xml, and click Test Web
Service.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
p a u s
hilpo-gibson-only.xml,
Note: (Insthe s e to the payOption element is set to paypal,
z u e n
yez
shipChoice
licis set to next_day, and there is only one item containing the
productId SKU106, with a quantity of 1.
i l p a
sh e) On the Web browser page, wait for the Response tab page to be refreshed with the
Launch Message Flow Trace link displayed. Then you can view the BAM Active
Viewer changes.

Oracle SOA Suite 11g: Build Composite Applications 366


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
f) Return to the Web browser window or tabbed page containing the BAM Active
Viewer, to watch or observe the changes to the dashboard.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z echanges in the BAM Active Viewer:
a u s
s h ilp e to
You can observe the following
i) u ( nsOrder Information section, a new row for the paypal order is
In the General
z z c e
a ye addedlias the last row in the table with the status value initial.
i l p ii) In the “Total Sales by Payment Type” section, there is an increase in the
sh percentage and total values for the paypal section of the pie-chart and a
corresponding change to the credit section of the pie-chart.
iii) In the “Count of Orders by Status” section, the bar with the initial status
has increased its size to three. The bars with the rejected and completed
status retain a size value of one.

Oracle SOA Suite 11g: Build Composite Applications 367


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
g) Remain watching the BAM Active Viewer and after a short while you can
observe the order status change to waiting as the process evaluates and acts on
the out-of-stock results from the internal and online stores. Use the
following image as a guide to the changes that become visible:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
Inzthe
z n Viewer, the following changes can be observed:
u BAMceActive
ye l i
i l p a i) In the General Order Information section, the last row containing the paypal
sh order has its Status column changed to waiting.
ii) In the “Total Sales by Payment Type” section, no changes are made.
iii) In the “Count of Orders by Status” section, the bar with the initial status
has reduced its size to two. The bars with the rejected and completed
status retain a size value of one, and a new bar is added for the waiting
status with a size of one.
8) Now, you initiate an instance of the AddStockToStore composite application to
increase the number of Gibson Les Paul guitar (product ID: SKU106) by one in the
internal store. Therefore, the StockUpdate event is sent to the FulfillWaitingPO
instance, which invokes the Fulfillment BPEL process in the POProcessing composite
application to complete the order. Again, after initiating the AddStockToStore
process you observe the changes to the order taking place in the BAM Active Viewer.

Oracle SOA Suite 11g: Build Composite Applications 368


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
To add a quantity of one for the product ID SKU106 to the internal store, perform the
following steps:
a) On the Oracle Enterprise Manager page in the Farm_soa_domain pane, expand
the SOA and soa-infra folders, and click the “AddStockToStore [1.0]” link.

b) On the “AddStockToStore [1.0]” page, click Test. b le


fer a
ans
n - t r
a no
) has ideฺ
ฺ c othemTreepage,
c) On the “AddStockToStore [1.0]” Test Web Service
t G uscroll down to the
h o o
Request tab Input Arguments section. Retain
e n View mode and enter the
following values:
y a Stud
z z u@ this
Note: Values enter are case-sensitive!
store:
aye o use
internal
productID: ilpSKU106
amount:( s h 1 se t
z z u cen
ye Click li Web Service.
Test
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 369


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 17-6: View Order Status Changes in the BAM
Dashboard (continued)
d) On the “AddStockToStore [1.0]” Test Web Service page, wait for the Response
tab containing the Launch Message Flow Trace link to be displayed.

e) Return to the Web browser window or tabbed page containing the BAM Active
Viewer to wait, and watch or observe the changes to the dashboard.
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

In the BAM Active Viewer, the following changes can be observed:


i) In the General Order Information section, the last row containing the paypal
order has its Status column changed to completed.
ii) In the “Total Sales by Payment Type” section, no changes are made.
iii) In the “Count of Orders by Status” section, the bar with the initial status
remains at a size of two. The bar with the rejected status remains a size
value of one. The bar for the waiting status has been removed, and the bar
with the completed status has its size increased to a value of two.
Note: You have come to the end of these practices. Well done!

Oracle SOA Suite 11g: Build Composite Applications 370


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

You might also like