Oracle SOA Activity Guide Vol1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 372

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 I •d
u e Guide
Activity
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
'

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 1 ......................................................................................................... 2


Practice 1-1: Start JDeveloper and Create a Database Connection ................................ 3
Practice 1-2: Create an Application Server Connection ................................................. 5
Practice 1-3: Set JDeveloper Preferences ....................................................................... 8
Practice 1-4: Create a WSIL Connection...................................................................... 12
Practices for Lesson 2 ....................................................................................................... 15
Practice 2-1: Examine Purchase Order XML Schema.................................................. 16
Practice 2-2: Examine soademo Database Tables and Data....................................... 19
Practices for Lesson 3 ....................................................................................................... 20 b l e
Practice 3-1: Create the POProcessing Composite ....................................................... 21 fer a
Practice 3-2: Add a Transformation to the Mediator Component ................................ 38 an s
Practice 3-3: Deploy and Test the POProcessing Composite Application ................... 43 n - t r
no
Practices for Lesson 4 ....................................................................................................... 51
a
) has ideฺ
Practice 4-1: Modify the POProcessing File Adapter to use a Logical Name.............. 52
Practice 4-2: Generate and Validate a Configuration Plan ........................................... 59
ฺ c om t Gu
Practice 4-3: Test a Composite Deployed with a Configuration Plan .......................... 62
h o o e n
Practices for Lesson 5 ....................................................................................................... 68
ya Stu d
Practice 5-1: Create the CreditCardValidation SOA Project........................................ 69
z @
u this
Practice 5-2: Create a Database Adapter to Query Credit Cards .................................. 78
y e z e
a u s
Practice 5-3: Deploy and Test the CreditCardValidation Composite........................... 91

( s hilp se to
Practices for Lesson 6 ....................................................................................................... 93
Practice 6-1: Restructure the POProcessing Assembly Model ..................................... 94
z z u cen
li
Practice 6-2: Calculate Order Totals with XSL Transformations................................. 99
ye
i l p a
Practice 6-3: Test the Modified POProcessing Application ....................................... 107
sh Practices for Lesson 7 ..................................................................................................... 111
Practice 7-1: Add BPEL Components to the POProcessing Assembly Model .......... 112
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules........................... 121
Practice 7-3: Design the initial ApproveCCOrder BPEL Process .............................. 126
Practice 7-4: Design the initial Fulfillment BPEL Process......................................... 143
Practice 7-5: Deploy and Test POProcessing with BPEL Components ..................... 150
Practices for Lesson 8 ..................................................................................................... 158
Part 1 ........................................................................................................................... 161
Practice 8-1: Create the CreditCardValidation External Reference ........................... 161
Practice 8-2: Invoke Credit Card Validation from ApproveCCOrder ........................ 165
Part 2 ........................................................................................................................... 180
Practice 8-3: Invoke the Fulfillment Process from ApproveCCOrder........................ 180
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL Process ....................... 189
Practice 8-5: Deploy and Test the POProcessing Composite Application ................. 218
Practices for Lesson 9 ..................................................................................................... 230
Practice 9-1: Deploy ADF Application Projects as Services...................................... 232
Practice 9-2: Modify InternalStore with Pick and While Activities ........................... 238

iii
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity.......................................... 264
Practice 9-4: Deploy and Test InternalStore and OnlineStore Applications .............. 273
Practice 9-5: Add a Flow to the Fulfillment BPEL Process ....................................... 286
Practice 9-6: Deploy and Test POProcessing with Stock Checks .............................. 316
Practices for Lesson 10 ................................................................................................... 328
Practice 10-1: Modify CreditCardValidation Composite Assembly Model............... 330
Practice 10-2: Create the CheckCCLimit BPEL Implementation .............................. 341
Practice 10-3: Modify ApproveCCOrder BPEL to Handle Credit Exceptions .......... 354
Practice 10-4: Test CreditCardValidation and POProcessing Exceptions.................. 358

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

iv
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Information about XML Element Names in Practice Documentation
Consider the XML tree structure in the following image of JDeveloper’s XSLT Mapper:

In the sample image observe that each XML element (the tree nodes below the
b le
<sources> root) has an XML namespace prefix, such as “imp1:” in the image
fer a
example. The XML namespace prefix, which maps to an XML Namespace string, is:
ans
• Used to uniquely identify (qualify) each XML element
n - t r
no
• Generated dynamically by the JDeveloper tool that creates the XML structure.
a
has ideฺ
When you carry out the practice instructions in this document, dynamically generated
)
XML namespace prefixes for your XML elements may differ from those shown in the
screenshots of this document.
ฺ c om t Gu
o o e n
Note: Therefore, the practice instructions do not specify the XML namespace prefixes for
h
ya Stu d
XML elements that you work with, even though the screenshots related to those
@
u this
instructions contain XML namespace prefix values. The screenshots are provided as
z
e z e
sample and guide. Your job is to ensure that the XML element names and structures
y
a u s
( s hilp se to
created, mapped, or referenced are correct as documented, and not to be concerned about
different XML namespace values.
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 1


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 1

The goal of this practice is to configure your JDeveloper development environment


connections to match the run-time environment requirements. Key tasks include:
• Creating a Database Connection for the SOADEMO database schema. This
connection is used by components, such as the Database Adapter, which access
database data.
• Creating an Application Server Connection to enable you to deploy SOA
composite applications and Web Service projects that you create in this course
• Creating a WSIL Connection to the application server that can be used to look up
WSDL URLs for SOA and Web services required by the purchase order
processing application
Note: The JDeveloper Browser and Proxy preference settings need to be modified
b le
before creating the WSIL connection.
fer a
s
• Setting JDeveloper preferences, such as disabling the HTTP Proxy setting in the
an
t r
Web Brower and Proxy JDeveloper preferences. This is done to avoid network
n -
classroom environments. a no
access problems as a result of network proxy configuration for Oracle University

) has ideฺ
mthis practice:
The following image depicts the connections createdoin
c G u
o o ฺ n t
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
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 2


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-1: Start JDeveloper and Create a Database
Connection
In this practice, you start JDeveloper and create a database connection. To complete this
task, perform the following steps:
1) On the Desktop, double-click the JDeveloper 11g desktop icon to start JDeveloper.
Note: The Oracle Database 10g Enterprise Edition server should already be running.
If you have connection problems, request for assistance from the instructor.
2) In the JDeveloper window, click the View > Resource Palette menu.

3) On the JDeveloper Resource Palette, click the New icon ( ) and select New
Connection > Database.

b le
fer a
an s
n - t r
a no
) has ideฺ
c
4) In the Database Connection dialog box, enter ฺthe
m Gdetails:
ofollowing u
oo den t
a) Use the IDE Connections option.ah
@ y S tu
u thi
b) Enter the following fieldzvalues: s
y e z e
a
Connection Name: u s
soademo
Username:hilp o
tsoademo
( s
u cens soademo
Password:
e
z z li
a ye Hostname:
Port:
localhost

sh ilp SID:
1521
XE
Note: The Connection Name value is case-sensitive!
c) Select the Save Password option, and accept the default values for the remaining
fields.
d) Click Test Connection to verify that you can successfully connect to the database,
and then click OK.

Oracle SOA Suite 11g: Build Composite Applications 3


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-1: Start JDeveloper and Create a Database
Connection (continued)
Note: 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 4


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-2: Create an Application Server Connection
In this practice, you create an Application Server connection for your SOA Server to
enable you to deploy SOA Composite application projects and other services. To
complete this task, perform the following steps:
1) Start the WebLogic Administration server by double-clicking the Start WebLogic
Admin Server icon on the desktop. Wait until the server is started. You can verify this
when you see the text similar to the following display in the terminal window:

<Jun 16, 2009 12:59:43 AM EDT> <Notice> <WebLogicServer> <BEA-


000360> <Server started in RUNNING mode>

2) Start the SOA Server (managed server) by double-clicking the Start SOA Server icon
on the desktop. Wait until the server is started. You can verify this when you see the
b le
text similar to the following display in the terminal window:
fer a
a n s
INFO: FabricProviderServlet.stateChanged SOA Platform-tis r
running and accepting requests n on
s a
a
h SOA
Note: You can ignore the warnings displayed in the command
) e ฺServer command
window. om t Gu i d
o ฺ c n ) > New Connection >
h o d e
Application Server. @ ya Stu
3) In the JDeveloper Resource Palette, click New icon (

z z u this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh
4) On the Create Application Server Connection wizard pages, enter the information
specified in the following table:
Step Screen/Page Description Choices or Values
a. Create Application Server On the Name and Type page enter:
Connection – Step 1 of 5 Connection Name: soaserver
Accept default for other items, and click Next.
b. Create Application Server On the Authentication page enter:
Connection – Step 2 of 5 Username: weblogic
Password: welcome1
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 5


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-2: Create an Application Server Connection
(continued)
Step Screen/Page Description Choices or Values
c. Create Application Server On the Configuration page enter:
Connection – Step 3 of 5 WLS Domain: soa_domain
Accept defaults for remaining fields, and click
Next.
d. Create Application Server On the Test page:
Connection – Step 4 of 5 Click Test Connection.
Ensure a success result is displayed for all eight
tests, and click Finish.
Note: If you require help to perform this task, refer to the following screenshots for
guidance to the steps described in the preceding table of instructions:
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 b)

Oracle SOA Suite 11g: Build Composite Applications 6


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-2: Create an Application Server Connection
(continued)
c)

b le
fer a
ans
n - t r
a no
d) ) 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 7


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-3: Set JDeveloper Preferences
In this practice, you set some JDeveloper preferences to ensure the settings are
compatible for the work being done in the Oracle University network environment. You
also learn about some other useful settings.
1) To open the JDeveloper Preferences, select Tools > Preferences from the menu.

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 8


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-3: Set JDeveloper Preferences (continued)
2) In the Preferences window, perform the following steps to alter the preferences
mentioned:
a) For the Environment preference settings, which is the first set of preferences
shown when you open the Preferences window, locate the Encoding preference
and select UTF-8 from the pull-down box. 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: The UTF-8 encoding setting is recommended for ADF-based JSF
applications that are generated for use in the Oracle SOA Worklist application to
display tasks for assignees in human workflow functionality.

Oracle SOA Suite 11g: Build Composite Applications 9


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-3: Set JDeveloper Preferences (continued)
b) In the Preferences window, expand the Code Editor preference (the sixth entry in
the navigation tree on the left pane), and click the Line Gutter node. In the Line
Gutter settings, select the Show line Numbers option. 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
Note: Show Line Numbers z @
u displaysh iasline number for each line of source code.
z
e toslocate t
e specific lines of code reported for compiler
a y
This is a useful preference
u
( s hilp various
errors and when
e todesign-time tools detect errors in your application code
z z u cens
or structures.

ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 10


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-3: Set JDeveloper Preferences (continued)
c) In the left navigation pane, scroll down and select the “Web Browser and Proxy”
entry. In the “Web Browser and Proxy” preferences, deselect the Use HTTP
Proxy Server check box. 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
p working u s
( s hilare
Note: If you
e to with these practices in a non-Oracle University
z u cethen
environment
z nsit is likely that you do not have to change this preference. It
li whether your corporate network proxy allows or denies access to
ye depends on
i l p a various external URLs in HTTP requests that are used by JDeveloper.
sh 3) In the Preferences window, click OK to apply the selected preference changes. Close
the Preferences window.

Oracle SOA Suite 11g: Build Composite Applications 11


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-4: Create a WSIL Connection
In this practice, you create a WSIL connection enabling you to look up Web Service and
SOA Composite application WSDL URLs from the run-time environment through a
WSIL service application predeployed with the installation of Oracle WebLogic Server.
Note: Before creating the WSIL connection, you should have disabled the Browser and
Proxy settings in JDeveloper Preferences as described in the practice titled “Set
JDeveloper Preferences."

To complete these tasks, perform the following steps:

1) In the JDeveloper Resource Palette window, click the New icon ( ) > New
Connection > WSIL.

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
2) On the u
z z c e n wizard pages, enter the information specified in the
WSIL Connection
e
yfollowing li
table:
a
ilpStep Screen/Page Choices or Values
sh Description
a. Welcome Click Next.
b. Connection Type Accept the default settings.
Click Next.
c. WSIL URL WSIL File:
http://localhost:8001/inspection.wsil
Click Next.
d. Authentication Username: weblogic
Password: welcome1
Click Next.
e. Finish Click Finish.
Note: Use the following screenshots if you require guidance through the steps
described in the preceding table of instructions:

Oracle SOA Suite 11g: Build Composite Applications 12


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-4: Create a WSIL Connection (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 c)

Oracle SOA Suite 11g: Build Composite Applications 13


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 1-4: Create a WSIL Connection (continued)
d)

b le
fer a
a n s
3) To confirm that the WSIL connection is operational, on the Resource Palette
n r
-ttwoexpand
the WSIL node and expand the WSILConnection1 entry. You should osee
nthe following
subfolders called: soa-infra and usermessagingserver, as shownain
image: ) 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 li
i lpay
s h

Oracle SOA Suite 11g: Build Composite Applications 14


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 2
The goal of this practice is to familiarize yourself with the customer order in the po.xsd
XML Schema, and the application internal representation of the order in the
internalorder.xsd. The XSD files are opened with the JDeveloper XML Schema
Editor to enable you to make some comparisons based on questions asked in the
practices.

The following images provide a partial visual representation of the po.xsd and
internalorder.xsd files:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya table d
tudata in the soademo database
In addition, you examine the CREDITCARDS
@ s S
schema used by the purchasez
e zu processing
order thi application.
a y e
usJDeveloper Database Navigator window, from which
i
h se
The following image l p t
representsothe
u (smodify,
you can browse, n and create database structures, as well as query and modify the
z z c e
ye contain:li
data they
a
sh ilp

Note: Familiarization with some of the data and data structures facilitates understanding
the application design and implementation tasks performed in subsequent practices.

Oracle SOA Suite 11g: Build Composite Applications 15


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 2-1: Examine Purchase Order XML Schema
In this practice, you open the po.xml supplied XML schema file using the XML
schema editor. This enables you to view the structure payload of information.
Note: For answers to the questions posed in this section refer to the table of answers at
the end of this practice.
1) In the JDeveloper window, select the File > Open menu and browse for and open the
D:\labs\files\files.jws file.
Note: If the Open Warning dialog box is displayed, at the “Do you want to migrate
these files?” prompt click Yes. In the Migration Status dialog box, click OK.
2) To examine the purchase order XML schema, perform the following steps:
a) In the JDeveloper Application Navigator, in files project expand the Application
Sources > xsd folders. le
a b
b) Double-click the po.xsd file to open the file in the XSD Editor.
s fer
t r
c) Expand the OrderItemType and answer the following question: What is the data
- an
type for the price element? n
no
a
d) Expand the PurchaseOrderType complex type and answer
questions: ) has thei d
following
e ฺ
ฺ com nelement?
i) What are the type and values for theopayOption t Gu
ii) What are the name and typeyof
horepeating
athe t u deelement?
uthe i s S
@internalorder.xsd,
3) To compare the po.xsdzwith
e z t h open both files and
answer the following y e
us files at the same time, JDeveloper allows you to
a questions:
i l p t o
u
rearrange (shXSDnwindows
Hints: To view
the
both XML schema
se side-by-side (horizontally) or one above the other
ez z
(vertically). Iflic
e
needed ask your instructor to demonstrate this capability.
a y
sh ilp a) Associate the first-level child elements of the PurchaseOrder element in the
po.xsd with their corresponding “order” elements in the
internalorder.xsd, and identify the differences in XML element names
and types (if any).
b) Expand the “items” element of the PurchaseOrder parent in the po.xsd, and the
corresponding “items” element of the “order” parent in the
internalorder.xsd, and describe the main differences.
c) Expand the OrderItemType complexType in the po.xsd and itemType
complexType in the internalorder.xsd and identify the differences in
XML element names and types.
d) Which element in the po.xsd is assigned the OrderItemType?
4) In JDeveloper, close the files application and remove from the IDE by performing
the following steps:

Oracle SOA Suite 11g: Build Composite Applications 16


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 2-1: Examine Purchase Order XML Schema (continued)
a) In the Application Navigator, click the Application Menu icon, and select Close
Application.

b) In the Confirm Close Application dialog box, accept the default “Close
application and remove it from IDE” option 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
5) In JDeveloper, close the
y z
epo.xsdseand internalorder.xsd windows.
i lp a o u
h
(s nse t
z z u c e
y e l i
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 17


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 2-1: Examine Purchase Order XML Schema (continued)
Practice 2-1: Answers
The following table has been added for reference to collate the answers for some of the
questions in the current practice:

Step Answers
2c) The OrderItem > price element type is xsd:decimal.
2d) i) The payOption element type is payOptionType, and is values are: credit or
paypal, as determined by the enumerated values defined by the type.
2d) ii) The repeating element name is “item” and its type is OrderItemType.
3a) The differences between the 1st level child elements of PurchaseOrder and
order elements are represented by the following table:
In po.xsd In internalorder.xsd
CustId customerId b le
ID orderId fer a
payOption, type:payOptionType payMethod, type:payMethodType an s
shipChoice, type:shipOptionType n - t
shipMethod, type: shipMethodtype
r
ccType and ccNumber, both string a no
creditCard, type:ccInfoType
types
) has ideฺ
ฺ c om t Gu
orderTotal
Note: The payOptionType values are the same as the payMethodType values
h o o e n
d
(as observed by the enumerated values in each schema). The same applies to
ya Stu
the shipChoiceType and the shipMethodType definitions. If a single
@
z z u this
company is sharing these XSD definitions one could rearrange XML
a y e s e
elements definitions to share a consistent type definitions.
u
3b) hilp se to
The “items” element in the internalorder.xsd contains the additional
( s
z z u cen
child called inStock.
ye li
Note: The inStock element is used to track if all items for a given order are in
i l p a stock (value = true) so that an order can be fulfilled. If any item in the order
sh is not in stock (value = false) then the whole order is place in a “waiting”
status until stock for the ordered items become available, in which case the
order is not fulfilled.
3c) The differences between type definition for the “item” elements are
represented in the following table:
In po.xsd OrderItemType In internalorder.xsd
itemType
Product_Id prodId
ProductName prodName
Quantity qty
itemTotal
Note: The itemTotal is used as a line item total that is used to simplify the
calculation of the orderTotal in the internalorder.xsd.
3d) The “item” child element of the items element in the PurchaseOrder.

Oracle SOA Suite 11g: Build Composite Applications 18


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 2-2: Examine soademo Database Tables and Data
In this practice, you use the soademo Database Connection to locate the database tables
and view supplied database data for customers, and credit cards. Feel free to explore
additional tables (if you have time).
1) In the JDeveloper window, click View > Database Navigator.
2) In the Database Navigator, click the Expand (+) icon next to the soademo
connection.
Note: This action also opens a SQL Worksheet in a window named soademo, in
which you can enter and execute SQL statements.
3) Examine the CREDITCARDS database table structure and sample data by performing
the following steps:
a) In the Database Navigator, click the Expand (+) icon next to the Tables node b le
fer a
b) Double-click the CREDITCARDS table. This expands the CREDITCARDS table
ans
entry and opens a tab page with a description of the columns.
n - t r
a no
c) On the CREDITCARDS page, click the Data subtab at the bottom of the window
to view the data in the table.
) 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) Close the CREDITCARDS page, and soademo page.
sh 4) In the Database Navigator, right-click the soademo connection name, and select
Disconnect

5) Click the Application Navigator tab, and optionally close the Database Navigator.

Oracle SOA Suite 11g: Build Composite Applications 19


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 3
The goal of this practice is to create your first simple SOA composite application, which
is the starting point for your course application. The initial POProcessing composite
application assembly model should appear as shown in the following screenshot:

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 20


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite
In this practice, you create the POProcessing composite application composed of a
Mediator component that routes the purchase order information to a file by using the File
Adapter service reference. To complete this task perform the following steps:
1) In the JDeveloper Application Navigator, click New Application.

Create an Empty Composite Application b le


fer a
2) To create the application workspace with an SOA Project containing an empty
an s
- t r
composite application, use instructions in the following table and accept default
n
no
values for all fields that are not specified in the “Choices or Values” column:
a
Step Screen/Page Choices or Values has ฺ
Description ) i d e
a. Create SOA Application Application ฺ c om POApplication
Name: t G u
h o o Template:
e n SOA Application
- Step 1 of 3 Application
ya Next. tu d
@ Click
s S
b. z
Create SOA Application
e zu Project
thi Name: POProcessing
- Step 2 of 3ay e
us Click Next.
i l p t o
c.
-u (sh3SOA
Create
Step of 3n
Application
s e Composite Template: Empty Composite
z z l i c e Click Finish.
a ye
Note: Use the following screenshots as a guide for the corresponding steps in the
i l p
sh table above.

Oracle SOA Suite 11g: Build Composite Applications 21


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (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
sh

Oracle SOA Suite 11g: Build Composite Applications 22


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (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
hilp se to
c)
( s
u cen
z z li
a ye
i l p
sh

3) The composite.xml file is opened, and select File > Save All to save the changes
to your Application and Project.

Oracle SOA Suite 11g: Build Composite Applications 23


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
Create the Exposed Service Interface
4) In the composite.xml window, drag a Web Service component into the Exposed
Services column.
5) To configure the interface for the Web Service interface perform the steps in the
following table:
Step Screen/Page Description Choices or Values
a. Create Web Service Name: ReceivePO
Next to the WSDL URL field, click the
“Generate WSDL from schema(s)” icon ( ).
b. Create WSDL, on the Next to the URL field, click the “browse
Request tab schema file” icon ( ). The second of the two
b l e
icons.
fer a
c. Type Chooser
Click the Import Schema ( ) icon. an s
d. Import Schema File Click the Browse Resources icon.n - t r
e. SOA Resource Browser no
Locate the D:\labs\files\xsd folder and
a
) h as eฺ
select po.xsd, and click OK.
f. Import Schema File m Guid
With the po.xsd file selected, click OK.
c o
g. Localize Files
h oฺ ent
Copy Options: Deselect the “Maintain original
o
y a Stud
directory structure for imported files” option,
and click OK.
h. Type Chooser z z u@ this Expand the Project Schema Files > po.xsd
a y e s e
u entry (if needed), select the PurchaseOrder
( s hilp se to entry, and click OK.
z u WSDL
i. zCreate
c e n Click OK.
l i
yj.e Create Web Services Click OK.
i l p a
sh Optionally, use the following screenshots as a guide for the steps in the above table:
a)

Oracle SOA Suite 11g: Build Composite Applications 24


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (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
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 25


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
e)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
f)
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 g)

Oracle SOA Suite 11g: Build Composite Applications 26


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
h)

i) 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
j)

Oracle SOA Suite 11g: Build Composite Applications 27


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
6) In the composite.xml window, verify that the ReceivePO icon appears in the
Exposed Services column. For example:

b le
7) Select File > Save all to save the changes to the project.
fer a
ans
Create and Wire the Service Mediator Component
n - t r
no
8) Create a Mediator component and wire the ReceivePO service entry point to the
a
Mediator component, by performing the following steps:
) h as eฺ
a) In the Composite Editor (composite.xml),m
o id component into
drag a Mediator
u
the Components column. 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 28


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
b) In the Create Mediator Component window, set the name to RoutePO and select
the Define Interface Later template, and click OK.

b le
Note: The Mediator interface is defined by wiring the SOAP service to the
fer a
Mediator component. The interfaces are implicit.
a n s
n
c) Create a wire from the ReceivePO exposed service icon to the RoutePO
r
-t Mediator
o
n exposed service
icon, by dragging the right-edge arrow icon from the ReceivePO
a
) h s ifollowing
to the left-edge arrow on the Mediator component. Useathe
e ฺ image as a
guide:
c o m Gu d
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
e File >liSave, or click the Save All icon to save the changes to your application.
9) ySelect
ilp a
sh Create a File Adapter as an External Reference
You now create an external reference for the File Adapter to write the input message
structure to a file in the file system.

Oracle SOA Suite 11g: Build Composite Applications 29


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
10) Using the Windows Explorer, create a new subfolder called podata in the
D:\labs folder.

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
11) In the composite.xmlzwindow,
@
u drag h iasFile Adapter component from the
onyto
t
ethe External
e References column.
Component Palette a
u s
( s hilp se to
z z u cen
ye li
ilp a
sh

12) On the Adapter Configuration Wizard pages, use instructions in the following table to
configure the File Adapter:
Step Screen/Page Description Choices or Values
a. Welcome Click Next.
b. Service Name Service Name: WritePOFileService
Click Next.
c. Adapter Interface Select the “Define from operation schema
(specified later)” option.
Click Next.
d. Operation Select the Write File option.
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 30


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
Step Screen/Page Description Choices or Values
e. File Configuration Directory for Outgoing Files:
D:\labs\podata
Note: You can click Browse to locate and
select the specified folder.
File Naming Convention:
order_%SEQ%.xml
Click Next.
Note: If you require help to perform this task, use the following screenshots as a
guide for steps in the table:
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
b) 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 31


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
c)

b le
fer a
ans
n - t r
a no
d)
) 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 32


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
e)

b le
fer a
ans
n - t r
a no
) h as eฺ
13) On the Adapter Configuration Wizard page, continue
o id the File Adapter
m to configure
u
o ฺ c
WSDL interface by importing the internalorder.xsd
n t G XML schema and
o de steps:
ah Sthetufollowing
selecting its “order” element, by performing
y
Step Screen/Page Descriptionu@ thChoices
is Browseor Values
a. Messages ezz e Click for schema file icon.
b. p a y
Type lChooser u s
h i
s nse File t o Click the Import Schema ( ) icon.
c. u (Import Schema Click the Browse Resources icon.
e z z SOA
d. l i c e
Resource Browser In the D:\labs\files\xsd folder select
a y
sh ilp e. Import Schema File
internalorder.xsd, and click OK.
With the internalorder.xsd file selected, click
OK.
f. Localize Files Copy Options: Deselect the “Maintain original
directory structure for imported files” check box, and
click OK.
g. Type Chooser Expand the Project Schema Files >
internalorder.xsd entry (if needed), select
order, and click OK.
h. Messages Click Next.
i. Finish Click Finish.
Note: If you require help to perform this task, use the following screenshots as a
guide for the steps in the preceding table:

Oracle SOA Suite 11g: Build Composite Applications 33


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
a)

b le
fer a
ans
n - t r
b) 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)

Oracle SOA Suite 11g: Build Composite Applications 34


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
d)

b le
fer a
ans
n - t r
a no
e)
) 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
yf)e li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 35


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
g)

b le
fer a
h)
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
i)

14) In the composite.xml file window, verify the File Adapter icon has been added to
External References column.

Oracle SOA Suite 11g: Build Composite Applications 36


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-1: Create the POProcessing Composite (continued)
15) Create a wire from the Mediator component to the File Adapter by dragging the right-
edge arrow of the Mediator component to the left-edge arrow on the File Adapter
icon. Use the following image as a guide:

16) Select File > Save All to save the changes to your project, and verify that your
composite application matches the following diagram:
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 37


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-2: Add a Transformation to the Mediator Component
In this practice, you create a transformation on the routing rule added due to wiring the
RoutePO Mediator component to the WritePOFileService. An XSL transformation is
required to ensure that the PurchaseOrder XML information is correctly copied to the
format of the “order” XML structure required by the files written to disk by the
WritePOFileService. To quickly create the transformation map required you use an XML
dictionary map file called Order-Dictionary.xml in the XSLT Mapper. To
complete this task perform the following steps:
1) In the POProcessing composite.xml window, to edit the Mediator component
double-click the RoutePO Mediator icon.
Note: Alternatively, right-click the RoutePO Mediator icon and select Edit.
2) In the RoutePO.mplan window, expand the routing rule section for the execute
operation and click the “Select an existing mapper file or create a new one” ( ) b le
icon, next to the Transform Using “body: <<Transformation Map>>” field. 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
3) On the Request Transformation Map dialog box, select the Create New Mapper File
option, and click OK.

Oracle SOA Suite 11g: Build Composite Applications 38


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-2: Add a Transformation to the Mediator Component
(continued)
4) In the PurchaseOrder_To_order.xsl XSLT Mapper window, map the
“PurchaseOrder” source element to the “order” target element and their child
elements using the Auto Map tool and the Order-Dictionary.xml dictionary
file.
Note: The XML namespace prefixes shown in the XML editor may differ from those
shown in the screenshots.
To perform this task use instructions in the following table:
Step Screen/Page Description Choices or Values
a. PurchaseOrder_To_order.xsl Drag the PurchaseOrder element in
the source column and drop it onto
the order element in the “XSLT File:
WritePOFileService.wsdl” column.
b le
b. Auto Map Preferences Click Show Dictionaries.
fer a
c. Auto Map Preferences Under Dictionaries field, Click Add.
ans
d. Open Navigate to folder
n - t r
no
D:\labs\files\xml, and select
a
has ideฺ
the file Order-Dictionary.xml
Click Open. )
e. Auto Map Preferences c om t Gu
Click OK to perform the automatic

o o e n
mapping operation with the
h
ya Stu d
dictionary applied.
z @
u this
a)
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 39


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-2: Add a Transformation to the Mediator Component
(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
c)
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 40


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-2: Add a Transformation to the Mediator Component
(continued)
d)

b le
fer a
ans
n - t r
a no
e) ) 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 41


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-2: Add a Transformation to the Mediator Component
(continued)
5) In the PurchaseOrder_To_order.xsl window, expand the XML trees in the
Source and “XSLT File: WritePOFileService.wsdl” columns and view the mappings
created. Use the following screenshot 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
Note: At this time, there are no
z @source is that directly map to the orderPrice,
u thelements
z
items > inStock, itemsy>eitem > itemTotals
e elements in the “XSLT File:
a u s
h i lp
WritePOFileService.wsdl”
t column.
o Mappings for these elements are done in a
subsequent(spractice. s e “for-each” construct is automatically inserted for the “item”
The
z z
element ubecause c eit n
is a repeating element.
y e l i
i l p a6) Click the RoutePO.mplan window, and confirm that the Transform Using field
sh shows the new mapping file. Use the following screenshot as a guide:

7) Select File > Save All to save the changes to all files in the project. You can also
close the PurchaseOrder_To_order.xsl window.

Oracle SOA Suite 11g: Build Composite Applications 42


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application
In this practice, you deploy and test the POProcessing composite application project to
the SOA server and use the Enterprise Manager Web application to test the service with a
sample input. To complete this task perform the following steps:

Deploy the POProcessing Composite Application


1) In the JDeveloper Application Navigator, right-click the POProcessing project, and
select Deploy > POProcessing > to > soaserver.

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 43


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
2) On the SOA Deployment Configuration Dialog, accept default settings and click OK.

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 time tyou u s
3) Since this is the
s h ilfirst e o are deploying an application in your JDeveloper
( ns Request window is displayed. Enter weblogic
session,uthe Authorization
z z c e
li field, welcome1 in the Password field, and click OK.
a yinethe Username
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 44


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
4) Deployment processing starts. Monitor deployment progress and check for successful
compilation in the SOA – Log window, and verify that deployment is successful in
the Deployment – Log window, similar to what is shown in the following images:

b le
fer a
ans
n - t r
a no
) as eฺ
hWeb
Test POProcessing using Enterprise Manager
o m u d
iInterface
In this section you use a Web browser to accessothe c t G
ฺ OraclenEnterprise Manager 11g
Fusion Middleware Control and initiate a test h o
a Stud e
of the deployed POProcessing application.
y
z zu@ the
5) Log in to Oracle Enterprise Manager
open a Web browser byeperforming
11gisFusion Middleware Control application and
t hfollowing steps:
y e
usenter the URL http://localhost:7001/em.
a window,
a) In the Web i l p
browser t o
u ( sh nse
b) On
e z z the Oracle
l i c eEnterprise Manager 11g Fusion Middleware Control login page,
a y enter the User Name weblogic, and Password welcome1, and click Login.
il p
sh

6) To initiate a test of the POProcessing composite, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 45


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
a) On the Farm navigation pane, expand the SOA > soa-infra nodes in the tree and
click the “POProcessing [1.0]” link.

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

b le
fer a
an s
n - t r
a no
7) On the Test Web Service page, scroll down to the Input ) as esection
hArguments ฺ to the
m u i d
Request tab, select XML View and replace the initial
o ฺ co n XML
t Gcontents with the XML

a h o
data in the file D:\labs\files\xml_in\po-medium-ipod.xml. If you
defollowing steps (or similar):
require help to replace the initial XML y text, use
S t u
the
z u @ h i s
a) With JDeveloper, select
e z File >
e t
Open and browse to the
a
D:\labs\files\xml_in
p y u s folder, select po-medium-ipod.xml and select
Open. hi l t o
( s
u JDeveloper s e
n po-medium-ipod.xml window, press Ctrl +A to select all
b) zInzthe
l i c e
a ye the text, and press Ctrl + C to copy the selection to the clipboard.
il p
sh

Oracle SOA Suite 11g: Build Composite Applications 46


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
c) On the “POProcessing [1.0]” Test Web Service page, place the cursor in the XML
text area of the Input Arguments, and press Ctrl + A to select all the text and press
Ctrl + V to paste it into the XML View replacing the initially supplied XML text.
Use the following screenshot as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
d) On the “POProcessing [1.0]” Test Web o ฺ compage,
Service
n t G u Test Web Service.
Click
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
i l p a
sh

Note: This action sends the XML data as input message to the POProcessing
composite application. It might take several seconds for the page to refresh with
the response displayed in the Response tab. Please wait until the page is refreshed.

Oracle SOA Suite 11g: Build Composite Applications 47


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
IMPORTANT NOTE: When you click Test Web Service, you may the following
saying, “Input arguments validation failed” and “The test was not run…” as shown in
the following image:

b le
If you see the above error dialog box, then perform the following steps to correct and
fer a
resubmit the data:
a n s
i) On the “Input arguments validation failed” dialog box, click OK. n -t r
o
ncontents of XML
ii) On the Request tab, in Input Arguments section modify s ฺ athe
View field based on the following options: ) ha
o m u ide
(1) If there is extra space or lines at
o ฺcthe
the end of
n t G
all the XML data, delete
a h o
those spaces and lines ensuring
d e
XML data is unaffected, and click
Test Web Service, or y S t u
z u @ h i s
ezor mouse
(2) If there is no t or lines at the end of all the XML data, put
extra space
e
a y
the cursor
p u s pointer after the last character on the last line of
h sei
thel XML t o
data, press Enter, and click Test Web Service
( s
u Throughout n the rest of the course you may have to repeat this process as
e z z
Note:
l i c e
a y required when submitting XML data to initiate tests for each composite
i l p application.
sh
8) On the “POProcessing [1.0]” Response tab page, click the Launch Message Flow
Trace link to view the results of the asynchronous composite application.

Oracle SOA Suite 11g: Build Composite Applications 48


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
9) On the Flow Trace page, verify that the ReceivePO, RoutePO, and
WritePOFileService components have a Completed state indicating the application
executed successfully.

b le
fer a
ans
n - t r
a no
) h as eฺ
c o m Guid folder and
10) In a Windows Explorer window, navigate to the D:\labs\podata
examine the XML file created for the order.oฺ t
h o e n
a) Ensure that the order_1.xmlyfile a hasSbeent udcreated in the podata subfolder, as
z z u@ this
shown in the following image:

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 49


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 3-3: Deploy and Test the POProcessing Composite
Application (continued)
b) Using JDeveloper open the order_1.xml file to view its contents and verify
that the XML file contains similar (if not the same) data 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 hilp se to
u JDeveloper
Inzthe
c) z c e n window, close the order_1.xml and the po-medium-
l i
ye ipod.xml windows.
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 50


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 4

The goal of this practice is to explore Oracle Enterprise Manager Fusion Middleware
Control interface for managing an SOA composite application. Your tasks are to:
• Modify the File Adapter definition of the POProcessing application to use a
logical name instead of a physical directory name for the location of writing files
• Set a reference property of the File Adapter to set the logical name value
• Deploy the updated POProcessing application and test that the order file is saved
in the directory specified for the logical name
• Generate a configuration plan for the POProcessing project that redefines the
value assigned to the logical name property for the File Adapter
• Validate the configuration plan
• Redeploy the POProcessing composite application with its new configuration plan b le
by using Enterprise Manager. fer a
The above tasks are represented in the following image: 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

You also test the changes to the deployed application and verify that an order data file is
created in the new physical directory applied by the configuration plan.

Oracle SOA Suite 11g: Build Composite Applications 51


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name
In this practice, you modify the POProcessing composite application and alter the File
Adapter to use a logical name instead of an explicit directory for orders written to the file
system. You then create a binding property that is to set the directory to the D:\labs
directory, and deploy the application using JDeveloper and test the order is written to a
file in the labs directory.

Modify the File Adapter to use a Logical Name


1) In the JDeveloper window, select the POApplication in the application menu. Expand
the POProcessing project and open the composite.xml file.
2) In the POProcessing composite.xml window, edit the File Adapter external
reference to use a logical name instead of a physical path. Use the following table of b le
instructions as a guide: fer a
ans
Step Screen/Page Description Choices or Values
n - t r
a. composite.xml no
Double-click the WritePOFileService
a
has ideฺ
external reference icon.
)
ฺ 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. zu
z c e n
Adapter Configuration Wizard Click Next.
y e Step 1l iof 7 – Welcome
i l p a c. Adapter Configuration Wizard Click Next.
sh Step 2 of 7 – Service Name
d. Adapter Configuration Wizard Click Next.
Step 3 of 7 – Adapter Interface
e. Adapter Configuration Wizard Click Next.
Step 4 of 7 – Operation
f. Adapter Configuration Wizard Select the Logical Name option
Step 5 of 7 – File Configuration Directory for outgoing files (logical name):
orderfiles
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 52


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
Step Screen/Page Description Choices or Values

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t G u
g. Adapter Configuration Wizard
h o o Click n
Next.
e
Step 6 of 7 – Messages
ya SClick d
tu Finish.
h. @
Adapter Configuration Wizard
zu thi s
Step 7 of 7 – Finish
y e z e
a u s
h lp sfore the
3) To set the path ivalue
( s toorderfiles logical name perform the following steps:
z u composite.xml
a) Inzthe
c e n window, click the WritePOFileService external
l i
ye reference icon ensure that the File Adapter reference is selected.
p a
il b) In the Property Inspector for the Reference – WritePOFileService (in the lower
sh right pane in the JDeveloper window), observe that JDeveloper has added a File
Adapter reference property called orderfiles for the logical name.

Oracle SOA Suite 11g: Build Composite Applications 53


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
c) To set the orderfiles reference property default value to D:\labs, click in
the Value cell next to the orderfiles reference property, enter the string value
D:\labs and press Enter.
Hint: You may wish to resize the Inspector Property window to view and modify
the property.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
othe application.
4) Select File > Save All to save the changesoto
h e n
ya Compositetu d
Deploy the Modified POProcessing @
u thi s S Application
z z
e deploy
y
5) In the JDeveloper window,
a u s ethe modified POProcessing project by performing
the followingh
s ilp e to
steps:
( nsNavigator, right-click POProcessing project name, and select
u Application
a) Inzthe
z c e
a ye Deploy >liPOProcessing > to > soaserver
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 54


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
b) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
composites with the same revision ID” option, and click OK.

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
c) In the Log window, observez @
u the logh is
messages to ensure that deployment is
e z e t
successful.
p y
a o us
i l
Test theuModified s et
(sh nPOProcessing Composite Application
z z c e
li window, enter the Enterprise Manager URL
6) yInea Web browser
a
ilp http://localhost:7001/em, and login as weblogic with password
sh welcome1.
7) On the Enterprise Manager home page, locate and click the “POProcessing [1.0]” link
under the Farm SOA > soa-infra folder.
8) On the “POProcessing [1.0]” page, click Test.
9) On the “POProcessing [1.0]” Test Web Service page on the Request tab perform the
following steps:
a) In the Input Arguments section, in Tree View mode enter the following values:
custID: 1
ID: 2
payOption: credit
shipChoice: two_day
status: Initial
ccType: AMEX
ccNumber: 1111-2222-3333-4444

Oracle SOA Suite 11g: Build Composite Applications 55


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
Use the following image as a guide:

b le
fer a
ans
n - t r
a no
b) While still in the Tree View mode, expand the items field, and in the item field (as
has ideฺ
shown above) enter the value 1 in the OrderItemTypeArray Size, and click the
)
document icon.
ฺ 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) Expand the OrderItemTypeArray item and the OrderItemType item and enter the
following field values, and then click Test Web Service.
productId: SKU102
productName: Test Product
price: 100
quantity: 1

Oracle SOA Suite 11g: Build Composite Applications 56


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
Note: Use the following screenshot as a guide:

10) On the “POProcessing [1.0]” Response tab page, click the Launch Message Flow
Trace link.
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e ncomposite application instance
11) On the Flow Trace page, verify that the
ya Stu d
POProcessing
completed all processing successfully.
@
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 57


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-1: Modify the POProcessing File Adapter to use a
Logical Name (continued)
12) Either using Windows Explorer or JDeveloper, navigate to the D:\labs folder and
confirm that a file called order_1.xml has been created in the directory, and open
the file to confirm that contains the values entered in the Enterprise Manager Web
service test page form fields.

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 58


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-2: Generate and Validate a Configuration Plan
In this practice, you create configuration plan for the POProcessing composite application
to replace the destination directory for the orderfiles logical name reference
property. After you verify the configuration plan, you redeploy the composite application
by using the Enterprise Manager Web interface applying the configuration plan, verify
and test the changes.

Generate a Configuration Plan


1) In the Application Navigator with the POProcessing project expanded, right-click the
composite.xml file and select Generate Config Plan.

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
2) In the
z zComposite n
u ceConfiguration Plan Generator dialog box, accept the default plan
e l i
yfile name, and click OK.
sh ilpa

Note: The configuration plan file is generated into the project folder, and JDeveloper
opens the POProcessing_cfgplan.xml file in its own window.
3) In the POProcessing_cfgplan.xml window, scroll down until you locate the
<reference name="WritePOFileService"> element, and append the text
\podata to the value D:\labs contained in the <replace> element. The
resulting <replace> element should be as follows:

Oracle SOA Suite 11g: Build Composite Applications 59


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-2: Generate and Validate a Configuration Plan
(continued)
<replace>D:\labs\podata</replace>
Use the following image as a guide:

b le
fer a
an s
n - t r
a no
4) Select File > Save All to save the changes to the project files.
) has ideฺ
Validate the Configuration Plan
ฺ c om t Gu
h o composite.xml
5) On the Application Navigator, right-clickothe e n file and select
Validate Config Plan. 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
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 60


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-2: Generate and Validate a Configuration Plan
(continued)
6) In the Composite Configuration Plan Validator dialog box, accept the default
selection and click OK.

b le
fer a
7) In the POProcessing_cfgplan_report.log window, verify that the ans
orderfiles Reference Property is replaced with the new value of n - t r
a no
D:\labs\podata specified in the configuration plan being validated. 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 61


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-3: Test a Composite Deployed with a Configuration
Plan
In this practice, you redeploy the POProcessing composite application using the
configuration plan file generated and validated in the previous practice. You also test the
deployed application to confirm that the configuration plan changes are applied.
To complete these tasks perform the following steps:
1) Return to your Web browser with the Enterprise Manager page, and redeploy
POProcessing composite application using the deployment plan file modified in the
previous steps. To complete this task perform instructions in the following table
Step Screen/Page Choices or Values
Description
a. Oracle Enterprise Right-click the “POProcessing [1.0]” link and select SOA
Manager SOA > Deployment > Redeploy. b le
soa-infra Farm tree fer a
b. “POProcessing In the Archive or Exploded Directory section, select ans
[1.0]” Redeploy n - t
“Archive is on the machine where this Web browser is
r
SOA Composite a no
running” option, and click Browse.
c. File Upload has ideฺ
Navigate to the D:\labs\mywork\POApplication
)
ฺ c om t Gu
\POProcessing\deploy folder and select the

h o o
sca_POProcessing_rev1.0.jar file, and click Open.
e n
d. “POProcessing
ya Stu d
Under the Configuration Plan section, select the
[1.0]” Redeploy @ “Configuration plan is on the machine where this Web
u this
SOA Composite ezz browser is running” option, and click Browse.
e. File Upload pay u se
Navigate to the
( s hil se to D:\labs\mywork\POApplication\POProcessing
z z u cen folder and select the POProcessing_cfgplan.xml file,
ye li and click Open.
a
ilp f. “POProcessing Scroll back to the top (if needed) and click Next.
sh [1.0]” Redeploy
SOA Composite
g. “POProcessing Click Redeploy.
[1.0]” Redeploy
SOA Composite
Note: If you require help to perform this task, you can use the following screenshots
as a guide to the instructions in the preceding table:

Oracle SOA Suite 11g: Build Composite Applications 62


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-3: Test a Composite Deployed with a Configuration
Plan (continued)
a)

b le
fer a
b) 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)

Oracle SOA Suite 11g: Build Composite Applications 63


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-3: Test a Composite Deployed with a Configuration
Plan (continued)
d)

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
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

f)

Oracle SOA Suite 11g: Build Composite Applications 64


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-3: Test a Composite Deployed with a Configuration
Plan (continued)
g)

2) After the redeploy processing window is displayed and closed when the deployment
successfully completes, click “POProcessing [1.0]” link in the Farm navigator tree to
view the home page (if needed), and click the Show XML Definition icon. e
a b l
s fer
- t r an
no n
a
) has ideฺ
ฺ c om t Gu
h
3) In the Definition window, locate the XMLo o e n element with the
a Stthat d
<property>
u the value is D:\labs\podata,
name="orderfiles" attribute,yand verify
@ s
zu withththei configuration plan. Then click OK to close
as expected due to redeployment
y e z e
the window. a u s
( s hilp se to
z z u cen
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 4-3: Test a Composite Deployed with a Configuration
Plan (continued)
Test the Redeployed POProcessing Composite Application
Note: We have not modified the POProcessing composite application source code and
have not even recreated the SOA Archive file during the redeployment process.
4) Using Oracle Enterprise Manager to test that the POProcessing composite application
now writes order files in the D:\labs\podata folder, as defined by the
configuration plan, use instructions in the following table:
Step Screen/Page Description Choices or Values
a. “POProcessing [1.0]” Click Test
b. “POProcessing [1.0]” Test Web In the Input Arguments Request tab section,
Service select the XML View option, and replace the
supplied XML data with the contents of the
b le
D:\labs\files\xml_in\po-small-
ipod.xml file (using copy and paste fer a
ans
techniques).
n - t r
a no
Click Test Web Service
Note: If you require help to perform this task, use these screenshots as a guide for
instructions in the preceding table:
) has ideฺ
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

Oracle SOA Suite 11g: Build Composite Applications 66


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 4-3: Test a Composite Deployed with a Configuration
Plan (continued)
b)

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya composite d
tu application instance completed
@
5) After verifying that the new POProcessing s S
z
successfully in the Flow Trace
e zupage, tuse
hi Windows Explorer to verify that the
order_1.xml p a
file has
e
y beenucreated
s with supplied data in the D:\labs\podata
i l t o
folder.
u (sh nse
e z z lice
y
sh ilpa

Note: There is a chance that more than one XML file may exist in the podata
subfolder. If that is the case, then the file with the highest sequence number contains
the latest order information.

Oracle SOA Suite 11g: Build Composite Applications 67


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 5

The goal of this practice is to create the CreditCardValidation composite application that
receives a credit card number and the purchase order total. The CreditCardValidation
composite application validates the credit card using a Database Adapter service, which
queries the CREDITCARDS table in an Oracle Database instance. Your tasks are to:
• Create a new SOA project for the CreditCardValidation composite application,
using a Mediator component whose WSDL interface is based on the
creditcheck.xsd schema elements
• Add and configure a Database Adapter into the composite application that
performs a Select operation on the CREDITCARDS table to return the status and
limit information for the given credit card number.
• Deploy and test the composite application b le
The following image represents the composite application design for your fer a
CreditCardValidation project: 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 68


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
In this practice, you create a new SOA Project, called CreditCardValidation, in the
POApplication workspace, which contains a Mediator component called
ValidateCreditCard. To complete this task perform the following steps:
1) In the JDeveloper Application Navigator window, with the POApplication visible in
the Application menu, click the Application Menu icon and select New Project.

b le
2) In the New Gallery window, select the SOA Project in the Items list of the Project
fer a
category, and click OK.
a n s
3) In the “Create SOA Project – Step 1 of 2” Project Name window, enternthe r
-t Project
Name: CreditCardValidation, and click Next. n o
a
s window,
4) In the “Create SOA Project – Step 2 of 2” Configure SOA
) haSettings
i d e ฺ select the

ฺ c om t Gu
Composite With Mediator for the Composite Template option, and click Finish.

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

Note: The Create Mediator window is opened after clicking Finish.

Oracle SOA Suite 11g: Build Composite Applications 69


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
Configure the Mediator Component from a WSDL Definition
5) In the Create Mediator window, set the Name to ValidateCreditCard, and
select “Interface Definition from WSDL” from the Template pull-down menu. Ensure
that the “Create Composite Service with SOAP Bindings” check box is selected, and
click the “Generate WSDL from Schema(s).” icon (next to the WSDL URL field).
For example:

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: The Create WSDL window is opened.

Define the Mediator WSDL Interface


6) To define the Request message for the Mediator component WSDL interface, use
instructions in the following table as a guide (and use associated screenshots after the
table):
Step Screen/Page Description Choices or Values
a. Create WSDL > Request Click the Browse icon next to the URL field.
b. Type Chooser Click the Import Schema icon.
c. Import Schema File Click the Browse icon.
d. SOA Resource Browser Using the File System option, locate and
select the creditcheck.xsd in the
D:\labs\files\xsd folder, and click
OK.

Oracle SOA Suite 11g: Build Composite Applications 70


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
Step Screen/Page Description Choices or Values
e. Import Schema File With the creditcheck.xsd selected,
click OK.
f. Localize Files Deselect the “Maintain original directory
structure for imported files” option, and click
OK.
g. Type Chooser Expand the Project Schema Files >
creditcheck.xsd nodes (if needed) and
select the CreditCheckRequest element, and
click OK.
h. Create WSDL > Request Change the fields as follows:
Operation Name: validateCC
b le
Port Type Name: validateCC_ptt
fer a
Click the Reply tab.
ans
Note: Do not click OK.
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
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 71


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
b)

b le
c)
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

Oracle SOA Suite 11g: Build Composite Applications 72


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
e)

f)

b le
fer a
ans
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 a
sh

Oracle SOA Suite 11g: Build Composite Applications 73


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
h)

b le
fer a
ans
n - t r
a no
) h as eฺ
7) On the Create WSDL > Reply tab page, to define the
o m Reply id structure for the
message
u
o ฺ c
Mediator component WSDL interface, use instructions
n t
in G
the following table as a
guide: o
ah Stude
y
Step Screen/Page Description
a. Create WSDL >e z zu@ Click
Reply t is or Values
Choices
h the Browse icon next to the URL field.
a y s e
u Expand the Project Schema Files >
b.
h i lp
Type Chooser
t o
u (s nse creditcheck.xsd nodes (if needed) and
e z z l i c e select the CreditCheckResponse element, and
y click OK.

sh ilpa c. Create WSDL Click the Fault tab.


a)

Oracle SOA Suite 11g: Build Composite Applications 74


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(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
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
8) On the Create WSDL > Fault tab page, to define the Fault message structure for the
Mediator component WSDL interface, use instructions in the following table as a
guide:
Step Screen/Page Description Choices or Values
a. Create WSDL > Fault Click the Browse icon next to the URL field.
b. Type Chooser Expand the Project Schema Files >
creditcheck.xsd nodes (if needed) and
select the CreditCheckFault element, and click
OK.
c. Create WSDL Click OK.

Oracle SOA Suite 11g: Build Composite Applications 75


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(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
c)

Oracle SOA Suite 11g: Build Composite Applications 76


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-1: Create the CreditCardValidation SOA Project
(continued)
9) In the Create Mediator window, to create the Mediator component and its associated
exposed service, verify the settings match the following screenshot with the “Create
Composite Service with SOAP Bindings” check box selected, and click OK.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om ttab.
G u
h o o
10) In the JDeveloper window, click the composite.xml
e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
z u cen window, verify you initial composite assembly model
zcomposite.xml
yresembles thelifollowing image:
11) Inethe
a
sh ilp

12) Select File > Save All to save your changes to the composite application project.

Oracle SOA Suite 11g: Build Composite Applications 77


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
In this practice, you modify the CreditCardValidation composite application by creating a
Database Adapter that queries the CREDITCARDS table using the credit card number
supplied as input from the Mediator component. To create and configure the Database
Adapter perform the following steps:
1) In the CreditCardValidation composite.xml window, drag a Database Adapter on
the External References column.

b le
fer a
2) To configure the Database Adapter with the Adapter Configuration Wizard the an s
following instructions: n - t r
n o
a) Adapter Configuration Wizard – Welcome, click Next. s a
Step Screen/Page Description Choices or ) ha ideฺ
Values
c m CreditCardDBService
oName: G u
b. Adapter Configuration Wizard Service
o o ฺ n t
– Service Name h d
Click Next.e
c. Adapter Configuration Wizard
@ ya Click
S u Browse (flashlight) icon next to
tthe
– Service Connection s
zu thi the connection field.
y e z e Select the soademo entry, and click Copy
d. Select IDE Database
a u s
( s hilp se to
Connection Connection.
e.
z z u cen
Adapter Configuration Wizard Observe the JNDI Name has the value
ye – Service li Connection eis/DB/soadmo, and click Next.
i l p a f. Adapter Configuration Wizard Select the “Perform an operation on a Table”
sh – Operation Type option, and ensure the Select check box is
selected, and deselect other operations.
Click Next.
g. Adapter Configuration Wizard Click Import Tables.
– Select Table
h. Import Tables Click Query.
i. Import Tables Copy the CREDITCARDS table from the
Available list to the Selected list, click OK.
j. Adapter Configuration Wizard With the CREDITCARDS table listed, click
– Select Table Next.
k. Adapter Configuration Wizard Click Next.
– Relationships
l. Adapter Configuration Wizard Select the creditLimit and status
– Attribute Filtering attribute options, deselect remaining options.
Note: The cardNumber (key attribute)
cannot be deselected.
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 78


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(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
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 79


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
e)

b le
fer a
ans
n - t r
a no
f) ) 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 80


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
g)

b le
fer a
ans
h)
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 81


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
i)

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
j)
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 82


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
k)

b le
fer a
ans
l)
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

3) While still in the Adapter Configuration Wizard pages, configure the query
parameters and selection criteria by using the following table of instructions:
Step Screen/Page Description Choices or Values
a. Adapter Configuration Wizard Next to the Parameters section, click Add.
– Define Selection Criteria
b. Parameter Name Enter ccNum and click OK.
c. Adapter Configuration Wizard Next to the SQL field, click Edit.
– Define Selection Criteria
d. Expression Builder Click Add.
e. Expression Builder Form the condition:
cardNumber EQUAL ccNum, where:
First Argument Query Key: cardNumber

Oracle SOA Suite 11g: Build Composite Applications 83


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
Step Screen/Page Description Choices or Values
Operator: EQUAL
Second Argument: select the Parameter
option, and select ccNum
Click OK.
f. Adapter Configuration Wizard Verify your SQL statement is correct, and
– Define Selection Criteria click Next.
g. Adapter Configuration Wizard Click Next.
– Advanced Options
h. Adapter Configuration Wizard Click Finish.
– Finish
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 b)

Oracle SOA Suite 11g: Build Composite Applications 84


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
c)

b le
fer a
ans
n - t r
d)
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 85


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(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
y e z e
f) 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 86


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
g)

b le
fer a
ans
n - t r
a no
h)
) 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 Wire the Mediator to the DB Adapter and Create Transformations
4) In the composite.xml window, create a wire from the Mediator component to the
Database adapter External Reference by dragging the right-edge arrow of the
Mediator component to the left-edge arrow of the Database Adapter icon.

5) Edit the Mediator component to add transformations, by either right-clicking the


Mediator icon and selecting Edit, or double-clicking the Mediator icon.
6) In the ValidateCreditCard.mplan window, for the validateCC operation
expand the routing rule created by the wire.

Oracle SOA Suite 11g: Build Composite Applications 87


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
7) In the ValidateCreditCard.mplan window, in the Static Routing Rule section
click the “Select an existing mapper file or create a new one” icon for the request
section.

b le
fer a
ans
a) In the Request Transformation Map window, click the Create New Mapper File
option, accept the default file name supplied, and click OK. 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
s
b) In the XSLT
( hilMappere to map the CCNumber element in the Source column
window,
u ccNum
tozthe
z c e ns in the target column, as shown in the following image:
element
ye li
i l p a
sh

c) Save the changes to the XSLT Mapper file and project.

Oracle SOA Suite 11g: Build Composite Applications 88


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
8) Click the ValidateCreditCard.mplan window, and in the Synchronous Reply
section of the routing rule, click the “Select an existing mapper file or create a new
one” icon.

b le
fer a
ans
n - t r
no
a) In the Reply Transformation Map window, select the Create New Mapper File
a
has ideฺ
option, accept the default file name supplied, 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 b) In the XSLT Mapper window, expand the source tree and map the status element
sh in the Source column to the status element in the target column.

c) Save the changes to the XSL file and your project.

Oracle SOA Suite 11g: Build Composite Applications 89


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-2: Create a Database Adapter to Query Credit Cards
(continued)
9) Verify the composite application assembly model resembles the following image:

10) In the JDeveloper window, close the XSLT Mapper and the
ValidateCreditCard.mplan windows.

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 5-3: Deploy and Test the CreditCardValidation
Composite
In this practice, you deploy and test the CreditCardValidation composite application. To
complete this task perform the following steps:
1) In the JDeveloper Application Navigator, right-click the CreditCardValidation project
entry and select Deploy > CreditCardValidation > to > soaserver.
a) In the SOA Deployment Configuration Dialog window, click OK.
Note: If you get the Authorization Request window, enter the user name
weblogic and password welcome1.
b) In the Deployment – Log window verify that deployment is successful.
2) In a Web browser window, access the URL http://localhost:7001/em (or return to the
page that already has Enterprise Manager SOA page displayed). To perform the first b le
test, login to the Enterprise Manager application (if required) as weblogic with fer a
password welcome1. ans
n - t r
no
a) On the Farm navigator pane, expand SOA > soa-infra (in needed refresh the page)
a
has ideฺ
so that you can see the “CreditCardValidation [1.0]” entry. Click the
“CreditCardValidation [1.0]” link. )
b) On the “CreditCardValidation [1.0]” home ฺ c omclick
page, t G u
Test
h o o e n
y a Stu
c) On the Test Web Service page, scroll down d
the page to the Input Arguments

z z u@ this
section Request tab and enter
CCNumber: 1234-1234-1234-1234
the following values:

a y e s e
amount: 1000
ilp Service.
to u
s
Click Test
( hWeb e
z z u cens
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 91


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 5-3: Deploy and Test the CreditCardValidation
Composite (continued)
d) Wait for the Response tab to be displayed and verify that the status value returned
is VALID, as shown in the following image:

3) To perform a second test, to enter another request click the Request tab.
b le
a) On the Request tab page, modify the CCNumber value to be 4321-4321-
fer a
4321-4321, leave the amount at 1000, and click Test Web Service.
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 stabe page,
b) On the(Response
to verify that the status string value returned is
z
INVALID,
z n in the following image:
u caseshown
ye l i
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 92


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 6
The goal of this practice is work with Mediator components in the POProcessing
composite application. The Mediator routing rules and XSL transformations are used to
calculate the order item and order totals. The following image depicts the new assembly
model and changes to the POProcessing composite application:

b le
fer a
ans
n - t r
a no
As a result you learn how to: s ฺ
haacomposite
• Manage service virtualization and how to restructure
with a new Mediator component and makecchanges o
)
m to G ide assembly model
theucomponent wires
without affecting the exposed serviceo
h oฺ client
(external e n t interface)
• Modify the XSL transformation,ybetween a Sthe t d and second Mediator
ufirst
components, to calculate
z z uthe@ t h is In this case, you reuse and modify the
item totals.
a y e
existing XSL Transformation. s e
u
• Create a new
(
Mediator s handilpXSL e to
Transformation,
thesWritePOFileService,
in the routing rule between the second
to calculate the order total using the item
z u e n
y eztotals lic calculated by the XSL transformation between the Mediator
already
components.
sh ilpaNote: There are multiple solutions for calculating the item and order totals. One solution
exists that uses a single XSL file without the need for an additional Mediator component.
However, the single XSL file approach involves a higher degree of complexity and a
detailed knowledge of XSL constructs, which can only be coded in the XSLT Mapper
source and not visually constructed. Since the detailed explanation of the XSL constructs
involved (call-template and recursion) is not in the scope of this course, the design
approach used was chosen for its simplicity and the ability to provide a context in which
you can learn to use the various capabilities in the composite application assembly model
and work with additional XSL functions visually.

Oracle SOA Suite 11g: Build Composite Applications 93


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-1: Restructure the POProcessing Assembly Model
In this practice, you restructure the POProcessing composite application assembly model
by adding a new Mediator component between the RoutePO Mediator component and the
WritePOFileService. This requires deleting the existing routing rule (wire) between the
RoutePO and WritePOFileService, adding a new Mediator component, and creating the
wires needed to complete the application assembly model.

To complete this task perform the following steps:


1) In the JDeveloper Application Navigator, open the composite.xml file in the
POProcessing project by double-clicking the composite.xml file name.
Note: If required, expand the POProcessing project and its SOA Content folder to
locate the composite.xml file.
b le
Delete the RoutePO Mediator Component Routing Rule
fer a
2) To remove the wire between the RoutePO Mediator component and the ans
n
WritePOFileService external reference, edit the RoutePO Mediator component and - t r
delete the existing Routing Rule. a no
) h as eฺ
Note: If you require help to perform this task, youm
o u id
can use the following steps:
a) Double-click the RoutePO Mediator component c
oฺ eicon n G
t to edit the component.
h o
b) In the RoutePO.mplan window, y a underSthe
t udexecute operation select the existing
z u@
static routing rule by clicking in theh i s
grey section just below the “<<Filter
e z e t
Expression>>” field.
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 94


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-1: Restructure the POProcessing Assembly Model
(continued)
c) In the RoutePO.mplan window, to the right of the execute operation name
click the “Delete the selected Routing Rule” icon ( ).

Note: Deleting a routing rule from a Mediator component deletes the associated
wire from the composite.xml file. However, deleting the wire from the b le
composite.xml removes the target service from the associated Mediator fer a
ans
routing rule, that is, a routing rule is not deleted when its associated wire is
deleted. n - t r
d) In the Confirm Delete dialog box, click Yes. a no
) h as eฺ
e) In the JDeveloper window, click the composite.xml tabidand verify that the
c o m hasGbeen
u
o o ฺ
wire between the RoutePO and WritePOFileService
n t removed. Use the
following image as a guide:
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 Insert and Wire a new Mediator Component between RoutePO and
WritePOFileService
3) In the composite.xml window, create a new Mediator component called
EnrichPO using the One-Way Interface template, and set the Input (type) as the
order element in the internalorder.xsd project XML Schema.
Note: Ensure the “Create Composite Service with SOAP Bindings” check box is
deselected.

If you require help to perform this task, use the table of instructions and associated
screenshots:
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: EnrichPO
Template: One-Way Interface

Oracle SOA Suite 11g: Build Composite Applications 95


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-1: Restructure the POProcessing Assembly Model
(continued)
Step Screen/Page Description Choices or Values
Deselect the “Create Composite Service with
SOAP Bindings” check box.
Input: Click the Browse Input Elements icon ( ).
c. Type Chooser Expand Project Schema Files >
internalorder.xsd, select the order element,
and click OK.
d. Create Mediator Click OK.
a)

b l e
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
b) @
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 96


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-1: Restructure the POProcessing Assembly Model
(continued)
c)

b le
fer a
ans
n - t r
d) 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) In the composite.xml window, create two wires to form the next phase of the
composite application assembly model, using the following image as a guide:

Note: If you require help to perform this task, use the following steps to accomplish
the task:

Oracle SOA Suite 11g: Build Composite Applications 97


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-1: Restructure the POProcessing Assembly Model
(continued)
a) In the composite.xml window, create a wire by clicking the “Drag to add a
new Reference” icon ( ) on the right edge of the RoutePO Mediator component
and dragging a line to the left edge service interface icon ( ) of the EnrichPO
Mediator component.

b le
fer a
ans
n - t r
no
b) In the composite.xml window, drag a wire from the EnrichPO Mediator
a
“Drag to add a new Reference” icon ( ) to the service
h s ฺicon ( ) of the
ainterface
WritePOFileService external reference.
o m ) u ide
o o ฺc nt G
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
u cen
zzJDeveloper
5) yInethe li window, select File > Save All to save the changes to all files in the
a
ilp project.
sh

Oracle SOA Suite 11g: Build Composite Applications 98


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
In this practice, you modify an existing XSL Transformation to calculate the item totals
for order item when the data is being routed to the second Mediator component. In
addition, you create a new XSL transformation for the new Mediator component. The
new XSL Transformation copies the internal order items and calculates the order total
from the item totals before the transformed data is sent to other services, such as the
WritePOFileService.

To complete these tasks perform the following steps:

Attach an Existing XSL file to the RoutePO Mediator Routing Rule


1) Edit the RoutePO Mediator component and use the existing
PurchaseOrder_To_order.xsl file for the routing rule. e
If you require help to perform this task, use the following steps: a b l
s fer
a) In the composite.xml window, double-click the RoutePO Mediator
- t r an
component to open the Mediator Editor. n
no
a
b) In the RoutePO.mplan window, under the Routing Rules section in the Static
has ideฺ
Routing for the execute operation, click the “Select an existing mapper file or
)
create a new one.” Icon ( ).
ฺ c om t Gu
o
c) In the Request Transformation Maphdialog
o box, eaccept
n the Use Existing Mapper
yaBrowse u d
tMappings
File (default) option, and click
u @ the
i s S icon ( ).
d) In the SOA Resource e z window,
zBrowser th select the
y
a o us e
h i l p
PurchaseOrder_To_order.xsl
t file and click OK.
e) In the
u (s nTransformation
Request se Map window, confirm the Use Existing Mapper
z z i c e
a ye File fieldlcontains
click OK.
the value xsl/PurchaseOrder_To_order.xsl and
i l p
sh

f) In the RoutePO.mplan window, confirm your changes to the XSL mapper file
have been applied, and select File > Save to save the changes.
2) Close the RoutePO.mplan window.

Oracle SOA Suite 11g: Build Composite Applications 99


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
Modify the PurchaseOrder_to_order.xsl to Calculate Item Totals
3) Modify the PurchaseOrder_To_order.xsl file to set the itemTotal for each
item element by multiplying the price and quantity. In addition, initialize target
elements that are not mapped from a source element. Use instructions in the following
table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. JDeveloper Applications Navigator
Expand the POProcessing > SOA
Content > xsl folder, and double-click the
PurchaseOrder_To_order.xsl
file.
b. PurchaseOrder_To_order.xsl Expand the items and item nodes in both
the source and target columns, and drag a b le
multiply component, from the fer a
Mathematical Functions in the ans
Component Palette, to the middle columnn - t r
of the XSLT Mapper. a no
c. has ideฺ
PurchaseOrder_To_order.xsl Drag the price from the source column
)
onto the left-side handle of the multiply
ฺ c om t Gu
function in the middle column of the
h o o e n
XLST Mapper.
ya Stu d
z @
u this Drag the quantity element to the multiply
y e z e
p a u s function.
d. l
hi se t o
PurchaseOrder_To_order.xsl Drag the right-side handle (the result)
( s
u cen from the multiply function to the
z z li
a ye itemTotal in the target column.

sh ilp a)

Oracle SOA Suite 11g: Build Composite Applications 100


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(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 d)

Oracle SOA Suite 11g: Build Composite Applications 101


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
4)

5) In the PurchaseOrder_To_order.xsl window, initialize the orderTotal to a


value of 0.0 by using instructions in the following table and associated screenshots: b le
Step Screen/Page Description Choices or Values fer a
ans
a. PurchaseOrder_To_order.xsl Right-click the orderTotal in the
n - t r
a
Text > Enter Text.no
target column, and select Set

b. Set Text has ideฺ


Select the Text option, and enter
)
ฺ c om t Gu
the value 0.0. Click OK.
c. PurchaseOrder_To_order.xsl
h o o e n
Verify the value 0.0 is assigned
ya Stu d
as text to the orderTotal element
z @
u this in the target column.
y e z e
a u s
a)
( s hilp se to
z z u cen
ye li
i l p a
sh

b)

Oracle SOA Suite 11g: Build Composite Applications 102


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
c)

6) In the PurchaseOrder_To_order.xsl window, initialize the items > inStock


element to the value true by using instructions in the following table and associated
screenshots:
Step Screen/Page Description Choices or Values
a. PurchaseOrder_To_order.xsl Right-click the inStock in the
target column, and select Set
Text > Enter Text. b le
b. Set Text Select the Text option, and enter fer a
the value: true. Click OK. ans
c. PurchaseOrder_To_order.xsl Verify the value true is n - t r
a no
assigned as text to the inStock
has ideฺ
element in the target 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)

c)

7) Select File > Save to save the changes to the PurchaseOrder_To_order.xsl


file, and close the PurchaseOrder_To_order.xsl window.

Oracle SOA Suite 11g: Build Composite Applications 103


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
Create a New XSL File for the EnrichPO Mediator Routing Rule
The EnrichPO Mediator component has the same internal order element structure that
is routed to target services (such as the WritePOFileService). However, the incoming data
provides an orderTotal initialized to 0.0 and all the itemTotal elements have been
calculated. You create a new XSL file to calculate the orderTotal from the sum of all the
itemTotal elements.
1) To create a new XSL file for the routing rule to the WritePOFileService that
calculates the sum of all itemTotal elements to the orderTotal, perform the following
steps:
a) In the composite.xml window, double-click the EnrichPO Mediator
component to open the Mediator Editor.
b le
b) In the EnrichPO.mplan window, under the Routing Rules section in the Static
fer a
ans
Routing for the execute operation, click the “Select an existing mapper file or
create a new one.” Icon ( ). n - t r
a no
c) In the Request Transformation Map window, select the Create New Mapper File
has ideฺ
option, accept the default XSL file name order_To_order.xsl, 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: The order_To_order.xsl file is opened in the XSLT Mapper visual
design window.
2) In the order_To_order.xsl window, to map all elements in the source to their
corresponding elements in the target, perform the following steps:
a) Click and drag a line connecting the order element in the source column to the
order in the target column.

b) In the Auto Map Preferences window, accept the default settings and click OK.
c) In the order_To_order.xsl window, verify that all the elements have been
mapped by expanding all the child nodes.

Oracle SOA Suite 11g: Build Composite Applications 104


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
d) Click File > Save to save the generated mappings.
3) In the order_To_order.xsl mappings, replace the mapping for the itemTotal
element with a function that calculates the sum of itemTotal elements by performing
the following steps:
a) Delete the map line between the orderTotal elements, by clicking the line
connection the orderTotal elements and pressing Delete.
b) Drag the sum function, from the Mathematical Function on the Component
Palette, into the middle column of the order_To_order.xsl window.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o the items
e n > item element, if required)
c) Drag a line from the itemTotal (expanding d
yahandleSoftuthe sum function in the middle
from the source on to the left-side
@
column. 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

d) Drag a line from the right-side handle of the sum function to the orderTotal
element in the target column.

Oracle SOA Suite 11g: Build Composite Applications 105


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-2: Calculate Order Totals with XSL Transformations
(continued)
e) Save the changes to the order_To_order.xsl file, and close the
order_To_order.xsl 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 106


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-3: Test the Modified POProcessing Application
In this practice, you deploy and test the modified POProcessing composite application.

To complete this task perform the following steps:


1) To deploy the modified POProcessing project, perform the following steps:
a) In the JDeveloper Application Navigator window, right-click the POProcessing
project and select Deploy > POProcessing > to > soaserver.
b) In the SOA Deployment Configuration dialog box, accept all the default settings
and select the “Overwrite any existing composites with the same revision ID”
check box. Click OK.
Note: If the Authorization Request dialog box is displayed, enter the user name
weblogic and password welcome1, and click OK. e
a b l
c) On the Deployment – Log window, confirm that deployment is successful.
s fer
2) In a Web browser window, if needed enter the URL
- t r an
http://localhost:7001/em and login with the user name weblogic and
no n
password welcome1. a
haswrites
3) Test the updated POProcessing composite application,) which i d e ฺorder files in the
c
D:\labs\podata folder, by using Oracle ฺEnterprise om tManager
G u with instructions in
the following table: h o o e n
d
ya Stuor Values
Step Screen/Page Description @ Choices
a. Enterprise Manager e z
homezu thExpand is the SOA folder in the Farm navigation
a y u s e tree, and click the “POProcessing [1.0]” link.
b. s hilp[1.0]”
“POProcessing
( s e to Click Test.
c.
z z u
“POProcessing
c e n
[1.0]” Test Web In the Input Arguments Request tab section,
yeService l i select the XML View option, and replace the
il p a supplied XML data with the contents of the
sh D:\labs\files\xml_in\po-medium-
ipod.xml file (using copy and paste
techniques).
Note: Ensure you delete any trailing spaces
from the XML payload before clicking Test
Web Service.

Click Test Web Service.


Note: If you require help to perform this task, use these screenshots as a guide for
instructions in the preceding table:

Oracle SOA Suite 11g: Build Composite Applications 107


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-3: Test the Modified POProcessing Application
(continued)
a)

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
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 6-3: Test the Modified POProcessing Application
(continued)
4) After verifying that the new POProcessing composite application instance completed
successfully in the Flow Trace page.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o
5) In Windows Explorer, verify that the order_2.xml e nfile has been created with
ya folder. tu d
supplied data in the D:\labs\podata
@ s S
e z zu thi
a y u s e
( s hilp se to
z z u cen
ye li
ilp a
sh Note: There is a chance that more than one XML file may exist in the podata
subfolder. If that is the case, then the file with the highest sequence number contains
the latest order information.

Oracle SOA Suite 11g: Build Composite Applications 109


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 6-3: Test the Modified POProcessing Application
(continued)
6) Open the D:\labs\podata\order_2.xml file in JDeveloper and verify that the
itemTotal and the orderTotal values have been set and calculated correctly, and that
the inStock element has the value true. 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
7) In JDeveloper, close the order_2.xml window.

Oracle SOA Suite 11g: Build Composite Applications 110


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 7

The goal of the practices for this lesson is to modify the POProcessing composite
application assembly model by adding two BPEL Process components to perform order-
processing tasks. The following image shows the assembly model changes:

b le
fer a
ans
n - t r
a no
) has ideฺ
c om ttwo
After modifying the assembly model you edit theฺfollowing G u process
BPEL
components and create their structure with h o
theiroinitial Scope,
e n Assign, and Transform
activities: ya Stu d
1. The ApproveCCOrder BPEL z @
u process h isthat validates the credit card and is later
z t
ehuman workflow
e to manually approve orders if their total
a y
modified to include
u s
( s hilp BPEL
exceeds 3000.
e toprocess that performs processing tasks to fulfill approved
2. The Fulfillment
z z
orders. c ns processing includes checking if stock (inventory) for the order
u Fulfillment
e
li from an internal and online store, selecting the store to supply the
ye is available
ilp a
sh products for an order, and sending the order to a shipping company.

The tasks required to change the assembly model include:


• Adding the two BPEL components
• Adding the wires between components, and modifying the EnrichPO Mediator
component with routing rules that use filters to route paypal orders to the
WritePOFileService and Fulfillment BPEL process, and credit orders to the
ApproveCCOrder BPEL process.
• Adding a wire from the ApproveCCOrder BPEL process to the Fulfillment BPEL
process to ensure credit card orders that are approved are fulfilled.

Oracle SOA Suite 11g: Build Composite Applications 111


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model
In this practice, you modify the POProcessing assembly model, by adding two BPEL
Process components and implementing the wires for the required interactions.

Add the ApproveCCOrder BPEL Component


Add and wire the ApproveCCOrder BPEL component into the POProcessing assembly
model as shown in the following image:

b le
fer a
ans
n - t r
To complete these tasks perform the following steps:
a no
) as folder.
1) In the JDeveloper Application Navigator, expand the POProcessing
hContent e
project and

double-click the composite.xml file under the SOA
omyoutdoGnot d
uiperform
Note: If the composite.xml file is alreadyฺc open this step.
o o n
2) In the composite.xml window,ytoaadd h a new t u de component, drag the BPEL
BPEL
Process icon from the Componentu@Palette
i s S the Components column.
into
z
ez se t h
a y u
h i lp t o
u (s nse
e z z l i c e
y
sh ilpa

3) In the Create BPEL Process window, configure the BPEL Process by using
instructions in the following table and associated screenshots:
Step Screen/Page Choices or Values
Description
a. Create BPEL Name: ApproveCCOrder
Process Deselect the “Expose as a SOAP service” check box
Accept default values for other fields.
Next to the Input field, click the Browse Input Elements icon
( ).

Oracle SOA Suite 11g: Build Composite Applications 112


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
Step Screen/Page Choices or Values
Description
b. Type Chooser Expand the Project Schema Files >
internalorder.xsd, select order and click OK.
c. Create BPEL Next to the Output field, click the “Browse Output
Process Elements” icon ( ).
d. Type Chooser Expand the Project Schema Files >
internalorder.xsd, select order and click OK.
e. Create BPEL Verify that the Template is set to Asynchronous BPEL
Process Process, that the Input and Output elements have
{http://www.example.org/ns/intorder}order
as their value, and that the “Expose as a SOAP service”
b le
option is not selected, and click OK.
fer a
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 113


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (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
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 7-1: Add BPEL Components to the POProcessing
Assembly Model (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
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: The ApproveCCOrder BPEL Process icon is added to composite.xml.

Oracle SOA Suite 11g: Build Composite Applications 115


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
4) To create a wire between the EnrichPO Mediator component and the
ApproveCCOrder BPEL component, click and drag the “Drag to add a new
Reference” icon ( ) on the right edge of the EnrichPO Mediator component to the
left edge service interface icon ( ) of the ApproveCCOrder BPEL component.

b le
fer a
5) Verify that your composite.xml assembly model resembles the following image:
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
6) Click File > Save All to savez @ s files in the POProcessing project.
uchangesthtoiall
y e z e
a u s
( s hilp sBPEL
Add the Fulfillment
e to Component
z z u youcadd
In this section,
e nthe Fulfillment BPEL Process component to the composite
y e
application l i
assembly model, and create wires from the EnrichPO Mediator component
a
ilpand the ApproveCCOrders BPEL process to the Fulfillment BPEL process. Use the
sh following image as a guide:

To complete these changes to the assembly model, perform the following steps:
7) In the composite.xml window, to add a new BPEL component drag the BPEL
Process icon from the Component Palette into the Components column.
8) In the Create BPEL Process window, configure the following field values:
Name: Fulfillment

Oracle SOA Suite 11g: Build Composite Applications 116


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
Template: Asynchronous BPEL Process
Deselect the “Expose as a SOAP service” check box
Input: {http://www.example.org/ns/fulfillment}Fulfill
mentRequest
Output: {http://www.example.org/ns/fulfillment}Fulfill
mentResponse
Accept default values for all the other fields.

Note: To set the Input and Output elements use their respective browse icons, and
import the D:\labs\files\xsd\fulfillment.xsd the first time you browse
for an element. Use the following screenshot as a guide for the Create BPEL Process
configuration: 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
y e z e
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh
Note: Only if you require help to perform this task, use instructions in the following
table (without associated screenshots) to configure fields in the Create BPEL Process
window:
Step Screen/Page Description Choices or Values
a. Create BPEL Process Name: Fulfillment
Deselect the “Expose as a SOAP service”
check box
Input: Click the Browse Input Elements icon
( ).
b. Type Chooser
Click the Import Schema File icon ( ).
c. Import Schema File Click the Browse Resources icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 117


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
Step Screen/Page Description Choices or Values
d. SOA Resource Browser Navigate to the D:\labs\files\xsd
folder, select fulfillment.xsd, and click
OK.
e. Import Schema File URL:
file:/D:/labs/files/xsd/fulfil
lment.xsd
With “Copy to Project” check box selected.
Click OK
f. Localize Files Copy Options: Ensure you deselect both the
“Maintain original directory structure for
imported files” and the “Rename duplicate
files” check boxes, as follows: b le
fer a
ans
n - t r
a no
Click OK. ) h
as eฺ
g. Type Chooser o
Expandcthe
id Files >
mProjectGSchema
u
o oฺ ent
fulfillment.xsd,
h select
y a t u d
FulfillmentRequest and click OK.
@ s S
h. zu thOutput:
Create BPEL Process
e z i Click the Browse Output Elements
a y u e
s icon ( )
i. Type l p
hi se t
Chooser o Expand the Project Schema Files >
( s
u cen fulfillment.xsd, select
z z li FulfillmentResponse and click OK.
a ye j. Create BPEL Process Verify the following settings:
i l p
sh Template: Asynchronous BPEL Process
Input:
{http://www.example.org/ns/ful
fillment}FulFillmentRequest
Output:
{http://www.example.org/ns/ful
fillment}FulFillmentResponse
Ensure the “Expose as a SOAP service” check
box is not selected.
Click OK.

Oracle SOA Suite 11g: Build Composite Applications 118


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
9) In the composite.xml window, verify that your assembly model includes the
stand-alone Fulfillment BPEL process. Use the following screenshot as a guide:

10) To create a wire from the EnrichPO Mediator component to the Fulfillment BPEL b le
component, click and drag the “Drag to add a new Reference” icon ( ) from the fer a
ans
n - t r
right edge of the EnrichPO Mediator component to the left edge service interface icon
( ) of the Fulfillment BPEL component.
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 a11) To create a wire from the ApproveCCOrder BPEL component to the Fulfillment
sh BPEL component, click and drag the “Drag to add a new Reference” icon ( ) from
the right edge of the ApproveCCOrder BPEL component to the left edge service
interface icon ( ) of the Fulfillment BPEL component.

Oracle SOA Suite 11g: Build Composite Applications 119


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
12) Verify that your composite.xml assembly model resembles the following image:

13) Click File > Save All to save changes to all files in the POProcessing project.
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 120


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules
In this practice, you modify the EnrichPO Mediator component and modify the following
routing rules with the target service:
• WritePOFileService::Write: You add a filter to check if the input <payMethod>
has the string paypal. Only paypal orders are sent to the WritePOFileService.
The XSL Transformation is already configured for this rule.
• ApproveCCOrder/approveccorder_client::process: You add a filter to check if the
input <payMethod> has the string credit. Only credit card orders are sent to the
ApproveCCOrder BPEL process. In this case, you use the same XSL
Transformation file configured for the WritePOFileService routing rule.
• Fulfillment/fulfillment_client::process: You add a filter to check if the input
<payMethod> has the string paypal. Paypal orders must still be routed to the
Fulfillment BPEL process to ship products and complete the order cycle. In this e
case, you need to create a new XSL Transformation to calculate the order total, a b l
and cannot reuse the order_To_order.xsl file, because the target XSD has sfer
different parent element to the order element. - t r an
nno
To complete these tasks perform the following steps: a
) as eฺ
hthe
1) In the POProcessing composite.xml window, to edit
o m u id rule definitions
routing
ฺc nMediator
of the EnrichPO Mediator double-click the EnrichPO
o t G component icon.
o
ah StuRule de
Add a Paypal Filter to the FirstyRouting
2) In the EnrichPO.mplan z z u@ tinhthe
window,
is first routing rule (with
a y ethe target
s eservice) add a filter that checks if the input
as u
hilp selement
WritePOFileService::Write
s
message payMethod
( e to is equal to the 'paypal' string value. Use instructions
u cetable
in thezfollowing
z n and associated screenshots as a guide:
yeScreen/Page l i
il p a
Step Choices or Values
sh a.
Description
EnrichPO.mplan In the routing rule to WritePOFileService, click the
Invoke Expression Builder icon ( ).
b. Expression Builder In the Variables section, expand the in > request > order
tree, select payMethod and click Insert Into Expression.
In the Expression field append: = 'paypal' to the
XPath expression for payMethod to form an expression
similar to:
$in.request/inp1:order/inp1:payMethod
= 'paypal'
Click OK.

Oracle SOA Suite 11g: Build Composite Applications 121


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules
(continued)
a)

b)

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
3) On the JDeveloper menu, click File > Save All, or click the Save All icon ( )on the
JDeveloper toolbar.

Add a Credit Filter and Reuse an XSL file in the Second Routing Rule
4) In the EnrichPO.mplan window, in the second routing rule (with the
ApproveCCOrder/approveccorder_client::process target service) add a filter that
checks if the input message payMethod element is equal to the 'credit' string
value. Use the following substeps:
a) In the EnrichPO.mplan window, in the routing rule with the
ApproveCCOrder/approveccorder_client::process target service, click the Invoke
Expression Builder icon ( ).
b) In the Expression Builder window, in the Variables section, expand the in >
request > order tree, select payMethod, and click Insert Into Expression.

Oracle SOA Suite 11g: Build Composite Applications 122


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules
(continued)
c) In the Expression Builder window, in the Expression field append ='credit'
to the XPath expression for payMethod to form the following expression (or
similar):
$in.request/inp1:order/inp1:payMethod = 'credit'
Click OK.
5) In the EnrichPO.mplan window, in the second routing rule (with the
ApproveCCOrder/approveccorder_client::process target service) add an XSL
Transformation. Use the following substeps:
a) In the EnrichPO.mplan window, in the routing rule with the
ApproveCCOrder/approveccorder_client::process target service, click the “Select
an existing mapper file or create a new one.” icon ( ).
b le
b) In the Request Transformation Map window, use the Use Existing Mapper File
fer a
option (the default), and click the Browse Mappings icon ( ). ans
n - t r
from the project XSL folder, and click OK. a no
c) In the SOA Resource Browser window, select the order_To_order.xsl file
s ฺ
haUse
d) In the Request Transformation Map window, with)the
o m u i de Mapper File
Existing
field set to xsl/order_To_order.xsl,
o ฺc clicknOK.
t G
o
ah Stude
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: In this case, we are using an existing XSL file because it meets with the
requirements for this routing rule source and target element structures.

6) On the JDeveloper menu click File > Save All, or click the Save All icon ( ) on the
JDeveloper toolbar.

Add a PayPal Filter and New XSL File to the Third Routing Rule
7) In the EnrichPO.mplan window, in the third (and last) routing rule (with the
Fulfillment/fulfillment_client::process target service) add a filter that checks if the
input message payMethod element is equal to the 'paypal' string value. Use the
following substeps:
a) In the EnrichPO.mplan window, in the routing rule with the
Fulfillment/fulfillment_client::process target service, click the Invoke Expression
Builder icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 123


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules
(continued)
b) In the Expression Builder window, in the Variables section, expand the in >
request > order tree, select payMethod and click Insert Into Expression.
c) In the Expression Builder window, in the Expression field append ='paypal'
to the XPath expression for payMethod to form the following expression (or
similar):
$in.request/inp1:order/inp1:payMethod = 'paypal'
Click OK.
8) In the EnrichPO.mplan window, add a new XSL Transformation to the third
routing rule with Fulfillment/fulfillment_client::process as its target service. Use the
following substeps:
a) In the EnrichPO.mplan window, in the routing rule for e
Fulfillment/fulfillment_client::process, click the “Select an existing mapper file or a b l
create a new one.” icon ( ). n fer
s
r a
-t File
b) In the Request Transformation Map window, select the Create New
n o nMapper
option, and accept the default Mapper File Name a
order_To_FulFillmentRequest.xsl and click
) hasOK.ideฺ
c) In the order_To_FulFillmentRequest.xsl
ฺ c om t window,
G u map all elements
by dragging the order element fromothe
h o sourcesentree on to the
FulfillmentRequest element y t ud tree.
a in theStarget
z @ his
uaccept
d) In the Auto Map window,
e z e tall the default settings and click OK.
p y
a o us
i l
e) In the order_To_FulFillmentRequest.xsl
t elements.
hthe orderTotal window, delete the map line
( s
u cens
connecting e
z z li
a yf)e In the order_To_FulFillmentRequest.xsl window, to calculate the
i l p orderTotal correctly, perform the following mapping actions:
sh i) Drag a Sum function from the Mathematical Functions group in the
Component Palette into the middle column of the window.
ii) Expand the source tree until you see the itemTotal, in the items > item child
nodes, and drag the itemTotal to the left-side handle on the Sum function in
the middle column.

Oracle SOA Suite 11g: Build Composite Applications 124


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-2: Add Filters to the EnrichPO Mediator Routing Rules
(continued)
iii) Drag the right-side handle of the Sum function in the middle column to the
orderTotal in the target column.

Use the following image as guide to your final mapping 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 z
e to savesethe transformation map file and
g) Select File > Save
i a All
lp file o u
h
(s nse
EnrichPO.mplan t changes.
z z u c e
9) Close
y e l i
the EnrichPO.mplan and order_To_FulFillmentRequest.xsl

ilpa
windows.
sh

Oracle SOA Suite 11g: Build Composite Applications 125


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
In this practice, you edit the ApproveCCOrder BPEL Process component and structure
process flow with Scope activities that:
• Reflect tasks in the business process flow
• Simplify management of the process complexity
The following image represents the BPEL process flow diagram you create in this
practice:

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

To create the process flow shown requires that you perform the following tasks:
• Create an Assign activity to copy the received order data into the process output
variable. The output variable is used as working copy of data that is updated with
changes to the order as it flows through the process.
• Create the validatecc Scope to contain activities that interact with the credit card
validation composite application service. Initially this scope contains an Empty
activity.
• Create the fulfillment Scope to contain activities that interact with the Fulfillment
BPEL process. In this scope you create local BPEL variables used to interact with

Oracle SOA Suite 11g: Build Composite Applications 126


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
the Fulfillment service and a Transform activity to prepare the input data that is
required by the Fulfillment BPEL process.
Note: A hybrid development and design approach is being followed for creating the
course application. With a hybrid approach you do some top-down process assembly and
structural design with the visual designers, and fill in the implementation details later.
However, you continue to develop and deploy other smaller composite applications, such
as the CreditCardValidation composite application, and Web services that are required as
external service to complete the POProcessing application. In addition, because the next
lesson teaches how to invoke other services from a BPEL process, you do not implement
activities to invoke external services from BPEL in this practice. Invoking other services
from BPEL is covered in the lesson titled “Orchestrating Services with BPEL” and its
associated practices.
b le
Additional Note: You can use either of the following ways to rename BPEL activities:fer a
• Double-click the activity name, enter the new name, and press Enter. ans
• Double-click the activity icon, replace the name in the General tab,nand- trclick OK.
o do not spell
nand
For brevity, subsequent instructions just ask you to rename the activity
a
out the specific steps to rename an activity.
) has ideฺ
c m perform
oflow, G u the following steps:
To create the initial ApproveCCOrder BPEL process
o o ฺ n t
h d e
Create and Name the Flow Activities
@ ya Stu
z z
1) In the POProcessing composite.xml
u thiswindow, double-click the ApproveCCOrder
a y e icon toseopen the BPEL Editor.
BPEL Process component
i lp t o u
h
(s nse
2) In the ApproveCCOrder.bpel window, create and name the three activities
z u e
yshown ic
ez in thelfollowing image:

sh ilpa

Note: If you require help to create the process flow in the


ApproveCCOrder.bpel window, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 127


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
a) Drag an Assign activity from the BPEL Activities on the Component Palette into
the BPEL process flow.

b le
fer a
ans
n - t r
a no
) has ideฺ

b) Double-click the name of the assign activityc oandmrename
t G u
it to Assign_orderinfo.
h o o e n
ya Stu d
z @
u this
y e z e
a u s
( s hilp se to
c) z z
Dragu a Scope c e n from the Component Palette into the flow after the assign
activity
ye activity. l i
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 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
d) Rename the Scope activity to Scope_validatecc.

b le
fer a
ans
n - t r
a no
hasinto
e) Drag another Scope activity from the Component )Palette
i d e
theฺ flow after the
Scope_validatecc activity.
ฺ 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 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
f) Rename the second Scope activity to Scope_fulfillment.

b le
fer a
ans
3) Select File > Save to save the changes to the ApproveCCOrder BPEL Process.
n - t r
Configure the Assign_orderinfo Activity a no
In this section, you edit the Assign activity and create a copy
) as etoฺ store a working
hoperation
c o m Guid
copy of the order from the inputVariable in the outputVariable.
4) In the ApproveCCOrder.bpel window, h o otoฺ edit ethenactivity
t and add copy
y a
operations double-click the Assign_orderinfo t u d
activity.
Note: Alternatively, you can u @
right-click i s S
e z z
e t Assign_orderinfo activity and select Edit.
h the

p a y us
i l t o
u (sh nse
e z z lice
y
sh ilpa
Note: Editing an Assign activity causes the Copy Operation tabbed page of the
Assign activity to be displayed.
5) In the Assign window, create a copy operation that copies the order XML structure
from the (global) inputVariable to the outputVariable. Use instructions in the
following table and associated screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Assign > Copy Operation
Click the Add icon ( ) and select Copy
Operation.

Oracle SOA Suite 11g: Build Composite Applications 130


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
Step Screen/Page Description Choices or Values
b. Create Copy Operation In the From section, using Variable as the Type,
expand the Process > Variables > inputVariable >
payload, and select order.

In the To section, using Variable as the Type,


expand the Process > Variables > outputVariable
> payload, and select order.

Click OK.

Note: Because namespace prefixes such as the


ns2: (before the order element in variable tree b le
fer
as seen in image associated with this step) can
a
ans
differ, they are excluded from the instructions.
c. Assign n - t r
Confirm the addition of the copy operation in the
no
row below the From and To headings, and click
a
OK.
) has ideฺ
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

Oracle SOA Suite 11g: Build Composite Applications 131


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
b)

b le
fer a
ans
n - t r
a no
) has ideฺ
Note: When you select an element in a o ฺ comtreentstructure
variable Gu you are creating an
h
XPath expression for that elementathatois addeddeto the BPEL source code in the
u The XPath expression helps the
y attributeStvalues.
@
associated activity XML element s
zuXML fragment
BPEL Engine extract z
e the
e thi or value and copy it to the target
element.
p a y us
i l t o
c)
u (sh nse
e z z lice
a y
i l p
sh

6) Select File > Save to save the changes to the ApproveCCOrder BPEL Process.

Configure the Scope_validatecc Activity


In this section, you expand the scope and add an Empty activity into the scope. The
Empty activity is used as a placeholder for other process activities that are added in the

Oracle SOA Suite 11g: Build Composite Applications 132


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
practices for the lesson titled “Orchestrating Services with BPEL.” The Empty activity is
required in this practice so that we can successfully compile and deploy the composite
application that contains the BPEL process.
7) In the ApproveCCOrder.bpel window, to expand Scope_validatecc activity,
click its Expand icon ( ).
Note: You must first expand a scope to add activities into its structure.

8) Drag an Empty activity from the Component Palette into the Scope_validatecc
activity, and drop it on to the text Drop Activity Here within the expanded scope. 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 9) Confirm that the scope contains the Empty_1 activity as shown in the following
image, and to collapse the Scope_validatecc activity, click its Collapse icon ( ).

Oracle SOA Suite 11g: Build Composite Applications 133


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
10) Select File > Save to save the changes to the ApproveCCOrder BPEL Process.

Configure the Scope_fulfillment Activity


In this section, you expand the Scope_fullfilment activity and add two local variables
called fulfillmentRequest and fulfillmentResponse, respectively. The two variables are
used by activities that are added to interact with the Fulfillment BPEL process in the
practices for the lesson titled “Orchestrating Services with BPEL.” After creating the
variables you create a Transform activity in the scope to populate the fulfillmentRequest
variable with the request data.
11) In the ApproveCCOrder.bpel window, expand the Scope_fulfillment activity.
12) In the expanded Scope_fulfillment activity, on the left-hand edge click the Variables
icon ( ). The Variables window is displayed. 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 a13) In the Variables window, create the fulfillmentRequest variable and set its type to the
sh FulfillmentRequestMessage type defined in the project
fulfillment.wsdl file. Use instructions in the following table and associated
screenshots as a guide:
Step Screen/Page Description Choices or Values
a. Variables Click the Create icon ( ).
b. Create Variable Name: fulfillmentRequest
Type: Select the Message Type option and click the
Browse Message Types icon ( ).
c. Type Chooser Expand the Message Types > Project WSDL Files >
Fulfillment.wsdl > Message Types folder,
select the FulfillmentRequestMessage, and
click OK.
d. Create Variable Confirm the following field settings:
Name: fulfillmentRequest
Type: Select the Message Type option
Message Type: (without the namespace)

Oracle SOA Suite 11g: Build Composite Applications 134


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
Step Screen/Page Description Choices or Values
FulfillmentRequestMessage.
Click OK.
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 135


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(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
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 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
14) In the Variables window, confirm that the fulfillmentRequest variable has been added
to the list of variables.
Note: Do not close the Variables window, as you need to create a second variable in
the same window.

b le
fer a
ans
n - t r
a no
15) In the Variables window, create the fulfillmentResponse variable and set its type to
the FulfillmenResponseMessage type defined in the project fulfillment.wsdl
has ideฺ
file. Use instructions in the following table as guide (no screenshots are provided):
)
Step Screen/Page Description c om t Gu
Choices or ฺValues
a. Variables h o oCreate icon
e n( ).
Click the d
ya fulfillmentResponse
tu
b. Create Variable @Name:
s S
e z zu Type: i the Message Type option and click the
thSelect
a y e
usBrowse Message Types icon ( ).
i l p t o
c. (sh nse
Type Chooser
u
Expand the Message Types > Project WSDL Files >
e z z l i c e Fulfillment.wsdl > Message Types folders,
y select the FulfillmentResponseMessage,
sh ilpa and click OK.
d. Create Variable Confirm the following field settings:
Name: fulfillmentResponse
Type: Select the Message Type option
Message Type: (without the namespace)
FulfillmentResponseMessage.
Click OK.

Oracle SOA Suite 11g: Build Composite Applications 137


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
16) In the Variables window, confirm that your have two local variables named
fulfillmentRequest and fulfillmentResponse, and click OK to close the Variables
window.

b le
fer a
a n s
Note: The fulfillmentRequest and fulfillmentResponse variables are defined
n r
-t to have
message structures compatible with the Fulfillment BPEL processn o
their message types are obtained from the WSDL file createdsfor a theinterface, because
Fulfillment
BPEL Process component interface. ) ha ideฺ
ฺ c om t Gu BPEL Process.
17) Select File > Save to save the changes to the ApproveCCOrder
h o o e n
a Stu d
Create a Transform Activity@ inythe Scope_fulfillment Activity
u i s
zz eactivity
In this section you create a Transform
y e th to copy the contents of the outputVariable
into the fulfillmentRequest
i l p t us Therefore the Transform activity must be
a localo variable.
( h se
added inside thesscope to access the fulfillmentRequest variable.

z z u celements
Note: The children e n of each variable are the same; therefore, the transformation
mapy e
is quickly l i
created by mapping the parent elements and using the Automap tool to
a
ilpcomplete the XSL mapping required.
sh 18) In the ApproveCCOrder.bpel window, create and edit a Transform activity
inside the Scope_fulfillment activity. Use the following steps:
a) Drag a Transform activity from the Component Palette onto the text Drop Activity
Here in the expanded Scope_fulfillment activity.

b) Rename the Transform activity to Transform_fulfillment.

Oracle SOA Suite 11g: Build Composite Applications 138


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
c) To edit the Transform activity, right-click the Transform_fulfillment activity icon,
and click Edit.
Note: Alternatively, double-click the Transform activity icon.

19) Configure the transformation source variable as the outputVariable payload, and the
target variable as the fulfillmentRequest payload and create a new transformation b le
fer
map file called Transformation_to_fulfillment. Use instructions in the following table
a
ans
and associated screenshots as a guide:
n - t r
Step Screen/Page Description Choices or Values
a no
has ideฺ
a. Transform > Transformation Next to the Source section, click the Create icon
( ). )
b. Source Variable ฺ c om t Gu
Source Variable: Select outputVariable
h o o e n
Source Part: payload is already selected
ya Stu d
@ Click OK.
c. z u this
Transform > Transformation
z Target Variable: fulfillmentRequest
a y e s e (should already be selected. If not select it)
u
( s hilp se to Target Type: payload (should also be selected)

z z u cen Mapper File:


ye li xsl/Transformation_to_fulfillment
ilp a Click the Create Mapper File icon ( ).
sh
Note: The XSL file is created and opened in the
XSLT Mapper Editor window.

Oracle SOA Suite 11g: Build Composite Applications 139


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
a)

b le
fer a
ans
n - t r
a no
) h as eฺ
b)
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 140


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
c)

b le
fer a
ans
n - t r
a no
) has ideฺ
20) In the Transformation_to_fulfillment.xsl
ฺ c om twindow,
G u create the mappings
rules such that all elements in the source oareomappedeto
ntheir respective target
elements by performing the following h
yasteps:Stu d
a) Drag the order element z @
inuthe source
h s to the FulfillmentRequest element in
icolumn
e z e t
the target column.
a y u s
lp Preferences
hiMap to window, accept all default settings and click OK.
( s
b) In the Auto
u that s e
nelements
c) z z c e
e the targetliby expanding theinchild
Confirm all the source are mapped to their respective elements in
y node. Use the following image as a guide:
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 141


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
d) On the JDeveloper window menu, select File > Save All to save changes to the
BPEL and XSL file.
e) Close the Transformation_to_fulfillment.xsl window.
21) In the ApproveCCOrder.bpel window, confirm the Transform_fulfillment
activity is configured (that is, no warning icons are displayed on the activity icon),
and collapse the Scope_fulfillment scope.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
yaApproveCCOrder.bpel
tu
22) In the JDeveloper window, close
u@ the
i s S window.

y e zz e th
i l p a o us
( s h se t
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 142


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
In this practice, you design the high-level business Fulfillment BPEL process flow using
Scope activities. The implementations of activities for each Scope are completed in
subsequent practices of this course. One of the objectives is to learn how to construct a
BPEL Process skeleton or framework which models a process flow and to add the
implementation details later, after dependent services have been constructed. The
following image illustrates the initial structure of the Fulfillment BPEL Process
component:

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

Your tasks are to create the following scopes:


• The insertorder Scope, for inserting an approved order into the database by using
Entity Variables in the practices for the lesson titled “Managing Transactions with
Services.” At this time, this scope is created with an Empty activity.
• The checkstock Scope, for invoking the stock checking services in a parallel flow
as covered in the lesson titled “Implementing Coordination and Interaction
Patterns.” At this time, this scope is created with an Empty activity.

Oracle SOA Suite 11g: Build Composite Applications 143


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
•The shiporder Scope, for preparing and sending the order shipping request.
Initially this scope executes an Assign activity to set the output variable with
shipping status information. In the practices for the lesson titled “Implementing
Human Task Services,” you modify this scope to contain activities to send the
order shipping request to one of several shipping companies through JMS
Adapters, return the shipping status, and implement email notification.
To create the initial Fullfillment BPEL Process flow, perform the following steps:
1) In the JDeveloper window, ensure that the POProcessing composite.xml file is
open.
2) In the composite.xml window, double-click the Fulfillment BPEL Process
component icon to open it in the BPEL Editor window.
b le
Create and Name the Flow Activities fer a
ans
In this section you create and name three Scope activities to structure the BPEL process.
n - t r
no
3) In the Fulfillment.bpel window, in the BPEL process diagram between the
a
has ideฺ
receiveInput and callbackClient activities create three named Scope activities called
)
(in the order listed here): Scope_insertorder, Scope_checkstock, and
ฺ c om t Gu
Scope_shiporder. 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: If you require help to perform this task, in the Fulfillment.bpel window
use the following steps:

Oracle SOA Suite 11g: Build Composite Applications 144


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
a) Drag a Scope activity from the Component Palette and drop it between the
receiveInput and callbackClient activities. Rename the scope to
Scope_insertorder.
b) Drag a Scope activity from the Component Palette and drop it after the
Scope_insertorder activity. Rename the new scope to Scope_checkstock.
c) Drag a Scope activity from the Component Palette and drop it after the
Scope_checkstock activity. Rename the new scope to Scope_shiporder.
4) Save the changes to your project.

Add an Empty Activity in Scope_insertorder and Scope_checkstock


At this stage of the implementation there is nothing to process in Scope_insertorder and e
Scope_checkstock. However, to successfully compile and deploy the composite with this a b l
s
BPEL process you add an Empty activity into each scope. To complete this task perform fer
the following steps:
- t r an
no n
5) Expand the Scope_insertorder activity, and using the following screenshot as a guide
a
has ideฺ
drag an Empty activity from the Component Palette into the scope.
)
ฺ 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 145


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
6) Expand the Scope_checkstock activity, and using the following screenshot as a guide
drag an Empty activity from the Component Palette into the scope.

b le
fer a
ans
n - t r
a no
7) Collapse each of the Scope activities and save the changes to your project.
) h as eฺ
Add and Configure an Assign Activity in Scope_shiporder
c o m Guid
h o oฺ outputVariable
In this case, you initialize the response data in the
e n t with hard-coded string
that are later replaced with dynamic results.
y t ud enables you to learn how to
a ThisSsection
z z u@ this
create two copy operations in the same Assign activity.
8) In the Fulfillment.bpel
a y e window,s e expand the Scope_shiporder, drag an Assign
u
s h asp asguide:
activity into theilscope,
following (image e
andto
rename the Assign activity to Assign_shipstatus. Use the

z z u cen
ye li
ilp a
sh

9) To edit and configure copy operations in the Assign_shipstatus activity, double-click


the Assign_shipstatus activity icon. On the Assign > Copy Operations tabbed page,
create the following two copy operations:

Oracle SOA Suite 11g: Build Composite Applications 146


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
a) Copy the string expression 'none' to the outputVariable > payload >
FulfillmentResponse > shipStatus element. 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 operation,
ocopy e n perform the following
Note: If you require help to createathe
y tu d
steps: @ s S
e z zu thi
i) On the Assigna y> Copyu s e tabbed page, click the Add icon ( ) and
Operations
select h
s ilp Operation.
Copy
e to
( nsCopy Operation window, in the “From” section select
ii)zu
z e
In the Create
c
li as the Type, and in Expression enter: 'none' (including the
ye Expression
i l p a single quotes).
sh
iii) In the Create Copy Operation window, in the “To” section select Variable as
the Type, expand Process > Variables > ouputVariable > payload >
FulfillmentResponse and select shipStatus.
iv) Click OK.

Oracle SOA Suite 11g: Build Composite Applications 147


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
b) Copy the string expression 'none' to the outputVariable > payload >
FulfillmentResponse > carrier element.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
o
Note: If you require help to create the
h o operation,
copy e n perform the following
steps: ya Stu d
z @
u this
z
i) On the Assigny>eCopy Operations
e tabbed page, click the Add icon ( ) and
a u s
( s hilp Operation.
select Copy
e to
ii)zu
z c e nsCopy Operation window, in the “From” section select
In the Create
li as the Type, and in Expression enter: 'none' (including the
ye Expression
i l p a single quotes).
sh iii) In the Create Copy Operation window, in the “To” section select Variable as
the Type, expand Process > Variables > ouputVariable > payload >
FulfillmentResponse and select carrier.
iv) Click OK.

Oracle SOA Suite 11g: Build Composite Applications 148


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-4: Design the initial Fulfillment BPEL Process
(continued)
10) On the Assign > Copy Operations tabbed page, verify that the operations are
configured and click OK.

b le
fer a
ans
n - t r
n o
a
s ฺ
11) Collapse the Scope_shiporder activity, and close the Fulfillment.bpel window,
and save the changes to the POProcessing project. ) ha
o m u ide
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 149


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components
In this practice, you deploy the modified POProcessing composite application project,
and perform the following two tests:
• Test an order that uses the paypal payment method. This test is designed to check
that paypal orders are sent to the Fullfilment and WritePOFileService and not
processed by the ApproveCCOrder BPEL component.
• Test an order that uses the credit payment method, which is designed to check that
credit card orders flow through the ApproveCCOrder and Fulfillment BPEL
Process components and not the WritePOFileService.
In addition, you examine the results of executing Assign and Transform activities by
using Oracle Enterprise Manager to view BPEL component details in the Audit Trail and
Flow tabs of the Flow Trace page.
b le
fer a
To complete the testing tasks, perform the following steps:
a n s
1) Using JDeveloper, deploy the POProcessing project to the soaserver n t r
-connection.
When the SOA Deployment Configuration Dialog window is displayed o
n select the
“Overwrite any existing composites with the same revisionaID.”
a
s ฺ box.
check
Note: Enter the login weblogic and welcome1 credentials h
) uinidane Authorization
o m G
Request window, if it is displayed. Monitor the
o o ฺcMessages
n t – Log and Deployment -
Log windows to ensure the composite application
a h u
is
d esuccessfully deployed. If not,
y
correct the errors and repeat this step.
@ S t
z u t h i s
2) Open a Web browser window,
y e z and
e enter the Oracle Enterprise Manager URL
p a o us and if necessary login with Username:
http://localhost:7001/em,
i l
weblogicswith
( h Password: e t welcome1.
z s
n Manager home page, locate and click the deployed
uOracle cEnterprise
e
3) On z the l i
e
y“POProcessing [1.0]” composite application link (located under the SOA tree in the
p a
il Farm navigation pane).
sh

Oracle SOA Suite 11g: Build Composite Applications 150


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
Test POProcessing with a PayPal Order
4) On the “POProcessing [1.0]” page, initiate the first test with the
D:\labs\files\xml_in\po-small-guitar.xml file copied into the
Request > XML View text area and replace the <payOption> element value with
paypal. Use the 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
yNote: i
e If you lrequire help to perform this task, use the following substeps:
i l p a
sh a) On the “POProcessing [1.0]” page, click Test.
b) On the Request tabbed page, in the Input Arguments section select XML View
and delete the supplied text.
c) Open the D:\labs\files\xml_in\po-small-guitar.xml in
JDeveloper (or Notepad) and copy all the text into the Input Arguments (XML
View) text area in the Web browser page.
d) In the XML View text area, replace the
<ns0:payOption>credit</ns0:payOption> element with
<ns0:payOption>paypal</ns0:payOption>.
e) Click Test Web Service.

Oracle SOA Suite 11g: Build Composite Applications 151


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
5) On the Response tab, click the Launch Message Flow Trace link.

6) On the Flow Trace page, under the Trace section confirm that the message flowed
through ReceivePO, RoutePO, EnrichPO and then to WritePOFileService and
Fulfillment. 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
7) On the Flow Trace page, to examine yathe Fulfillmentd
tu BPEL Process in the Audit Trail
@ s S
answer the following y e zzu link
tabbed page click the Fulfillment
questions: e thinithe Instance column of the Trace tree and
i l p a o us
a) What issthe
( h sofethet <orderTotal> element in the inputVariable?
value
b) z z u thecesteps
Describe n to find the orderTotal in the inputVariable.
l i
yc)e On the Flow tabbed page, what is the value of the <carrier> element after the first
il p a
sh copy operation is executed in the Assign_shipstatus activity?
d) Describe how you located the value for the <carrier> element.
e) On the Flow tabbed page, what is the title of the window that displays activity
information?
f) On the Flow tabbed page, how can you examine the value of the response
message?
g) How do you return to the Flow Trace page for the composite application instance?
Table of Answers for step 7
Step Answer
a. The <orderTotal> element of the inputVariable contains the string value 690.

Oracle SOA Suite 11g: Build Composite Applications 152


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
Step Answer
b. On the Audit Trail tabbed page, expand the <payload> entry under the
receiveInput activity:

b le
fer a
ans
n - t r
a no
c.
) hasactivity,
The <carrier> element is an empty XML element, for example
first copy operation is executed in the Assign_shipstatus i d
<carrier/> after the
e ฺas shown in the
following image: ฺ 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

Note: The Activity Details window shows the changes to the outputVariable after
each copy operation is executed. The top entry is the first copy operation. In this
case, two copy operations are executed by the Assign_shipstatus activity.
d. On the Flow tabbed page, scroll down the visual flow and click the
Assign_shipstatus activity icon.
e. Activity Details

Oracle SOA Suite 11g: Build Composite Applications 153


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
Step Answer
f. On the Flow tabbed page, click the callbackClient icon. For example:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
Note: Since this process is an asynchronous
y d
a Stu process the callbackClient
BPEL
@ Thehilast
activity holds the responseudata.
z s activity in a synchronous process is a
Reply activity. One-way
e z processes
e t do not have an activity to return a response
message. a y u s
h i lpTrace link
t o
g.
u (s nse
Click the Flow in the breadcrumb path at the top of the Flow Trace

e z z lice
page.
y
sh ilpa

8) Close the Flow Trace page, which is a pop-up window, so that you can return to the
“POProcessing [1.0]” Response tabbed page in Oracle Enterprise Manager.
9) Click the Request tab to prepare for the next test.
10) In a Windows Explorer window, navigate to the D:\labs\podata folder and
verify that the order was written to a file called order_4.xml (or XML file with
the highest sequence number). Open the file and verify that the <orderTotal> element
contains the string value 690, and <payMethod> contains the string paypal. Close the
application and window that you used to display the contents of the XML file.

Oracle SOA Suite 11g: Build Composite Applications 154


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
Test POProcessing with a Credit Order
11) On the POProcessing Composite page, if needed click the Request tab to initiate the
second test with the D:\labs\files\xml_in\po-small-guitar.xml file
copied into the Input Arguments (XML View) text area. Use the 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 n the <payOption> value as credit. Do not change any text in
u timeceleave
Note:
ye This l i
i l p a the input. If you require help to perform this task, use the following substeps:
sh a) On the Request tabbed page, select XML View and delete the supplied text.
b) Open the D:\labs\files\xml_in\po-small-guitar.xml in
JDeveloper (or Notepad) and copy all the text into the Request tabbed page >
XML View text area, replacing any text already in the field.
c) Click Test Web Service.
12) On the Response tab, click the Launch Message Flow Trace link.

Oracle SOA Suite 11g: Build Composite Applications 155


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
13) On the Flow Trace page, examine the Trace tree that should resemble the following
flow:

And answer the following questions:


a) Did the WritePOFileService get executed? Explain your answer. b le
fer a
b) Remember that the ApproveCCOrder is wired to the Fulfillment BPEL process.
ans
Now, can you explain why the Fulfillment BPEL process did not execute?
n - t r
Table of Answers for Step 13
a no
Step Answer
) has ideฺ
a. No, the WritePOFileService did not execute. o
c mreasonGisubecause the filters in
The
the EnrichPO Mediator component routes
o o ฺ
orders t payOption=credit to the
with
n
ApproveCCOrder BPEL Process and h d e
a notSthetuWritePOFileService.
b. A wire in the composite assembly
y
@ his model is not an invocation pattern. A wire in an
z u t interaction pattern. Although the
a y ez process
assembly model represents a possible
s e
ApproveCCOrder
i l p BPEL
t o u contains a Partner Link (a reference) to the

u
thezBPEL
(shprocess.
Fulfillment BPEL Process
n s e service interface, it does not have activities to invoke
e z l i c e
14)yOn the Flow Trace page, click the ApproveCCOrder link and use the Audit Trail or
sh ilpa Flow tabbed pages to answer the following questions:
a) What change has been made by the Assign_orderinfo activity?
b) Expand the payload containing the fulfillmentRequest variable for the
Transform_fulfillment activity. Alternatively, on the Flow page click the
Transform_fulfillment activity icon to display the variable contents in the Activity
Details window. Have all the item elements from the outputVariable (the order)
been copied to the fulfillmentRequest variable? Explain your answer.
c) What sequence of activities enabled the fulfillmentRequest variable to obtain its
values?
d) Is it possible for the values in the fulfillmentRequestVariable to differ from those
stored in the inputVariable?
Table of Answers for Step 14
Step Answer
a. The outputVariable has obtained a copy of all elements received by the
inputVariable when the BPEL process was executed.

Oracle SOA Suite 11g: Build Composite Applications 156


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 7-5: Deploy and Test POProcessing with BPEL
Components (continued)
Step Answer
b. Yes, all item elements for the order have been copied to the fulfillmentRequest
variable. The “for-each” XSL construct in the XSL Transformation used ensures
that repeating elements, such as the item element, are copied to the target XML
structure.
Note: An Assign activity would require a copyList operation or need to use the
copyList XSL function to accomplish similar results.
c. The Assign_orderinfo activity first copied the order elements from the
inputVariable to the outputVariable, and the Transform_fulfillment activity used a
transformation to copy the outputVariable values to the fulfillmentRequest
variable.
d. Yes. If the outputVariable, which is being used as a working copy of the order
data, was modified after it was assigned its data in the Assign_orderinfo and b le
before the Transform_fulfillment activity is executed the data in the fer a
fulfillmentRequest variable can differ from the inputVariable. ans
n - t r
Note: At this stage, the BPEL process does not modify the outputVariable before
it is copied to the fulfillmentRequest variable. a no
15) Close the Flow Trace Web browser window. ) 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
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 157


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 8

The goal of this practice is to learn how use the following BPEL activities:
• Invoke to invoke synchronous and asynchronous services
• Receive to receive a callback from an asynchronous service
• Switch to select a different sequence of BPEL activities to be executed
Part one and part two of this practice build on earlier practices by implementing
additional activities in the BPEL Process components of the POProcessing composite
application.

The changes to the composite application are shown 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
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 aThe changes to the POProcessing composite application assembly model include:
sh • The ValidateCCService external reference and the wire connecting it to the
ApproveCCOrder BPEL Process component.
• The three JMS Adapter external references (USPS JMSAdapter, UPS
JMSAdapter, FedEx JMSAdapter) and the wires connecting each of them to the
Fulfillment BPEL Process component.

Oracle SOA Suite 11g: Build Composite Applications 158


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
In part one the following image illustrates the changes you make to the ApproveCCOrder
BPEL Process component:

b le
fer a
ans
The changes made to the ApproveCCOrder BPEL Process include:
n - t r
a no
• Invoking the synchronous CreditCardValidation composite application as a
service. This requires that you create an external reference or partner link for the
CreditCardValidation service.
) has ideฺ
ฺ c om t Gu
• Checking the result of credit card validation by using a Switch activity. If the card

h o o e n
is valid, then you restructure the ApproveCCOrder to place the Fulfillment scope
ya Stu
in the <case> branch of the Switch activity. d
@
u this
• Invoking the asynchronous Fulfillment BPEL component and receive its callback
z
y e z
message. In this case, the Fulfillment partner link has already been created, in the
e
a u s
ApproveCCOrder BPEL process, from a wire created between the
s hilp se to
ApproveCCOrder and Fulfillment components in the practices for lesson 7.
(
z z u cen
In part li
ye two the following image shows the changes implemented in the Fulfillment BPEL
il p a
process:
sh

The changes to the Fulfillment BPEL Process include:

Oracle SOA Suite 11g: Build Composite Applications 159


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
• Creating three partner links, one for each reference to a JMS Adapter representing
the service for shipping companies. The JMS Adapters for the three shipping
companies (UPS, USPS, and FedEx) are created as External References in the
composite application or Partner Links in the BPEL process component.
• Adding a Switch activity to check the shipMethod element of the inputVariable
and select a different JMS Adapter service to invoke based on its value.
Note: This choice of shipping company service to be invoked is later changed to a
business rules implementation.
• Invoking the different JMS Adapters within branches of the Switch activity.

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 160


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

Practice 8-1: Create the CreditCardValidation External Reference


In this practice, you modify the POProcessing composite application by creating an
external reference to the CreditCardValidation composite application, and create wire to
it from the ApproveCCOrder BPEL component. The following image shows the changes
to 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
To complete these tasks, perform the following steps:d
1) On the JDeveloper Application
z @
u Navigator,
h is open the POProcessing
z
eif it is not t
ealready open.
composite.xml file,
a y u s
s hilp se to
Create the(ValidateCCService External Reference
z u e n
2) yInethe lic
z composite.xml window, drag a Web Services component from the
a
ilp Component Palette into the External References column.
sh

Oracle SOA Suite 11g: Build Composite Applications 161


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-1: Create the CreditCardValidation External Reference
(continued)
3) In the Create Web Service window, set Name to ValidateCCService and Type
is Reference. Set the WSDL URL to the CreditCardValidation service by using
the SOA Resource Browser, after which the Port Type will be set to
validateCC_ptt. Use the following screenshot as a guide to configure the
external reference:

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

Note: If it helps use the following steps to fill
o n t Web Service window:
o in theeCreate
a) In Name enter ValidateCCService, y h
a Sand t udaccept default Type value of
Reference.
z z u@ this
a y e s e
lp
b) To the rightiof the WSDL
t o uURL field, click the Find Existing WSDLs icon ( ) to
open the h
(sSOA nResource
se Browser window.
z u e
yc)ezthe
In the SOAlicResource Browser window, select the Resource Palette option from
i l p a pull-down menu, expand the Application Server > soaserver > SOA >
sh CreditCardValidation [1.0] (soa_server1) entry, select ValidateCreditCard_ep and
click OK.

Oracle SOA Suite 11g: Build Composite Applications 162


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-1: Create the CreditCardValidation External Reference
(continued)
d) In the Create Web Service window, the WSDL URL is populated with your
selection from the SOA Resource Browser window and the Port Type is
populated with the validateCC_ptt option, which is the only possible value for this
service endpoint. Click OK to create the external reference.
4) In the composite.xml window, verify that the external reference icon has been
added 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 Stto d
u ValidateCCService
Create the Wire from ApproveCCOrder@
zu create s
thi a wire from the ApproveCCOrder BPEL
5) In the composite.xml e zwindow,
e
yValidateCCService.
composite icon to
i l p a
the
t o us Use the following image as a guide:
h
(s nse
z z u c e
y e l i
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 163


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-1: Create the CreditCardValidation External Reference
(continued)
Note: Creating the wire from the ApproveCCOrder BPEL Process component to the
ValidateCCOrderService has also created a partner link in the
ApproveCCOrder.bpel file.

b le
fer
As shown in the above image, you can verify the partner link is created if you open a
the ApproveCCOrder.bpel file, which can be done by double-clicking the
ans
- t r
ApproveCCOrder.bpel file (in the Application Navigator) or the double-clicking
n
ApproveCCOrder BPEL Process component icon.
a no
aofs the ValidateCCService
6) Verify that your composite application, shows the addition
) h eฺ
external references wired to the ApproveCCOrder m
o BPEL Process
u i dcomponent, as
shown in the following image, 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
ilp a
sh

7) Save the changes to your composite application and the ApproveCCOrder BPEL
component.

Oracle SOA Suite 11g: Build Composite Applications 164


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder
In this practice, you edit the ApproveCCOrder BPEL process to implement activities for
credit card validation in the Scope_validatecc. The following image shows the resulting
changes to the BPEL process flow:

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 changes made to the BPEL Process include adding the following activities into
Scope_validatecc:
• An Assign activity to supply the credit card validation request data
• An Invoke activity to initiate a synchronous validateCC operation of the
ValidateCCService
• A Switch activity to check the response returned by the service. In the Switch
activity:
o The Scope_fulfillment is dragged into the <case> branch after you
configure its condition expression to checks for a VALID return string
from the validateCC operation
o An Assign activity is created in the <otherwise> branch to set the order
status to indicate the credit card is invalid.

To complete this task, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 165


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
1) Open the ApproveCCOrder BPEL Process component file in the BPEL Editor.
Note: You may already have the BPEL file open due to verifying the presence of the
ValidateCCService partner link in step 5) of the previous practice in this lesson titled
“Create the CreditCardValidation External Reference”.

Create a Synchronous Invocation Pattern Flow in Scope_validatecc


In this section you create the typical activity flow for a synchronous service invocation,
which contains an Assign activity followed by an Invoke activity. What occurs after the
Invoke activity depends on how the response data is used by the process. In this case, you
check the results with Switch activity.
Note: The Invoke activity is configured first because it creates the variable needed for the
Assign activity that is added before the Invoke activity.
b le
2) In the ApproveCCOrder.bpel Design window, locate and expand the
fer a
s
Scope_validatecc activity, and delete the existing Empty activity contained within the
an
scope. In the Confirm Delete window, click Yes.
n - t r
no
3) In the ApproveCCOrder.bpel Design window, inside the Scope_validatecc
a
following table: ) has ideฺ
activity create three named activity types in the order that they are listed in the

ฺ c om t Gu
Activity Type Activity nameoo nPurpose
a. Assign h d e
a Stu Assign credit card number to
y
Assign_ccinfo

z z u@ this the credit card validation

a y e s e service request variable.


b. Invoke lp
i t o u
Invoke_validatecc Invoke the credit card
( h
s nse validation service.
z u
c.z Switchce Switch_ccvalid Check the response from the
y e l i credit card validation service.
i l p a
sh Note: Use the following image as a guide to the resulting process flow within the

Oracle SOA Suite 11g: Build Composite Applications 166


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
Scope_validatecc activity:

b le
fer a
ans
n - t r
a no
s ฺ
haflow
If you require help to perform the task of constructing)the
m i d e the
inside
Scope_validatecc activity, perform the followingosteps: G
ฺc nt u
o o
a) Drag an Assign activity from the Component
Scope_validatecc activity. y de into the expanded
ah StuPalette
b) Double-click the Assignz z u@ name
activity t h isand rename it to Assign_ccinfo.
a y e s e
ilp activity
c) Drag an Invoke u
tofrom the Component Palette and drop it inside
( s h e
z z u censafter the Assign_ccinfo activity.
Scope_validatecc
li the Invoke activity name and rename it to Invoke_validatecc.
yd)e Double-click
i l p a
sh e) Drag a Switch activity from the Component Palette and drop it inside
Scope_validatecc after the Invoke_validatecc.
f) Double-click the Switch activity name and rename it to Switch_ccvalid.
4) Save the changes to your BPEL process.

Configure the Invoke Activity with Local Variables


In this section, you first configure the Invoke activity to invoke the ValidateCCService,
which involves linking the Invoke activity with ValidateCCService partner link and
creating variables to communicate the request data and receive the response.

Oracle SOA Suite 11g: Build Composite Applications 167


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
5) In the ApproveCCOrder.bpel process, to associate the Invoke activity with its
partner link and operation, drag a line from the Invoke Settings icon ( ) on the
right-edge of the Invoke_validatecc activity to the ValidateCCService icon in the
Partner Link 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: The Edit Invoke window is opened when you perform this step.
6) In the Edit Invoke window, when opened already contains the correct Name, Partner
Link, and Operation field settings, because there is only one operation provided by
the service.
To automatically configure variables that supply the request (input) and response
(output) data for the service invocation, use instructions in the following table and
associated screenshots:
Step Screen/Page Description Choices or Values
a. Edit Invoke On the right of the Input field, click the
Automatically Create Input Variable icon ( )
Note: Creating a variable in this way ensures the
variable has the correct XML message structure for
the service request.
b. Create Variable Accept the default variable name, select the Local
Variable option, and click OK.

Oracle SOA Suite 11g: Build Composite Applications 168


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
Step Screen/Page Description Choices or Values
c. Edit Invoke On the right of the Output field, click the
“Automatically Create Output Variable” icon ( )
d. Create Variable Accept the default variable name, select the Local
Variable option, and click OK.
e. Edit Invoke Verify your Invoke activity settings and that both the
Input and Output fields contain a variable name.
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
z z u cen
ye li
i l p a
sh
b)

Note: The default naming convention applied by JDeveloper is to construct the


variable name by concatenating the activity name with an underscore and the
operation name an underscore and the string InputVariable. The string
OutputVariable is used at the end for output variables (responses).

Oracle SOA Suite 11g: Build Composite Applications 169


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (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
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 170


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
e)

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 @
uthe Errors
h isindicator should be removed, provided you
Note: When you clickzOK
e thesInvoket
e activity settings.
a y
have correctly configured u
s hilpto the
7) Save the changes
( e to process.
BPEL
z z u cens
yethe Assign
Edit li Activity to Supply Credit Card Information
a
ilpNow that the input variable has been created for the Invoke activity, you can populate the
sh input variable with the credit card data needed to perform the validateCC operation
provided by ValidateCCService.
8) To populate the input variable for the Invoke_validatecc activity, edit the
Assign_ccinfo activity and create the following two copy operations:

Oracle SOA Suite 11g: Build Composite Applications 171


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
a) Copy the cardNumber element in the order element of the process inputVariable
to the CCNumber element of the CreditCheckRequest in the
Invoke_validatecc_validatecc_inputVariable.
Note: Remember you created Invoke_validatecc_validatecc_inputVariable as
local variable in Scope_validatecc. Use the following screenshot 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 172


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
b) Copy the orderTotal element in the order element of the process inputVariable to
the amount element of the CreditCheckRequest in the
Invoke_validatecc_validatecc_inputVariable. 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 @ is two copy operations have been created and
u thattyour
h
e z
c) In the Assign window, verify
click OK. pay u se
( s hil se to
z z u cen
ye li
i l p a
sh

9) Save the changes to your BPEL process.

Configure the Switch Activity <case> Branch Condition


In this section, configure the Switch <case> condition to check if the response message
received through the Invoke_validatecc activity contains the string VALID.

Oracle SOA Suite 11g: Build Composite Applications 173


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
10) In the ApproveCCOrder.bpel Design window, expand the Switch_ccvalid
activity.
11) In the ApproveCCOrder.bpel Design window, click the View Condition
Expression icon ( ) in the <case> branch heading.

b le
fer a
an s
n - t r
n o
a
12) In the Condition Expression window, click the XPath Expression
s Builder icon ( )
h a
) uide ฺ
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
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 174


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
13) In the Expression Builder window, create an XPath expression that compares if the
status element in the Invoke_validatecc_validateCC__OutputVariable > reply >
CreditCheckResponse tree is equal to the string literal uppercase value 'VALID'.
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
ClickzOK n the complete Expression shown.
u aftercbuilding
e
ye l i
i l p a14) In the ApproveCCOrder.bpel Design window, verify your condition is correctly
sh shown and click outside the Condition Expression window:

15) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 175


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
Configure the <case> Branch Activity Flow
In this section, configure the activity sequence in the Switch <case> branch to execute the
Scope_fulfillment for VALID credit card orders.
16) In the ApproveCCOrder.bpel Design window, collapse the Scope_fulfillment
activity and drag it into the <case> branch of the Scope_validatecc 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 Note: It is easier to drag the Scope when it is in the collapsed state. However, the
sh BPEL Editor expands the Scope_fulfillment activity after it is dropped in the <case>
branch.
17) Save the changes to your BPEL process.

Configure the <otherwise> Branch Activity Flow


In this section, configure the activity sequence in the Switch <otherwise> branch to
execute an Assign activity that sets the outputVariable status element to indicate that the
credit card is not valid.

Oracle SOA Suite 11g: Build Composite Applications 176


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
18) In the ApproveCCOrder.bpel Design window, drag an Assign activity into the
<otherwise> branch of the Scope_validatecc activity.

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
19) Renameuthe Assign
c e nactivity to Assign_invalidcc.
ye l i
il p a
sh

Oracle SOA Suite 11g: Build Composite Applications 177


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
20) Edit the Assign_invalidcc activity and create one copy operation, which copies the
literal string expression ‘invalid credit card’ to the status element in the
outputVariable process 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 a21) In the Assign window, verify the copy operation is created and listed and click OK.
sh

Oracle SOA Suite 11g: Build Composite Applications 178


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-2: Invoke Credit Card Validation from
ApproveCCOrder (continued)
22) In the ApproveCCOrder.bpel Design window, verify that your process flow
contains the Scope_fulfillment activity in the Switch <case> branch and the
Assign_invalidcc activity in the <otherwise> branch. 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 a23) Save the changes to your BPEL Process.
sh

Oracle SOA Suite 11g: Build Composite Applications 179


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

Practice 8-3: Invoke the Fulfillment Process from


ApproveCCOrder
In this practice, you expand the Scope_fulfillment activity and create an activity sequence
for an asynchronous invocation pattern to invoke the Fulfillment BPEL Process for orders
with a valid credit card. You use an Assign activity copy the response from the
Fulfillment service to the order status in the outputVariable. The response value
‘completed’ indicates the order has been shipped. The status value ‘waiting’ indicates
some or all the ordered products are out of stock and cannot be shipped.

Note: Remember you have already created the fulfillmentRequest and


fulfillmentResponse variables in the scope for interaction (exchanging input and output
data, respectively) with the Fulfillment BPEL process. Therefore when you configure the b le
Invoke activity you browse for and use the existing variables instead of automatically fer a
an s
n - t r
creating new variables. In addition, the Scope_fulfillment activity contains a Transform
activity that has already initialized the input data in the fulfillmentRequest variable.
a no
To complete this task perform the following steps:
) has ideฺ
1) In the ApproveCCOrder.bpel Design window,
ฺ c omif needed,
t G uexpand the
o o of the
Scope_fulfillment activity in the <case> branch
h e nSwitch_validatecc activity.
ya Stu d
Create the Activity Flow Sequence
z @
u thisto Invoke the Fulfillment Service
In this section you createy z
e Receive,
Invoke, e and Assign activities to form the sequence
a u s
hilp seinteract
needed to asynchronously
( s to with the Fulfillment BPEL process.
z u cen
2) In thezApproveCCOrder.bpel Design window, after the Transform_fulfillment
l i
e add the three named activity types in the sequence shown in the following
yactivity
il p a table:
sh Activity Type Activity Name
a. Invoke Invoke_fulfillment
b. Receive Receive_fulfillment
c. Assign Assign_fulfillment_status

Note: Use the following image as a visual aid to the layout and sequence of the
activities in the Scope_fulfillment activity:

Oracle SOA Suite 11g: Build Composite Applications 180


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (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
ilpto create
If you requirehhelp
s e tothe flow, then perform the following steps:
(
u an Invoke s into Scope_fulfillment and drop it after the
nactivity
z z
a) Drag
li c e
a ye Transform_fulfillment activity. Rename the Invoke activity to
i l p Invoke_fulfillment.
sh b) Drag a Receive activity into Scope_fulfillment and drop it after the
Invoke_fulfillment activity. Rename the Receive activity to
Receive_fulfillment.
c) Drag an Assign activity into Scope_fulfillment and drop it after the
Receive_fulfillment activity. Rename the Assign activity to
Assign_fulfillment_status.
3) Save the changes to your BPEL Process

Configure the Invoke_fulfillment Activity


4) In the ApproveCCOrder.bpel Design window, double-click the
Invoke_fulfillment activity to open the Invoke settings window.
5) To configure the Invoke activity settings, use instructions in the following table and
associated screenshots as a guide:

Oracle SOA Suite 11g: Build Composite Applications 181


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
Step Screen/Page Description Choices or Values
a. Invoke Partner Link: Click the Browse Partner
Links icon ( )
b. Partner Link Chooser In the Process > Partner Links tree select
Fulfillment.fulfillment_client, and click OK.
Note: The Operation field is set to
“process,” the only operation provided by
the Fulfillment service.
c. Invoke Input: Click the Browse Variables icon ( )
d. Variable Chooser In the Process > Scope – Scope_validatecc >
Scope – Scope_fulfillment > Variables tree,
select fulfillmentRequest and click OK.
b le
fer a
Note: Since the Fulfillment service is
an s
- t r
asynchronous you cannot specify an output
n
no
variable for the response. Therefore, a
a
has ideฺ
Receive activity is used to get the response.
e. Invoke )
Verify your settings and click OK.
ฺ c om t Gu
Note: An alternative way to do steps a) and
h o ob) is to edrag
n a line connecting the right-
d
a Stu activity to the Fulfillment
edge Invoke Settings icon from theyInvoke_fulfillment
partner link. However, the table
z @
u this is suggested to avoid scrolling the
of instructions
window to accommodate
y z
e the dragseand drop approach.
i lp a o u
a) h
(s nse t
z z u c e
y e l i
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 182


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
b)

b le
fer a
ans
n - t r
a no
c)
) 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 183


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
d)

b le
fer a
ans
n - t r
a no
) has ideฺ
e) ฺ 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 184


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
6) In the ApproveCCOrder.bpel Design window, verify that the Invoke_fulfillment
activity is linked to the Fulfillment Partner Link as shown in the following image:

7) Save the changes to your BPEL process. b le


fer a
Configure the Receive_fulfillment Activity ans
n - t r
no
8) In the ApproveCCOrder.bpel Design window, drag a line from the Receive
a
has ideฺ
Settings icon (on the right-edge) of the Receive_fulfillment activity to the
Fulfillment.fulfillment_client partner link. )
ฺ c om t Gu
Note: The Fulfillment callback operation, called “processResponse,” is used to
o o n
receive a response from an asynchronous service. The Operation and Partner Link
h e
ya Stu
fields are set by performing this step. 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 185


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
9) In the Edit Receive window, browse for and select fulfillmentResponse for the
Variable to receive the response data from the Fulfillment service.
Hint: Click the Browse Variables icon ( ), and in the Variable Chooser and select
the fulfillmentResponse variable in the nest Scope called Scope_fulfillment. Use the
following image as a guide to the Invoke activity settings:

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
Configure
z z e n
u thecAssign_fulfillment_status Activity
e
TheyFulfillment l i
BPEL service returns a shipStatus and carrier response values. In this
p a
il section you configure the Assign activity to copy the shipStatus from the
sh fulfillmentResponse to the process outputVariable’s order > status element.
10) In the ApproveCCOrder.bpel Design window, double-click the
Assign_fulfillment_status activity to edit the activity and add a copy operation.

Oracle SOA Suite 11g: Build Composite Applications 186


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
11) Configure the Assign_fullfillment_status activity with a copy operation that copies
the shipStatus from the fulfillmentResponse variable to the outputVariable order >
status element. 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 187


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
12) Verify that your Scope_fulfillment activity sequence resembles 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
13) Save the changes to your z
e BPEL sprocess
e and project.
a u
hilp completed
Note: You havesmostly
( e to the main end-to-end flow for the ApproveCCOrder
z z c e ns enables you to construct the core flow pattern for the
u next practice
process. The
e BPELli process. After this lesson’s practices, you update and change the BPEL
Fulfillment
y
a
ilpprocess flow (and composite application) implementation to include business rules and
sh human workflow patterns where applicable.

Oracle SOA Suite 11g: Build Composite Applications 188


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process
In this practice, you modify the Fulfillment BPEL Process by creating and configuring
three JMS Adapter partner links, one for each shipping company: UPS, USPS, and
FedEx. The following image shows how you modify the process flow with a Switch to
check the shipMethod chosen by the customer and create the order shipping request
message for an invoke activity for each JMS Adapter:

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
To complete these ilp perform
htasks e to the following steps:
( s
u cencomposite.xml
e z
1) In thez i
POProcesing
l window, double-click the Fulfillment BPEL
y
ilpa
Process component icon, to open it in the BPEL Editor.
sh Create and Configure JMS Adapter Partner Links
2) In the Fulfillment.bpel Design window, create a JMS Adapter partner link
using the following steps:

Oracle SOA Suite 11g: Build Composite Applications 189


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
a) On the Component Palette, click the BPEL Services pane to expose the adapter
component icons, among others.

b le
fer a
ans
n - t r
no
b) In the Fulfillment.bpel Design window, drag the JMS Adapter from the
a
) has ideฺ
Component Palette into the right-hand Partner Link column.
Note: This opens the Adapter Configuration Wizard window.
ฺ 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

3) In the Adapter Configuration Wizard window, step through the pages to configure the
JMS Adapter for the UPS shipping company by using instructions in the following
table and associated screenshots:
Step Screen/Page Description Choices or Values
a. Welcome Click Next.
b. Service Name Service Name: UPSJmsService
Click Next.

Oracle SOA Suite 11g: Build Composite Applications 190


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
Step Screen/Page Description Choices or Values
c. JMS Provider Select the Oracle Enterprise
Messaging Service (OEMS) option and
the Oracle WebLogic JMS option from
the pull-down menu.
Click Next.
d. Server Connection Connection exists in: Select the Resource
Palette option
Connection: soaserver
Click Next.
e. Adapter Interface Accept the default “Define operation and
schema (specified later)” option e
Click Next. a b l
f. Operation Operation Type: Select the Produce s fer
Message option. - t r an
no n
Operation Name: Accept the default value of
a
has ideฺ
Produce_Message
Click Next. )
g. Produce Operation Parameters om t Gu
Destination Name (Queue):
ฺ c
h o o n
jms/demoFulfillmentQueue
e
ya Stu d
JNDI Name: eis/demo/Queue
z @
u this Accept default settings for other fields.
y e z e Click Next.
a u s
hilp se to
Note: To set the Destination field click Browse
( s
u cen
and select the queue name from the Select
z z li
Destination window. Manually change the
a ye JNDI Name as specified.

sh ilp h. Messages URL: xsd/fulfillment.xsd


Schema element: ShippingRequest
Click OK when done. However, first read the
following note:
Note: To set these values click the Browse
icon ( ) next to the URL field and in the
Type Chooser select the ShippingRequest
element under the Project Schema files >
fulfillment.xsd.
Click Next.
i. Finish Click Finish.

Oracle SOA Suite 11g: Build Composite Applications 191


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
a)

b le
b) 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) zzu c e n
ye l i
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 192


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
d)

b le
fer a
ans
n - t r
a no
e)
) 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 193


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
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
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 194


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
g) To select the Destination click Browse next to the Destination Name (Queue)
field and on the Select Destination window, scroll down and select
demofulfillmentQueue under the SOAJMSModule folder, 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 se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 195


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
Enter the correct JNDI Name value (eis/demo/Queue), which is already
configured in the run-time environment:

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 icon ( ) to display the Type Chooser
h) On the Messages page,
y z click the Browse
ethe ShippingRequest
e
a
where you can select
p u s element from the
i
h se l t o (either nested in the fulfillment.xsd or the
s
internalorder.xsd
(
u Schema
Project nFiles folders):
z z l i c e
a ye
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 196


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

b le
fer a
ans
n - t r
a no
i)
) 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 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
4) In the Create Partner Link window, which is displayed after completing the steps in
the Adapter Configuration Wizard, accept the default settings as shown in the
following image and click OK:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
5) In the Fulfillment.bpel Design yawindow, d
tuconfirm that the partner link for the
@
u thi
JMS Adapter exists in the Partner Link s S
column the right-side of the window.
e z z
a y u s e
( s hilp se to
z z u cen
ye li
a
ilp6) Click on the POProcessing composite.xml window, and observe that a wire has
sh been created between the Fulfillment BPEL Process component icon and the newly
added UPSJmsService external reference icon. Use the following image as guide:

Note: This should remind you that when creating a partner link in a BPEL process it
changes the assembly model in the associated composite.xml file with the
addition of the external reference wired to the BPEL component in which the partner
link is created.
7) Save the changes to your BPEL process

Oracle SOA Suite 11g: Build Composite Applications 198


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
8) In the Fulfillment.bpel Design window, create a JMS Adapter partner link and
using the Adapter Configuration Wizard configure the second JMS Adapter as the
USPS service by using instructions in the following table (no screenshots are
provided):
Step Screen/Page Description Choices or Values
a. Welcome Click Next.
b. Service Name Service Name: USPSJmsService
Click Next.
c. JMS Provider Select the Oracle Enterprise Messaging
Service (OEMS) option and the Oracle
WebLogic JMS option from the pull-down menu.
Click Next. b le
d. Server Connection Connection exists in: Select the Resource fer a
Palette option. ans
Connection: soaserver n - t r
Click Next. a no
e. Adapter Interface has ideฺ
Accept the default “Define operation and schema
)
(specified later)” option.
Click Next. ฺ c om t Gu
h o o e n
f. Operation d
Operation Type: Select the Produce Message
ya Stu
option.
@
z z u this
Operation Name: Accept the default value of
a y e s e
u
Produce_Message

( s hilp se to Click Next.


g.
z z u Operation
Produce
c e n Destination Name (Queue):
ye l
Parameters i jms/demoFulfillmentQueue
il p a JNDI Name: eis/demo/Queue
sh Accept default settings for other fields.
Click Next.
h. Messages URL: xsd/fulfillment.xsd
Schema element: ShippingRequest
Note: If you click the Browse icon to select the
schema element, then click OK.
Click Next.
i. Finish Click Finish.
j. Create Partner Link Click OK.
9) Save the changes to your BPEL process.
10) In the Fulfillment.bpel Design window, create a JMS Adapter partner link and
using the Adapter Configuration Wizard configure the third JMS Adapter as the
FedEx service by using instructions in the following table (no screenshots are
provided):

Oracle SOA Suite 11g: Build Composite Applications 199


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
Step Screen/Page Description Choices or Values
a. Welcome Click Next.
b. Service Name Service Name: FedExJmsService
Click Next.
c. JMS Provider Select the Oracle Enterprise Messaging
Service (OEMS) option and the Oracle
WebLogic JMS option from the pull-down menu.
Click Next.
d. Server Connection Connection exists in: Select the Resource
Palette option
Connection: soaserver
Click Next.
b le
e. Adapter Interface Accept the default “Define operation and schema
fer a
(specified later)” option
ans
Click Next.
n - t r
f. Operation no
Operation Type: Select the Produce Message
a
has ideฺ
option
)
Operation Name: Accept the default value of
c om t Gu
Produce_Message

o o
Click Next.
h e n
g. Produce Operation ya Stu d
Destination Name (Queue):
Parameters z @
u this
jms/demoFulfillmentQueue
y e z e
JNDI Name: eis/demo/Queue
a u s
( s hilp se to Accept default settings for other fields.
Click Next.
h. z z u cen
Messages URL: xsd/fulfillment.xsd
ye li
ilp a Schema element: ShippingRequest
sh Note: If you click the Browse icon to select the
schema element, then click OK.
Click Next.
i. Finish Click Finish.
j. Create Partner Link Click OK.
11) Save the changes to the BPEL process and to the POProcesing composite application.

Oracle SOA Suite 11g: Build Composite Applications 200


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
12) In the POProcessing composite.xml window, verify that the assembly model
resembles the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o
Note: The Fulfillment BPEL Process component
o hasethreen wires, where each wire is
ya reference. d
tu Remember, you could have also
linked to a different JMS adapter external
@
u Adapters s S
created and configured the
e z zJMS
e t hi as external references in the
composite.xmlaand
p y wireduthem
s to the Fulfillment BPEL Process component to
l
i et
yield the samehresults. o
u ( s n s
z z c e
Addea Switchli to Choose the JMS Adapter for the Shipment Request
a y
sh ilpIn this section you create the activity sequence in the Scope_shiporder that uses a Switch
with three <case> branches to determine which JMS service is used to send the shipment
request for an order based on the shipMethod value in the FulfillmentRequestMessage
structure in the inputVariable. You then set the correct response values for the status and
selected carrier in the FulfillmentResponseMessage structure of the outputVariable.
13) In the Fulfillment.bpel Design window, expand the Scope_shiporder activity.

Note: On the Component Palette, you might need to click the BPEL Activities and
Component pane to expose the BPEL activities needed for the next set of steps.

Oracle SOA Suite 11g: Build Composite Applications 201


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
14) In the Fulfillment.bpel Design window, in the Scope_shiporder activity add a
Switch activity named Switch_shiporder at the beginning of the scope. Ensure the
Switch has three <case> branches, and move the existing Assign_shipstatus activity
into the <otherwise> branch as shown in the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
m Ginuthe Scope_shiporder
cosequence
Note: Only if you require help to create theoflow ฺ n t
activity, perform the following steps: ho e
y a Stud
a) Drag a Switch activity as u
z @first activity
the
h is in Scope_shiporder.
z t
eactivity sSwitch_shiporder.
e
b) Rename the Switch a y u
c) Expand(s
lp to activity.
hiSwitch_shiporder
the e
uthe left cofethensSwitch_shiporder activity icon, click the Add Switch Case icon
d) z z
To li
a ye ( ) twice to create two new <case> branches:
i l p
sh

e) Drag the Assign_shipstatus activity into the <otherwise> branch.


15) Configure first <case> branch name and condition expression for the UPS service by
performing the following steps:
a) On the left-most <case> branch, to edit the branch name and expression, double-
click the text “<case>” shown in the <case> branch title bar (in the grey heading
with the “<case>” text and associated icons. Do not click the warning or condition
expression icons). Use the following image as a guide:

Note: Alternatively, right-click the <case> title bar and select Edit.

Oracle SOA Suite 11g: Build Composite Applications 202


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
b) In the Switch Case window in the General tab page, enter UPS in Name.
Note: The value in the Name field becomes a useful visual indicator in the <case>
branch title after you complete this step.
To create the Expression, click the XPath Expression Builder icon ( ) to
construct a conditional expression comparing if the inputVariable > payload >
FulfillmentRequest > shipMethod element is equal to the lower case string literal
'two_day'. For example:

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

Click OK after both fields are completed. 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: Only if you require help to build the expression, use the following
instructions:
i) In the Switch Case window, click the XPath Expression Builder icon ( ) for
the Expression field.
ii) In the Expression Builder window, in the Variables section expand the
inputVariable > FulfillmentRequest tree, select shipMethod and click “Insert
into Expression”
iii) In the Expression field append the text ='two_day' (including the single
straight quotes) and click OK.
16) Configure second (middle) <case> branch name and condition expression for the
USPS service by performing the following steps:
a) On the middle <case> branch, double-click the text “<case>” shown in the title.

Oracle SOA Suite 11g: Build Composite Applications 203


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
b) In the Switch Case window in the General tab page, enter USPS in Name, and
create and Expression, by clicking the XPath Expression Builder icon ( ), that
compares if the inputVariable > payload > FulfillmentRequest > shipMethod
element is equal to the lower case string literal 'five_day'. For example:

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

Click OK after both fields are completed. 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
17) Configure ( ns <case>
third right-most
uservice branch name and condition expression for the
e z
FedExz li c
byeperforming the following steps:
y
sh ilpa a) On the middle <case> branch, double-click the text “<case>” shown in the title.
b) In the Switch Case window in the General tab page, enter FedEx in Name, and
create and Expression, by clicking the XPath Expression Builder icon ( ), that
compares if the inputVariable > payload > FulfillmentRequest > shipMethod
element is equal to the lower case string literal 'next_day', or if the
shipMethod is equal to 'international'. For example:

bpws:getVariableData('inputVariable','payload',
'/ns1:FulFillmentRequest/ns5:shipMethod') = 'next_day'
or bpws:getVariableData('inputVariable','payload',
'/ns1:FulFillmentRequest/ns5:shipMethod') =
'international'

Click OK after both fields are completed. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 204


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

b le
fer a
ans
n - t r
a no
18) Save the changes to your Fulfillment BPEL Process, after
h s ฺthat your
averifying
Switch_shiporder activity appears as shown in the m
o
)
following u ide
image:

o o ฺc nt G
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to
u names
Note:zThe
z c e n USPS, and FedEx (as specified in each of the Switch Case
UPS,
l i
e now appear as visual annotations in the title for each <case> branch.
ysettings)
il p a
sh Create a Local Variable in Scope_shiporder for Shipping Requests
In this section, you create a variable called shippingRequest whose type is the
ShippingRequest element in the project’s fulfillment.xsd file.

You create an Assign activity called Assign_shiporder, inside Scope_shiporder before the
Switch_shiporder activity, to initialize the variable elements. This variable is used in
transform activities to copy the elements to the message structures sent to the JMS
service selected by one of the Switch <case> branches.

Oracle SOA Suite 11g: Build Composite Applications 205


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
19) With the Scope_shiporder activity expanded, click the Variables icon, and in the
Create Variables window add a new variable called shippingRequest whose type is
the ShippingRequest element in the project’s fulfillment.xsd file. 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
Note: Only if you require
z
e help toscreate
e the variable, perform the following steps:
a u
s hilp sScope_shiporder,
a) On the(expanded e to click the Variables icon ( ).
u n
e window, click the Create icon ( ).
Inzthe Variables
b)ez l i c
a y
i l p c) In the Create Variable window, perform these steps:
sh i) In the Name field enter: shippingRequest
ii) In the Type section, select the Element option. Click the Browse icon next to
the Element field, and in the Type Chooser locate and expand Project Schema
Files > fulfillment.xsd and select the ShippingRequest element, click
OK.
iii) Click OK.

d) In the Variables window, click OK to close the window.

Oracle SOA Suite 11g: Build Composite Applications 206


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
20) In the Fulfillment.bpel Design window, drag an Assign activity into the
Scope_shiporder scope before the Switch_shiporder activity. Rename the Assign
activity to Assign_shiporder. Use the following image as a guide:

b le
fer a
ans
n - t r
no
21) Configure the Assign_shiporder, with three copy operations to initialize the contents
a
(and their associated screenshots as a guide): ) has ideฺ
of the shippingAddress variable (in the Scope_shiporder). Use the following steps

c o m Gu
a) Create a copy operation that copies the o
o ฺ n t in the inputVariable to the
orderId element
h
a variable:
orderId element in the shippingRequest ud e
y S t
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 207


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
b) Create a copy operation that copies the customerId element of the inputVariable,
to the custName element in the shippingRequest variable:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
ya the following
tu XML Fragment into the
c) Create a copy operation that @ copies s S
e
shippingAddress elementz zuof the shippingRequest
thi variable:
a y u s e
h i lp t o
(s nse
<ns0:shippingAddress
u
e z z l i e
xmlns:ns0="http://www.example.org/ns/fulfillment">
c
a y <ns0:street></ns0:street>
i l p <ns0:city></ns0:city>
sh <ns0:state></ns0:state>
<ns0:zip></ns0:zip>
<ns0:country></ns0:country>
</ns0:shippingAddress>

Oracle SOA Suite 11g: Build Composite Applications 208


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
Note: At this stage, since service and associated activities for obtaining the
customer address data have not been created, you initialize the XML address
elements to the empty elements shown. To save time, open the file
D:\labs\files\xml\shipAddress.xml and copy the contents into the
XML Fragment area of the copy operation. Observe that the Type in the “From”
section is set to XML Fragment.

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 fragment h is the XML Namespace prefix and its
Note: When copying z
an XML t
erequired stoepreserve the BPEL process source XML structure.
a y u
h i lp
associated path are
t o
(s tonyour
22) Save the changes
u se BPEL Process.
z lic
ez and Configuree
y
Create the <case UPS> Branch Activities
sh ilpa
In this section, you create an Invoke activity to invoke the UPSJmsService and Assign
with multiple copy operations preparing the JMS service request message. In the same
Assign activity create copy operations to set 'UPS' as the carrier and 'completed' as
the status in the outputVariable.
23) Inside the <case UPS> branch, create the sequence of case-sensitively named
activities listed in the following table:
Activity Type Activity Name
a. Assign Assign_toUPS
b. Invoke Invoke_UPS

Oracle SOA Suite 11g: Build Composite Applications 209


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:

b le
fer a
a n s
n
24) Configure the Invoke_UPS activity to execute the Produce_Message operation
r
-t of the
UPSJmsService, and use the Automatically Create Input Variable
o
nicon to create a
a
local variable, by performing the following steps:
) has ideฺ
a) Drag a line from the Invoke_UPS activity to o
c mUPSJmsService
the
G u
o ฺ t
o the Automatically
n
b) In the Edit Invoke Activity window,hclick
a Swindow d e Create Input
u ensure the Local Variable
Variable icon, and in the CreateyVariable t
u@ this
option is selected. ClickzOK.
z
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

25) Configure the Assign_toUPS activity with the following three copy operations:

Oracle SOA Suite 11g: Build Composite Applications 210


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
a) Copy the ShippingRequest element from the shippingRequest variable into the
ShippingRequest element of the Invoke_UPS_Produce_Message_InputVariable.
Note: Both variables are nested in the Scope called Scope_shiporder.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
b) Append the literal string ' (UPS)' h o o the
including e nleading space to the custName
ya Stu d
element in the Invoke_UPS_Produce_Message_InputVariable.
Note: Appending the z z
carrier
@ is customer name is included here so that
u text ttohthe
you can see the a y e used sinethe shipping message received by the JMS message
carrier
consumerh i lp
application t o
that
uyou use in the testing section of this practice. In this
(sthe following
caseuuse n se steps to create an Append Operation:
z e
c window, click the Create icon ( ) and select Append
a yezi) In theliAssign
i l p Operation.
sh

Oracle SOA Suite 11g: Build Composite Applications 211


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
ii) In the Create Append Operation window, in the “From” section use
Expression for the Type and enter ' (UPS)' in the Expression field. In the
“To” section use Variable as the Type and select the custName child element
in the Invoke_UPS_Produce_Message_InputVariable as the target.

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 expression
e '(UPS)' into the carrier element in the
c) Copy the literalastring u s
process(s hilp se to
outputVariable.
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 212


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
d) Copy the literal string expression ‘completed’ into the shipStatus element in the
process outputVariable.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
26) Save the changes to your z z
BPEL
@
u Process.h is
e e t
a y u s
hilp se the
Create and Configure
( s to <case USPS> Branch Activities
z z u youccreate
In this section,
e n an Invoke activity to invoke the USPSJmsService and Assign
with
y emultiple l
copy i operations preparing the JMS service request message. In the same
a
ilpAssign activity create copy operations to set 'USPS' as the carrier and 'completed'
sh as the status in the outputVariable.
27) Inside the <case USPS> branch, create the sequence of case-sensitively named
activities listed in the following table:
Activity Type Activity Name
a. Assign Assign_toUSPS
b. Invoke Invoke_USPS

Oracle SOA Suite 11g: Build Composite Applications 213


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ operation of the
28) Configure the Invoke_UPS activity to execute the Produce_Message
USPSJmsService, Use the Automatically Create c m Variable
oInput G u icon to create a local
o o ฺ n t
variable, by performing the following steps:
h d e
a) Drag a line from the Invoke_USPS
@ ya activity
S tuto the USPSJmsService
zu window, s
thiclick the Automatically Create Input
e z
b) In the Edit Invoke Activity e
yin the Create
Variable icon,
i l p a
and
t o us Variable window ensure the Local Variable
h sClick
option(issselected. e OK.
z u e n
y ez lic
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 214


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
29) Configure the Assign_toUSPS activity with the following three copy operations:
a) Copy the ShippingRequest element from the shippingRequest variable into the
ShippingRequest element of the Invoke_USPS_Produce_Message_InputVariable.
Note: Both variables are nested in the Scope called Scope_shiporder.
b) Append the literal string ' (USPS)' including the leading space to the
custName element in the Invoke_USPS_Produce_Message_InputVariable. Use
the following steps:
i) In the Assign window, click the Create icon ( ) and select Append
Operation.
ii) In the Create Append Operation window, in the “From” section use
Expression for the Type and enter ' (USPS)' in the Expression field. In the b le
“To” section use Variable as the Type and select the custName child element fer a
in the Invoke_USPS_Produce_Message_InputVariable as the target. ans
n - t r
outputVariable. a no
c) Copy the literal string expression 'USPS' into the carrier element in the process
s ฺ
hathe
d) Copy the literal string expression 'completed')into
o m u ide element in
shipStatus
the process outputVariable.
o o ฺc nt G
30) Save the changes to your BPEL Process.
y ah Stude
z @ his
u<case
Create and Configure the
e z e t FedEx> Branch Activities
a y s
u activity to invoke the FedExJmsService and Assign
h i lp an Invoke
In this section, you create
t o
u s nse
with multiple (copy operations to prepare the JMS service request. In the same Assign

e z z copy
activity create
l i c eoperations to set 'FedEx' as the carrier and 'completed' as the
y
status in the outputVariable.

sh ilpa
31) Inside the <case FedEX> branch, create the sequence of case-sensitively named
activities listed in the following table:
Activity Type Activity Name
a. Assign Assign_toFedEx
b. Invoke Invoke_FedEx

Oracle SOA Suite 11g: Build Composite Applications 215


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ operation of
32) Configure the Invoke_FedEx activity to execute the Produce_Message
the FedExJmsService, and use the Automatically c m Input
oCreate G uVariable icon to create
o
a local variable, by performing the following

o steps: en t
y h
a activityt utodthe FedExJmsService
a) Drag a line from the Invoke_FedEx
u@ this S
z z
e window,
b) In the Edit Invoke Activity
a y u s e click the Automatically Create Input
Variable icon,
h i lpand in the
t o Create Variable window ensure the Local Variable
option(issselected.sClick
e OK.
z u e n
y ez lic
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 216


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
33) Configure the Assign_toFedEx activity with the following three copy operations:
a) Copy the ShippingRequest element from the shippingRequest variable into the
ShippingRequest element of the
Invoke_FedEx_Produce_Message_InputVariable.
Note: Both variables are nested in the Scope called Scope_shiporder.
b) Append the literal string ' (FedEx)' including the leading space to the
custName element in the Invoke_FedEx_Produce_Message_InputVariable. Use
the following steps:
i) In the Assign window, click the Create icon ( ) and select Append
Operation.
ii) In the Create Append Operation window, in the “From” section use b le
Expression for the Type and enter ' (FedEx)' in the Expression field. In fer a
the “To” section use Variable as the Type and select the custName childans
n - t r
element in the Invoke_FedEx_Produce_Message_InputVariable as the target.
a no
c) Copy the literal string expression 'FedEx' into the carrier element in the
process outputVariable.
) has ideฺ
c
d) Copy the literal string expression 'completed'
ฺ om into t G ushipStatus element in
the
the process outputVariable. h o o e n
yawindow, d
tuverify that your Scope_shiporder has
34) In the Fulfillment.bpel Design @ s S
the BPEL Process flowe z zu inththei following image:
represented
a y u s e
( s hilp se to
z z u cen
ye li
ilp a
sh

35) Save the changes to your BPEL Process and the POProcessing project.

Oracle SOA Suite 11g: Build Composite Applications 217


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application
In this practice, you deploy the modified POProcessing composite application and initiate
at least three tests instances with different input data. The three test cases include:
• Sending an order with a valid credit card
• Sending an order with an invalid credit card
• Sending an order with a different ship method to the first test
Note: While only three tests are done to cover the two conditions for credit cards and at
least on alternative for the ship choice, if there was time one could perform an additional
two more test to cover the remaining variations of ship methods available. All test cases
are initiated through the Oracle Enterprise Manager Web interface.

To complete the testing tasks, perform the following steps e


a b l
1) Using JDeveloper, deploy the POProcessing project to the soaserver connection.
s fer
When the SOA Deployment Configuration Dialog window is displayed select the
“Overwrite any existing composites with the same revision ID.” Option. - t r an
no n
Note: If the Authorization Request window is displayed, enter the username
a
successfully deployed. ) has ideฺ
weblogic and password welcome1. Ensure the composite application is

ฺ com nManager
2) In a Web browser window, enter the OracleoEnterprise t Gu URL
http://localhost:7001/em. If required a h owith Username:
login de weblogic with
y t u
Password: welcome1.
z u @ his S
ezManager e t
a y
3) On the Oracle Enterprise s home page, locate and click the deployed
u application link (located under the SOA tree in the
lp composite
“POProcessing i[1.0]”
h t o
(s pane).
Farm navigation
u n se
z lic e
ezthe “POProcessing
4) yOn [1.0]” page, click Test.
ilp a
sh Test 1: Order with a Valid Credit Card and two_day Ship Method
For this test you use the D:\labs\files\xml_in\po-small-ipod.xml file as
input.
5) To run the first test, perform these steps:
a) In JDeveloper, select File > Open and select the
D:\labs\files\xml_in\po-small-ipod.xml file. First copy all the
text in the file into the clipboard, and then close the po-small-ipod.xml
window.
b) On the “POProcessing [1.0]” page in the Web browser, in the Request tab Input
Arguments section, select the XML View, and paste the clipboard contents into
the text area. Click Test Web Service.
c) On the Response tab, click the Launch Message Flow Trace link.
6) On the Flow Trace page, under the Trace section examine the Trace Flow. Answer
the following questions:

Oracle SOA Suite 11g: Build Composite Applications 218


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
a) Was the order processed by the Fulfillment BPEL process? Explain how you
verified your answer.
b) Which JMS Adapter service received the shipping request, and why was the
specific JMS Adapter used?
c) In the Audit Trail or the Flow tabbed page for the ApproveCCOrder, which
activity receives the response from the ValidateCCService? What is the response
messaged child element name that contains the validation information, and what
validation value was returned?
Step Answers for Step 6
a. Yes, the order was processed by the Fulfillment BPEL Process. In the Trace tree on
the Flow Trace the Fulfillment BPEL component appears below the ApproveCCOrder
entry with the state Completed. The Trace tree resembles 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
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 219


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
Step Answers for Step 6
b. The UPSJmsService received the shipping request. This can be seen by the
appearance of UPSJmsService below the Fulfillment entry in the Flow Trace tree.
Click the Fulfillment link the Trace tree and click the Flow tab and you can see the
names of the Assign_toUPS and related activities in the Switch that confirm the flow
of the shipping request. For example:

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: You can also determine this information from the Audit Trail. Remember the
UPSJmsService is selected because the order shipMethod value is two_day, which
is tested in the <case UPS> branch of the Switch activity in the Fulfillment BPEL
Process.

Oracle SOA Suite 11g: Build Composite Applications 220


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
Step Answers for Step 6
c. The Invoke_validatecc activity receives the response. If you expand the <payload>
under the Invoke_validatecc activity in the Audit Trail you can see the request and
reply messages.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
a Stinformation
u d
The child element containing @ theyvalidation is the <inp1:status> element,
and the value returnedziszthe
s
u stringthvalue
i VALID.
a y e s e
i lp
7) Close the Web browser window
t o u containing the Flow Trace, Audit Trail or Flow
h
(s nse
tabbed page.
z z u c e
e l i
y the Shipping Request from the JMS Message Queue
Read
sh ilpa
The Shipping Request JMS message is still retained in the JMS queue until a JMS
consumer reads the message from the queue.
In this section, you open the files.jws application workspace and a project called
JmsSendReceive containing a Java application that consumes JMS messages from the
JMS queue used by the JMS Adapters in the POProcessing composite application.
You use JDeveloper to run the Receive.java application to display the shipping
request JMS message already sent by testing the POProcessing composite application.
8) In the JDeveloper window, open the files.jws project by using the following
steps:

Oracle SOA Suite 11g: Build Composite Applications 221


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
a) In the Application Navigator, click the application name and select Open
Application.

b) In the Open window, browse to the D:\labs\files folder, select


files.jws and click Open.
9) In the JDeveloper window, open the JmsSendReceive project by performing the
following steps: b le
fer a
s
a) With the files application selected in the Application Navigator select File >
an
Open.
n - t r
no
b) In the Open dialog box, browse to the D:\labs\files\JmsSendReceive
a
) has ideฺ
folder, select the JmsSendReceive.jpr file and click Open.
Note: If the Open Warning dialog box is displayed, at the “Do you want to
ฺ c om t Gu
migrate these files?” prompt click Yes. In the Migration Status dialog box, click
h o o e n
OK.
ya andSreceivetu d
10) To run the Receive.javau
z @
application
h i s the JMS message, perform the
following steps: e z e t
a y u s
s h ilp Application
a) In the JDeveloper
e to Navigator, right-click the JmsSendReceive project
folder (
u andtitled nsRun. In the JDeveloper “Message
select – Log” window area a new
z z
window c e
e applicationli output (the JMS messages consumed) andisreceive
“Running:JmsSendReceive.jpr – Log” opened to display the
y
ilpa
application input
sh (the letter q and Enter to terminate the application).
Note: The JmsSendReceive project properties are set to ensure the
Receive.java application is executed by default, and obtains JMS messages
from the jms/demoFulfillmentQueue JMS destination.

Oracle SOA Suite 11g: Build Composite Applications 222


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
b) In the Running:JmsSendReceive.jpr – Log” window, view the JMS message and
confirm that the text (UPS) has been appended to the customer ID in the
<custName> element. Use the following image as a guide:

b le
fer a
c) In the Running:JmsSendReceive.jpr – Log” window, to terminate the
ans
Receive.java application, at the Input prompt press q and then Enter. n - t r
d) Close the Running:JmsSendReceive.jpr window. a no
) h as eฺ
Deploy a Supplied JMS Consumer Composite
o m Application
u id
To simplify management and handling of JMS o ฺ c
message n G
t and consumption during
delivery
h o e
y t ud
a SJMSConsumerDemo
the rest of the practices, you deploy the supplied project, which is a
composite application that:
z @ his
uproduced
• Reads the JMS messages e z e t by JMS Adapters in the POProcessing
a y
composite application. u s
h i lp request
t o
• Writes(the
u s nse
shipping JMS message to a file called shiporder_#.xml, where
#zrepresents aenumber that is incremented for each message file created. There is
y e z
one lic file per message and the files are stored in the D:\temp folder.
message

sh ilpaThe following image shows the component assembly model for the JMSConsumerDemo
composite application:

To perform this task, perform the following steps:


11) In the JDeveloper window, with the files application selected, select File > Open.
12) In the Open window, navigate to the D:\labs\files\JMSConsumerDemo
folder, select the JMSConsumerDemo.jpr file and click Open.
Note: If an Open Warning window is displayed, at the “Do you want to migrate these
files?” prompt click Yes. In the Migration Status window, click OK.

Oracle SOA Suite 11g: Build Composite Applications 223


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
13) In the JDeveloper Application Navigator, to deploy the JMSConsumerDemo
application right-click the JMSConsumerDemo folder and select Deploy >
JMSConsumerDemo > to soaserver.
Note: In the SOA Deployment Configuration Dialog, click OK. If the Authorization
Request window is displayed, enter the username weblogic and password
welcome1.
Note: From this point onwards, all subsequent tests of the POProcessing composite
application, where the order is sent to a JMS Adapter by the Fulfillment process, a
shiporder_#.xml file should be created in the D:\temp folder.
14) In the JDeveloper window, select File > Save All to save changes to the files
application.
b le
Test 2: Order with an Invalid Credit Card fer a
For this test you use the D:\labs\files\po-small-ipod.xml file as input, and ans
n - t r
change the customer ID and credit card information before submitting the order data.
a no
15) To run the second test, perform these steps:
) h as eฺ
a) In the JDeveloper Application Navigator, expand
o m the “files”
u id> xml_in project

folders and double-click the po-small-ipod.xml
o c n t Gfile. Copy all the text in the
file into the clipboard. o
ah Stude
y
Arguments section,e z zuthe@page
b) On the “POProcessing [1.0]”
select XML t
inis
h the Web browser, in the Request tab Input
View, and paste the clipboard contents into
the text area.lp a y u s e
h i t o
c) Edituthe(sXML elements
n se in the data in the XML View area such that:
z e
lic element contains the value 3.
ezThe <ns0:custID>
y
sh ilpa The <ns0:ccNumber> element contains the string 4321-4321-4321-4321

d) Click Test Web Service.


16) On the Response tab, click the Launch Message Flow Trace link to display the Flow
Trace for the test instance and answer the following questions:
a) Was the Fulfillment BPEL Process executed? Explain your answer.

Oracle SOA Suite 11g: Build Composite Applications 224


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
b) What was the status response text received by the Invoke_validatecc activity?
c) What is the orders status value returned in the callbackClient activity for the
ApproveCCOrder BPEL process?
d) Look in the D:\temp folder. Was any shiporder_#.xml file created?
Explain what you discovered.

Step Answers for Step 16


a. No the Fulfillment BPEL process was not executed, as observed in the following
Flow Trace:

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
the credit hilpwas
The Fulfillment
card
was not
s e
not
oinvoked by the ApproveCCOrder BPEL process because
tvalid and Switch activity that checks the
z u e n
z
yetabbed lic
ValidateCCService response executed the <otherwise> branch, as seen in the Flow
page for the ApproveCCOrder BPEL component link:
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 8-5: Deploy and Test the POProcessing Composite
Application (continued)
Step Answers for Step 16
b. The status returned is the string INVALID. This can be seen in the Audit Trail by
expanding the <payload> under Invoke_validatecc (or the Flow tabbed page, by
clicking the Invoke_validatecc activity):

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 is “invalid credit card” as
c. The status value returned by@theycallbackClient
z z u ofththeiscallbackClient activity in the Audit Trail
seen in the expanded <payload>
e e activity.
theyApproveCCOrder
tabbed page for a s
u
( s hilp se to
z z u cen
ye li
ilp a
sh

d. No, a shiporder_#.xml file was not created in the D:\temp folder. The
reason why a file was not created is because the Fulfillment process was not
executed for the invalid credit card use-case, and a shipping request messages was
not sent to any of the JMS adapter services. Therefore, the JMSConsumerDemo
application did not execute to create the shipping order XML file.

Oracle SOA Suite 11g: Build Composite Applications 226


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
Test 3: Valid Credit Card with five_day Ship Method
For this test you reuse the D:\labs\files\po-small-ipod.xml file as input and
alter the ship method value to the value five_day before you click Test Web Service.
This will check if the order is sent to a different JMS Adapter service from the first test.
17) To run the third and last test, perform these steps:
a) In the JDeveloper Application Navigator, expand the “files” > xml_in project
folders and double-click the po-small-ipod.xml file. Copy all the text in the
file into the clipboard, and paste the text into the Request tab Input Arguments
section, select the XML View, of the on the “POProcessing [1.0]” Web browser
page.
b) Edit the XML elements in the data in the XML View area such that:
b le
The <ns0:shipChoice> element contains the value five_day.
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
(
u ce s
c) Click Test WebnService.
z z li
a ye
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 227


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
18) On the Response tab, click the Launch Message Flow Trace link to display the
following Flow Trace page for the test instance and answer the following questions:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
a) To which JMS Adapter service washthe o oorder shipping
e n request sent?
ya Stbelow d
u the Fulfillment BPEL
b) Why is the JMSConsumer_ep @ entry shown
u Trace? s
Component entry in the
e z zFlow
e thi
p ay o and
c) Why are theilRouteOrder usthe associated FulfillmentFileService components
inh
present(s
t
z u e seTrace?
the Flow
n
lic
yd)ezWas a shiporder_#.xml file created in the D:\temp folder?
i l p a
sh Step Answers for step 18
a. The order shipping request was sent to the USPSJmsService, as seen in the Flow
Trace tree just below the Fulfillment BPEL Component entry.
b. The JMSConsumer_ep entry represents the entry point for the
JMSConsumerDemo composite application. This indicates that the
JMSConsumerDemo composite application was executed when the shipping
request was set to the USPSJmsService.
c. The RouteOrder and the associated FulfillmentFileService components are present
because they are the instances that processed the shipping request message
received by the JMSConsumerDemo composite application.
d. Yes. The shiporder_1.xml file was created in the D:\temp folder, and it
contains the shipping request XML data sent the USPSJmsService.
19) In the JDeveloper Application Navigator, select the POApplication application name
to show the POApplication projects in the navigator tree.
Note: You may close the po-small-ipod.xml window.

Oracle SOA Suite 11g: Build Composite Applications 228


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 8-5: Deploy and Test the POProcessing Composite
Application (continued)
Note: Remember, since the JMSConsumerDemo composite application is deployed: all
shipping requests sent to any of the JMS Adapter services by the Fulfillment BPEL
Process component are written to the D:\temp folder by the JMSConsumerDemo
composite application, whose instances appears in the respective Flow Trace trees for 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
( s hilp se to
z z u cen
ye li
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 229


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 9

The goal of this practice is to learn how to use the following BPEL activities:
• The Flow activity to execute sequences in parallel
• The Pick activity to wait for one of several messages or a timeout. In this case,
you do not use a time out.
• The While and FlowN activities for processing multi-element XML (array)
structures.
The practice is presented in two parts that provide the context in which these activities
are used.

Part 1: Implementing Pick, While and FlowN activities


This part is depicted by 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
ye li
i l p a
sh

The ADF-BC services for the Internal Store and Online Store services are supplied, and
some initial implementations for the Internal Store and Online are also provided. You are
required to perform the following tasks:
• Deploy the supplied ADF application projects as Web services that query their
internal and online stock tables for the quantity of products ordered, and can also
update the stock counts if the products are to be acquired for each order. These
services are required as external references for the respective composite
applications.
• Modify the supplied InternalStore composite application, which contains a single
BPEL process. The BPEL process presently processes one product per order. You
must modify the process with a While activity to handle multiple products per
order, and implement the activities to invoke acquireStock operation which is

Oracle SOA Suite 11g: Build Composite Applications 230


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
implemented by replacing the Receive activity with Pick activity and associated
process flow alterations.
• Modify the supplied OnlineStore composite application to use a FlowN activity to
process more than one product per order.
• Deploy and test the InternalStore and ExternalStore applications

Part 2: Implementing Parallel Processing with a Flow Activity


This part is illustrated by 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
Note: Part u2 depends c e n the completion of part 1 tasks. If you do not have enough time,
on
l i
yeconsider deploying the solution projects from the POApplication.jws
then
p a
il workspace in the D:\labs\soln\lesson09\POApplication folder for part 1
sh services and composite applications. The changes you make to the POProcessing
composite include:
• Modifying the Fulfillment BPEL Process to invoke the InternalStore and
OnlineStore in parallel, giving priority to the InternalStore if both can fulfill the
order. If both stores are unable to supply stock for the order, the order is modified
with a waiting status until an event occurs to replenish stock in the stores.
• Testing the modified POProcessing application.

Oracle SOA Suite 11g: Build Composite Applications 231


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
In this practice, you open a supplied application workspace called ADFBCApplication
that contains four services that are to be used in this course. In this practice you deploy
the InternalStoreSDO and OnlineStoreSDO projects to the soaserver connection.
Note: To deploy ADF applications you use the JDeveloper Application Menu in the
Application Navigator. For example:

The two ADF-BC services deployed (InternalStoreService and OnlineStoreService) are


required for Practice 9-2 through Practice 9-4.
b le
To complete the deployment tasks, perform the following steps: fer a
a n s
t r
1) On the JDeveloper Application Navigator, open the ADFBCApplication-workspace
n
file, from the D:\labs\files\ADFBCApplication folder.n o
Use the following
a
steps:
) h as eฺ
a) On the JDeveloper Application Navigator, click
o u id menu containing
mthe pull-down
c
ฺ andnselect
the POApplication (or files) applicationoname, G
t Open Application.
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
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 232


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
(continued)
b) In the Open Application(s) window, navigate to the
D:\labs\files\ADFBCApplication folder, select the
ADFBCApplication.jws file and select Open.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
yaby performing
2) Deploy the InternalStoreSDO project, d
tu the following steps:
@ s S
zu clickththe
a) In the Application Navigator,
e z i Application Menu and select Deploy >
y s e
InternalStoreSDO_InternalStoreSDOProfile
a u > to > soaserver
l p
hi se t o
(
u cens
z z li
a ye
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 233


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
(continued)
b) In the Select Deployment Targets window, select soa_server1 and click OK.

c) In the “Deployment – Log” window, monitor and verify that deployment is


successful.
b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
3) Deploy the OnlineStoreSDO project,a oo dethen following steps:
byhperforming
@ y S tu
zu clickththe
a) In the Application Navigator, s
i Application Menu and select Deploy >
e z e
OnlineStoreSDO_OnlineStoreSDOProfile
y > to soaserver
p a u s
( s hilDeployment
b) In the Select
e to Targets window, select soa_server1 and click OK.
u “Deployment
Inzthe
c) z c e ns – Log” window, monitor and verify that deployment is
a ye successful.li
sh ilp4) In the JDeveloper window, select File > Save All to save changes to the application
workspace due to deployment steps.
5) Confirm that InternalStoreService and OnlineStoreService exist and are working by
using the WSIL connection in the Resource Palette. Use the following steps:

Oracle SOA Suite 11g: Build Composite Applications 234


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
(continued)
a) On the Resource Palette, expand the WSIL > WSILConnection1 entry, and verify
that the InternalStoreSDO_InternalStoreSDOProfile and
OnlineStoreSDO_OnlineStoreSDOProfile entries are present.
Note: You may have to right-click the WSILConnection1 entry and select
Refresh to ensure the deployed applications become visible.

b le
fer a
ans
n - t r
a no
b) Expand the InternalStoreSDO_InternalStoreSDOProfile
) hasandideฺ
OnlineStoreSDO_OnlineStoreSDOProfile entries,
c o m andG u that the service entry
verify
o ฺ
points InternalStoreService and OnlineStoreService
o t
n are present, respectively.
h d e
@ ya Stu
z z u this
a y e s e
u
( s hilp se to
z z u cen
6) yTest li
e the InternalStoreService with the Test Web Service tool in JDeveloper. Use the
a
ilp following steps:
sh a) On the Resource Palette, right-click the InternalStoreService entry, and click Test
Web Service.

Oracle SOA Suite 11g: Build Composite Applications 235


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
(continued)
b) In the HTTP Analyzer: Unsent Message window, select
InternalStoreServiceSoapHttpPort.getInternalStoreView1(,)
from the Operations pull-down menu, in the “prodId: string” field (in the left
window pane) enter: SKU101, and click Send Request.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om while
t G u
Note: JDeveloper displays the following
h o omessage
e n sending the message and
waiting for the response.
y a Stud
z z u@ this
a y e s e
u
( s hilp se to
Inzthe
c) z n
u HTTPceAnalyzer: # window (where # is a message request number) confirm
e l i
y that the response (in the right window pane) displays the ProdId SKU101 and
i l p a Quantity value 5. Use the following image as a guide:
sh

d) Close the HTTP Analyzer: # window.

7) Test the OnlineStoreService with the Test Web Service tool in JDeveloper. Use the
following steps:
a) On the Resource Palette, right-click the OnlineStoreService entry, and click Test
Web Service.

Oracle SOA Suite 11g: Build Composite Applications 236


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-1: Deploy ADF Application Projects as Services
(continued)
b) In the HTTP Analyzer: Unsent Message window, select
OnlineStoreServiceSoapHttpPort.getOnlineStoreView1(,) from the
Operations pull-down menu, in the “prodId: string” field (in the left window
pane) enter: SKU101, and click Send Request.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
c) In the HTTP Analyzer: # window (where
h o o # is a message
e n request number) confirm
ya pane)
that the response (in the right window d
tudisplays the ProdId SKU101 and
@ s S
Quantity value 6. Use the
e z zufollowing
thiimage as a guide:
a y us e
i l p t o
u (sh nse
e z z lice
a y
i l p
sh
d) Close the HTTP Analyzer: # window.

Note: The ADF-BC application services deployed are synchronous Web services, and
they can also be used as Service Data Object (SDO) implementations.

Oracle SOA Suite 11g: Build Composite Applications 237


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
In this practice, you open the InternalStore composite application project, which is
located in the D:\labs\files folder. You modify the ManageInventory BPEL
Process by:
• Replacing the Receive activity with a Pick and two onMessage branches, each
one to handle one of two operations checkStock and acquireStock defined in the
component WSDL. In this case, you set a variable to indicate which operation
was requested so that the process flow can manage the request appropriately.
• Adding a While loop and associated iteration control activities to process multiple
product elements and check if stock exists. Activities that obtain the amount of
available stock are also needed for the acquireStock operation so that you can
decrement the amount of stock available by the amount ordered for the operation
that updates the information in the database table.
• Implementing Switch statements to execute different actions for the different b le
operations and ensure appropriate responses are returned. fer a
ans
n - t r
To complete this task, perform the following steps:
a no
Copy the InternalStore Project into the POApplication
) has ideWorkspace

In this section you copy the InternalStore compositeo
c m Gproject
application u into your
POApplication workspace folder, and open theo
o ฺ
project in n t
the POApplication.
h
a copySthe d e
1) Open a Windows Explorer window,yand
@ tu
D:\labs\files\InternalStore s
zu thi folder to the
y e z e
a
D:\labs\mywork\POApplication
p u s folder.
l
hi window, o
t open the InternalStore project in the POApplication
( s
2) In the JDeveloper
u by using s e
nthe following steps:
z z
workspace
l i c e
a ya)e In the Application Navigator, click the application names on the pull-down menu
il p
sh and select POApplication.

b) In the Application Navigator, click the Application Menu and select Open Project.
c) In the Open Project window, navigate to the
D:\labs\mywork\POApplication\InternalStore folder, select the
InternalStore.jpr file and click Open.
Note: In the Open Warning window with the “Do you want to migrate these
files?” prompt, click Yes. In the Migration Status window click OK.

Oracle SOA Suite 11g: Build Composite Applications 238


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
Examine the InternalStore Composite Application
3) Expand the InternalStore project and open the composite.xml file. Using the
image as a guide answer the questions that follow:

b le
fer a
ans
n - t r
no
a) Is the checkStock operation a synchronous or an asynchronous interaction?
a
) has the
b) Which InternalStoreService operation is used to determine available
e ฺ stock
level for a specific product?
c o m Guid
c) Which InternalStoreService operations o
o ฺ be usedntot update stock quantity
can
values in the underlying table? a
y h t u de
z u@ his S
Note: The SOADEMO e t Oracle Database 10g XE instance contains a
zschema ein the
a y
table called INTERNAL_STORE s
u that maintains the product quantity values. You
can use(s
lp Command
hiSQL t o
u
the
n s e Line tool (in Start > Programs > Oracle Database 10g

e z licEdition
Expression
z e menu to start SQL*Plus), or the SQL Worksheet in
a y JDeveloper to query the database table.
i l p
sh Step a.
Answers for step 3
It is an asynchronous operation. If you opened the ManageInventory.wsdl
file you can see that all the operations are defined with a single message element.
The checkStock and acquireStock operations represent the requests. The
checkStockResponse and acquireStockResponse operations are for the associated
callback responses.
b. The getInternalStoreView1 operation is used to obtain the product and quantity
available.
Note: This operation executes an SQL SELECT statement for a given product ID.
c. The updateInternalStoreView1 and mergeInternalStoreView1 operations can both
be used to modify the quantity of a given product.
Note: In the practice you use the updateInternalStoreView1 operation to
implement the functionality for the acquireStock operation. The operation
updateInternalStoreView1executes an SQL UPDATE statement. The
mergeInternalStoreView1 executes an INSERT statement (if a row with the
product ID does not exist) or an UPDATE statement (if a row with the product ID
exists).

Oracle SOA Suite 11g: Build Composite Applications 239


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
Edit the ManageInventory BPEL Process
4) In the composite.xml window, to edit the BPEL process double-click the
ManageInventory BPEL Process component icon.
5) In the ManageInventory.bpel window, before you modify the BPEL process,
examine the existing process flow and answer the questions that follow (so that you
understand what you are about to change):

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

a) What operation does the Invoke_checkinstore perform?


b) What information is copied by the Assign_prodid as the request message for the
Invoke_checkinstore activity?
c) What is the result of the copy operation in the Assign_prodinstock activity?
d) What is the purpose of the Assign_initialize activity?

Oracle SOA Suite 11g: Build Composite Applications 240


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
Now examining the process flow at the end of the BPEL process which contains a
Switch activity as shown in the following image answer the additional questions:

b le
fer a
an s
n - t r
a no
) has ideฺ
e) What does the <case inStock> branch condition
ฺ c omtest,tand
G uwhat are the actions for
each of the condition outcomes?
h o o e n
ya Stu d
Step Answers for step 5
z @
uinvokestthe
h isgetInternalStoreView1 operation.
a. The Invoke_checkinstore
y z
ethe Invokeseactivity to view the settings.
Hint: Double-click
i a
lp accepts o u
Note: Thehoperation
( s e t a product ID as the input message and returns the
product
z s
u ID candenquantity available from the database (INTERNAL_STORE table).
z li
b. yeThe Assign_prodid copies the prodId element from the first product element of the
il p a input structure to the request message used by the invocation of the
sh InternalStoreService.
Note: In the Assign activity copy operation the “From” XPath expression is:
/ns1:StoreRequest/ns1:product[1]/ns1:prodId
In this XPath expression, the “[1]” syntax represents the index for the first product
element in a multi-element structure.
c. The result of the copy operation in the Assign_prodinstock is to store a Boolean
result of true or false in the inStock variable. The result depends on the value
of the conditional expression stored in the “From” section of the copy operation.
The condition stores a true value in the inStock variable if the quantity of stock
returned from the invoke operation is more than or equal to the quantity ordered,
otherwise a false value is stored in the inStock variable.
d. The purpose of the Assign_initialize activity is to initialize the inStock variable to
the value true, on the assumption that products are in stock unless the flow
determines it is not. This assign activity is more meaningful when you implement
the flow logic to process multiple product elements.

Oracle SOA Suite 11g: Build Composite Applications 241


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
Step Answers for step 5
e. The <case inStock> branch condition tests if the inStock variable is true. When
the condition is true, the Assign_instock activity copies the in-stock string as
the response message; otherwise the Assign_outofstock activity copies the out-
of-stock string as the response message.

Modify ManageInventory to Process Multiple Products


In this section you restructure the BPEL process flow to include a While activity to loop
through the set of products received for processing and set the While activity termination
condition. This requires modifying the Assign_initialize activity to modify the loop
counter, and moving activities into the loop, decrementing a loop counter.
Note: The While loop is terminated either when all products are processed or the first le
product that is out of stock is encountered. You also have to modify the XPath expression a b
in the Assign_prodid and Assign_prodinstock copy operations to dynamically access thes fer
nth element in the XML array structure. - t r an
no n
6) In the ManageInventory.bpel window, restructure the BPEL flow according to
a
the following image:
) 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

To create the flow changes represented in the image perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 242


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
a) Add a While activity between the Assign_initialize and the Assign_prodid
activities.
b) Expand the While activity and add a Sequence activity into the body of the While
activity.
c) Drag the Assign_prodid, Invoke_checkinstore, and Assign_prodinstock activities
(in the order stated) into the body of the Sequence_1 activity nested in the While
activity.
d) After verifying that your process flow resembles the image provided above, save
your structural changes to the BPEL process.
7) Create a process variable called n based on the Simple Type option set to xsd:int.
This variable is used to control the number of loop iterations and index the product
b le
element in the input XML structure. 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
z z u cen
ye li
i l p a
sh

If you require help to perform this task, use the following instructions to create the
variable:
a) On the main process scope, click the Variables icon.

b) In the Variables window, click the Create icon.


c) In the Create Variable window, perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 243


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
i) Enter n for the Name
ii) Select the Simple Type option.
iii) Click the Browse icon next to the Simple type option to open the Type
Chooser window.
iv) In the Type Chooser window, select the int entry and click OK.
d) In the Create Variable window, verify your settings match the supplied image
above and click OK to create the variable.
e) Save the changes to your BPEL process.
8) Modify the Assign_initialize with another copy operation to set the variable n to the
number of product elements in the inputVariable.
b le
Hint: Use the count Mathematical Function in the XPath Expression Builder. Use the
fer a
following image as a guide:
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

If you require help to perform this task, use the following steps:
a) Double-click the Assign_initialize activity.
b) On the Assign > Copy Operation tabbed page, click the Create icon > Copy
Operation.

Oracle SOA Suite 11g: Build Composite Applications 244


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
c) In the Create Copy Operation window, in the “From” section set Type as
Expression and construct the following Expression:

count(bpws:getVariableData('inputVariable',
'payload','/ns1:StoreRequest/ns1:product'))

In the “To” section, set Type as Variable, select the variable n, and click OK.
d) On the Assign page, click OK.
9) Configure the While activity conditional expression so that the loop continues while
the value in the variable n is greater than zero and while the inStock variable is still
the value true (using the true() Logical Function). For example:
b le
bpws:getVariableData('n') > 0 and fer a
bpws:getVariableData('inStock') = true() ans
n - t r
no
Note: Remember the Assign_initialize has already preset inStock to the value
a
has ideฺ
true() to ensure that you enter the while loop. Use the following image as a guide:
)
ฺ 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
If you require help create the While conditional expression, perform the following
steps:
a) Double-click the While icon.
b) On the While > General tabbed page, click the XPath Expression Builder icon to
construct the expression.
c) In the Expression Builder window, perform the following actions to create the
expression:
i) Select the BPEL Variable n and click Insert Into Expression.
ii) Enter the text “> 0 and ” (excluding the quotes).
iii) Place the cursor at the end of the text, select the inStock BPEL variable and
click Insert Into Expression.

Oracle SOA Suite 11g: Build Composite Applications 245


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
iv) At the end of the expression append the text “= true()” (excluding the
double quotes).
v) Click OK.
d) In the While window, click OK to save the conditional expression.
e) Save the changes to your BPEL process.
10) Modify the copy operation in the Assign_prodid activity so that you replace the
absolute index [1], in the XPath expression, with the string [position()=$n].
Note: The dollar ($) character preceding the character n is required. Use the
following screenshot 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 Your XPath expression should resemble the following:
sh /ns1:StoreRequest/ns1:product[position()=$n]/ns1:prodId

If you require help to change the “From” XPath Expression, perform the following
steps:
a) Double-click the Assign_prodid activity.
b) In the Assign > Copy Operation window, double-click the existing copy operation
row to open the Edit Copy Operation window.
c) In the Edit Copy Operation window, in the XPath field under the “From” section
replace the digit 1 inside the square brackets with position()=$n. For
example:

d) In the Edit Copy Operation window, click OK to accept the change.


e) In the Assign window, click OK.

Oracle SOA Suite 11g: Build Composite Applications 246


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
f) Save the changes to your BPEL process.

11) Modify the copy operation in the Assign_prodinstock activity so that the nth product
ID quantity is used in the conditional expression. 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“From” u d
tExpression
Note: The simplest way to change the
u @ i s S is to select the digit 1
between the square brackets
position()=$n.aye
zzand replace
e th it with the highlighted text
i l p t o us
12) You require( h moreseAssign activity in the While sequence to decrement the value
sone
u
of thezvariablec ne byna value of one at the end of the loop. Use the following image as
z
yaeguide: l i
il p a
sh

a) Drag an Assign activity as last activity in the Sequence inside the While activity.
b) Rename the Assign activity to Assign_next_n.

Oracle SOA Suite 11g: Build Composite Applications 247


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
13) Configure the Assign_next_n activity to decrease the value in the variable n by one,
and assign the result back to the variable n. Use the following screenshot 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
Note: The “From” Expression
@ is the following example:
ushouldthresemble
y e z e
a u s
( s hilp se to
bpws:getVariableData('n') – 1

z z u cen
li to your BPEL process and POApplication workspace.
e the changes
14)ySave
ilp a
sh Modify ManageInventory to Handle Each Operation
In this section, you replace the Receive activity with a Pick activity. You modify the Pick
activity by adding another onMessage branch and deleting the onAlarm branch.

The rest of the BPEL flow must be modified to execute the appropriate activities for the
checkStock operation, and additional activities for the acquireStock operation. Therefore
addition Switch activities are required to determine which operation was requested. The
onMessage branch sets a variable to indicate the operation requested so that the Switch
branches can evaluate an appropriate condition and execute the required activities.
15) In the ManageInventory.bpel Design window, at the start of the BPEL process
flow replace the Receive activity with a Pick activity. Use the following steps:
a) Delete the receiveInput activity
b) Drag a Pick activity to the start of the BPEL process.
16) Edit the Pick_1 activity and change its name to Pick_operation and set the
“Create Instance” option by using the following steps:

Oracle SOA Suite 11g: Build Composite Applications 248


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
a) Double-click the Pick_1 activity to open the Pick settings.
b) On the Pick > General settings page, replace the Name with Pick_operation,
select the “Create Instance” option, and click OK.

b le
fer a
17) In the ManageInventory.bpel Design window, expand and configure the
ans
- t
Pick_operation to have two onMessage branches and delete the onAlarm branch.
n r
Hint: Click the Add OnMessage Branch icon ( no
) to create an additional onMessage
a
branch. 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 249


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
18) Configure the first onMessage branch to be associated with the
manageinventory_client partner link, the checkStock operation, and use the
inputVariable. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
If you require help to perform this task, performo
c mfollowing
the G usteps:
o ฺ
o branch t
n icon.
h
a) Double-click the first (left-most) onMessage d e
@
b) In the OnMessage Branchuwindow,
ya configure
S tu the following settings:
z thi s
y e z
Partner Link: manageinventory_client
e (Click the Browse icon to select
a u s
h i lp
the partner link)
t o
u (s inputVariable
Operation:
se
checkStock
n
e z z
Variable:
l i c e (Click the Browse icon to select the variable)
a y Click OK.
i l p
sh 19) Configure the second (right-most) onMessage branch to be associated with the
manageinventory_client partner link, the acquireStock operation, and use the
inputVariable. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 250


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
20) Save the changes to you BPEL process.

Create and Set a Variable with Process Operation


In this section you create a string variable named operation, whose value is set to
'check' in the checkStock onMessage branch. You set the operation variable value
to 'acquire' in the acquireStock onMessage branch. The operation variable is
used in additional flow changes to perform the activities to update the stock data and
return the appropriate callback response.
21) In the main process scope, create a new variable named operation with a string
Simple Type. 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 22) In the ManageInventory.bpel Diagram window, expand both onMessage
branches of the Pick_operation activity and create a named Assign activity in the each
branch as defined by the following table:
Activity Type and Name Location
a. Assign: Assign_checkstock In the left OnMessage Branch
b. Assign: Assign_acquirestock In the right OnMessage Branch

Oracle SOA Suite 11g: Build Composite Applications 251


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
23) Configure the Assign_checkstock with a copy operation that stores the string literal
has ideฺ
‘check’ in the operation variable. Use the image as a guide:
)
ฺ 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 252


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
24) Configure the Assign_acquirestock with a copy operation that stores the string literal
‘acquire’ in the operation variable. Use the 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
25) Save the changes to your BPEL process.
ya Stu d
z @ is
u acquireStock
h
Modify While Loop with e z the
e t Operation Activities
a y u s
The While loop needs
h i lpthe Assign_prodinstock
t o to be executed when the operation=check,

u ( s nse
and different activities when operation=acquire. To make this change you add Switch

e z z the lWhile
activity, into
i c e loop, with a conditional expression on the operation variable and
a y
configure its <case> and <otherwise> branches with appropriate activities for each
p
il operation.
sh

Oracle SOA Suite 11g: Build Composite Applications 253


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
26) In the ManageInventory.bpel Diagram, drag a Switch activity into the While
activity Sequence between the Invoke_checkinstore and Assign_prodinstock
activities. Rename the Switch activity to Switch_operation. Use the following image
as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
c om branch
27) Expand the Switch_operation to structure the ฺ<case> t G uand <otherwise> branch
as described by the following steps: hoo d e n
a) Drag the Assign_prodinstock @ ya Sthe
activitysinto
tu <case> branch.
e z zu add thethfollowing
i
b) In the <otherwise>
a y branch,
u s e activities in the sequence listed:
ilp Assign
i) Drag ahnew
s e toactivity renamed to Assign_updstock.
( s
nInvoke
zii)zu
Drag aic e
new activity renamed to Invoke_updstock.
y e l
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 254


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(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
y e z eto operation=check and set the conditional
a u s
s
expression(to
ilp that
28) Configure the <case>
hensure
branch
e the
name
to operation variable is equal to the literal string
z z u as shown
'check', c e nsin the following image:
ye li
ilp a
sh

Note: The conditional expression should resemble the following text:

bpws:getVariableData('operation') = 'check'

Oracle SOA Suite 11g: Build Composite Applications 255


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
29) Link the Invoke_updstock with the InternalStoreService, using the drag and drop
technique or double-click the activity and set the partner link to InternalStoreService
and select updateInternalStoreView1 as the Operation. For the Input and Output use
the Automatically Create Input (or Output) Variable icons, respectively to create the
required variables as Global Variables. Use the following image as a guide to the
Invoke settings:

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
theliAssign_updstock with the following two copy operations:
ye
30) Configure
a
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 256


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
a) Copy the nth product’s prodId element to the corresponding element in the
Invoke_updstock_updateInternalStoreView1_InputVariable. 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 h ilp e to
Note:
u (
To set then scorrect XPath expression for the nth product, perform the
z z c e
a ye followinglisteps in the “From” section:
i l p i) Select the Type as Variable.
sh ii) Expand the inputVariable > payload > StoreRequest > product node and select
the prodId element.
iii) In the XPath Expression field add the text [position()=n$] after the
/ns1:product and before the /ns1:prodId in the XPath expression:

/ns1:StoreRequest/ns1:product[position()=$n]/ns1:prodId

Oracle SOA Suite 11g: Build Composite Applications 257


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
b) Create an expression that subtracts the inputVariable’s nth product > qtyOrdered
element from the quantity in the
Invoke_checkinstore_getInternalStoreView1_InputVariable. Copy the result of
this expression to the quantity in the
Invoke_updstock_updateInternalStoreView1_InputVariable. 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: Verify that the “From” text resembles the following expression:

bpws:getVariableData('Invoke_checkinstore_getInternalStoreV
iew1_OutputVariable','parameters','/ns3:getInternalStoreVie
w1Response/ns3:result/ns2:Quantity') -
bpws:getVariableData('inputVariable','payload','/ns1:StoreR
equest/ns1:product[position()=$n]/ns1:qtyOrdered')

Hint: If you wish, you can copy the left-side of the conditional expression in the
copy operation in the Assign_prodinstock activity, which resembles the above
calculation.

Oracle SOA Suite 11g: Build Composite Applications 258


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
31) Verify that your While loop contains the following changes to its activity sequence,
and save the changes to your 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
Return z z u acquireStock
the c e n Response Message
y e l i
ilpa
In this section the final change you make to the ManageInventory BPEL Process is to
sh create one more Switch activity to manage the different responses sent to the client using
the callback Invoke activities. Again the Switch activity must determine for which
operation (check or acquire) you are returning a response and configure its branches
accordingly.

Oracle SOA Suite 11g: Build Composite Applications 259


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
32) In the ManageInventory BPEL Diagram window, create a new Switch called
Switch_response outside the While activity between the While and existing Switch
activity at the end of the process. 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
oconfigure e n<case> branch conditional
33) Expand the Switch_response activitya and d the
u to the literal string ‘check’. Use
yvariableSistequal
@
expression to check if the operation
zu thi s
y e z
the following image as a guide:
e
a u s
( s hilp se to
z z u cen
ye li
ilp a
sh

34) Structure the Switch <case> and <otherwise> branch such that:
a) The <case> branch contains:
i) The Switch_instock activity (and its branches), which is the Switch activity
end of the process.
ii) The callback activity.
b) The <otherwise> branch contains:

Oracle SOA Suite 11g: Build Composite Applications 260


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
i) A new Assign activity named Assign_fulfilled.
ii) A new Invoke activity called callbackClient_fulfilled.
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 261


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
35) Configure the Assign_fulfilled activity with a copy operation that stores the literal
string ‘fulfilled’ in the outputVariable status element. 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 @ is to invoke the manageinventory_client
u thactivity
z
36) Configure the callbackClient_fulfilled
ye use
partner link with p theaacquireStockResponse callback operation and use
i l t o
u (sh as Input
outputVariable
n s evariable. Use the following image as a guide:
e z z lice
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 262


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)
37) Close and reopen the ManageInventory.bpel file and verify that the final
Switch activity flow sequence resembles the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
38) Close the ManageInventory.bpel ya window d
tuand the InternalStore
@ s S
composite.xml file. Save
e z zuchangesthtoi your BPEL process and POApplication
workspace.
a y u s e
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 263


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
In this practice, you open and modify the ManageStock BPEL Process implementation in
the OnlineStore composite application, and answer some questions to facilitate your
understanding of parts of the implementation. The OnlineStore composite assembly
model is similar to the InternalStore application as shown in the following image:

b le
fer a
an s
Note: The difference in the OnlineStore, as compared to InternalStore assembly mode, is
- t r
that the external reference is for the OnlineStoreService (another ADF-BC server that you
n
no
deployed earlier in these practices). The OnlineStoreService queries and manages data in
a
the ONLINE_STORE database table.
) has ideฺ
To complete this task perform the following steps:
ฺ c om t Gu
h o o e n
1) Open a Windows Explorer window, and
yafolderStotthe
copy the
u d
D:\labs\files\OnlineStore @ s
zu thi folder.
e z
D:\labs\mywork\POApplication
y e
a u s
2) In the JDeveloper
s h ilpwindow,
e toopen the OnlineStore project in the POApplication
(
workspace by using
u centhe s following steps:
z z li
a ya)e Application
In the Application Navigator, with the POApplication selected click the
il p Menu and select Open Project.
sh b) In the Open Project dialog box, navigate to the
D:\labs\mywork\POApplication\OnlineStore folder, select the
OnlineStore.jpr file and click Open.
Note: In the Open Warning window with the “Do you want to migrate these
files?” prompt, click Yes. In the Migration Status window click OK.

Examine the ManageStock BPEL Component


In this section you open and examine the ManageStock BPEL existing implementation
and answer questions so that you can modify the code with some awareness of the
changes required when you implement the FlowN to process multiple products.
Note: If you prefer, to save time you can skip and read the questions at another time.
3) In the Application Navigator, expand the OnlineStore composite project and double-
click the ManageStock.bpel process to open it in the BPEL Editor.
4) In the ManageStock.bpel Design window, examine the process flow elements
and answer the following questions:

Oracle SOA Suite 11g: Build Composite Applications 264


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
a) Does the ManageStock BPEL Process support all the operations (checkStock,
checkStockResponse, acquireStock, and acquireStockResponse) defined in
ManageStock.wsdl? Explain your answer.
b) What does the Assign_prodid activity do?
c) What does the Assign_newqty activity do? Explain why?
Hint: There are two reasons. By examining the Assign_updstock_data activity in
the <case Acquire Stock?> branch of the Switch_acquirestock activity, and the
<case Any out of stock?> branch conditional expression you may find a way to
explain the logic used.
d) Why is the input and output variables for the Invoke_checkstore and
Invoke_updstock defined as local variables in the Scope_stockprocess scope?
b le
Answers for step 4
fer a
ans
a. Yes. The process contains a Pick activity, with two onMessage branches at the start
- t r
of the process. One onMessage branch is for the checkStock operation and the other
n
is for the acquireStock operation.
a no
has ideฺ
In addition, the process provides two “callback (invoke)” activities at the end of the
)
process. Scroll to end of the process design, and if required expand the
ฺ c om t Gu
Switch_operation activity. One callback is called callbackClient activity, which is
o o e n
for the checkStockResponse operation and the other is called
h
ya Stu d
callbackClient_fulfilled, which is for the acquireStockResponse operation.
@
u this
Note: The callback activities are contained in the last Switch activity (called
z
e z e
Switch_operation) of the ManageStock BPEL process. You may need to expand the
y
a u s
( s hilp se to
Switch_operation activity to view the callback activities.
b. The Assign_prodid activity copies the first prodId element from the XML array in
z z u cen
the inputVariable to the request message for the Invoke_checkstore activity.
ye li
Note: The Assign_prodid copy operation must be modified to dynamically access
i l p a the product XML array using the [position()=$n] condition added to the
sh XPath expression.
c. The Assign_newqty subtracts the quantity of stock ordered (qtyOrdered in the
InputVariable) from the amount of stock available in the online store database, and
copies the result back into the qtyOrdered in the inputVariable.
The reasons why this logic is performed are:
1. It simplifies the Assign_updstock_data copy operation for setting the new quantity
value to be used to update the database table for the specified product, that is, it does
not need to repeat the subtraction expression already performed.
Note: The copy operations on the Assign_newqty and Assign_updstock_data must
be modified to dynamically access the product XML array using the
[position()=$n] condition added to the XPath expression.

2. It enables the <case Any out of stock?> branch conditional expression to


determine if any of the products are out of stock by a simple XPath expression that
returns a true value if any qtyOrdered element contains a negative value, that is,
not enough stock to satisfy the order.

Oracle SOA Suite 11g: Build Composite Applications 265


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
Answers for step 4
d. The input and output variables used for the activities that invoke the
OnlineStoreService must be defined as local variables in the scope, so that each
FlowN branch gets their own copy. This prevents activities in each FlowN branch
modifying data that is needed by other FlowN branches.
Note: Remember, a local variable is created in the context of the scope in which it is
defined, and is removed from memory when the scope ends.

Note: The XPath expression in the <case Any out of stock?> branch conditional
expression makes use of the descendants (//)query on all the product/qtyOrder
elements:

bpws:getVariableData('inputVariable','payload', b le
'/ns2:StoreRequest//ns2:product/ns2:qtyOrdered') < 0 fer a
a n s
This XPath expression eliminates the need to loop through all the product n -t r
qtyOrdered
elements. This approach was chosen because when you add the FlowN
o
nactivity to process
a
multiple products you need an array of elements to track which
) h asproducts
e ฺ are in stock. It
does not makes sense for multiple FlowN branches to m
o id (single) inStock
update a solitary
u
o ฺ c
variable as was done in the While loop of the InternalOrder
n G
composite
t BPEL
o
a Sbytuthedeactivities
implementation, otherwise the results couldhbe incorrect depending on the order of flow
@ y
branch processing and the outcomes determined performed.
u i s
y e zzarray eof product
th elements already present in the
Therefore, you make use
i
inputVariable to trackl pthe
of the
t usfor the acquireStock update operation in addition to
a newovalue
(stoh determine
using the values
u n se if products are out of stock for a checkStock operation.
e z z l ic e
y
Implement a FlowN Activity to Products Multiple Products
sh ilpaIn this section, you modify the ManageStock BPEL process by creating a variable n of
type xsd:int that is initialized with the number of products in the inputVariable. In
addition, you add a FlowN activity with a Sequence that contains activities from
Assign_prodid to the Switch_acquirestock activities (inclusive). You then modify the
Assign activity copy operations in the FlowN sequence to use the FlowN index variable
to access the nth product element for each FlowN branch.

Oracle SOA Suite 11g: Build Composite Applications 266


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
5) In the ManageStock.bpel Design window, create a new process variable named
n based on the xsd:int Simple Type.
Note: This variable is used for the FlowN index variable and must have the
xsd:int data type. Use the following Create Variable window image as a guide for
the settings:

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
6) In the ManageStock.bpel
t o Design window, drag a FlowN activity before the
(s nsactivity.
Scope_stockprocess
u e Use the following image as a guide:
ez z lic e
y
sh ilpa

7) To edit and configure the FlowN_1 activity settings, double-click FlowN_1 activity
icon and perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 267


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
a) In the Flow settings window, next to the N field, click the XPath Expression
Builder icon ( ) to define an expression that initializes the variable n to the
count of product elements in the inputVariable. Use the following Expression
Builder image as a guide to creating the expression:

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 hilpenter
Alternatively,
e
theto
following expression into the N field:

z z u cens
ye li
count(bpws:getVariableData('inputVariable', 'payload',

i l p a '/ns2:StoreRequest/ns2:product'))

sh b) In the FlowN settings window, click the Browse Variables icon ( ) next to the
Index Variable field and select the process variable n, and click OK after setting
the Index Variable. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 268


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
8) Save the changes to your BPEL process.
9) In the ManageStock.bpel Design window, configure the activity sequence flow
inside the FlowN_1 activity by performing the following steps:
a) Expand the FlowN_1 activity
b) Drag the Scope_stockprocess activity into the FlowN_1 activity. This results in
the Assign_prodid, Invoke_checkstore, Assign_newqty, Switch_acquirestock, and
activities within the scope being enclosed in the FlowN.
Note: Consider collapsing the Scope_stockprocess activity before you drag it into
the FlowN_1 sequence 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 activity
h is expands when your drop it into the
z
Note: The Scope_stockprocess t
eimage sshows
e the scope in a collapsed state for readability.
sequence above. a y
The u
( s hilpto your
e to process.
z z u cens
10) Save the changes BPEL

ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 269


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
11) In the ManageStock.bpel Design window, double-click the Assign_prodid
activity and modify the copy operation by replacing the [1] string in the “From”
XPath expression to the string [position()=$n].
Note: Using the [position()=$n] syntax accesses the values in the nth product
element of the inputVariable. 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
12) In the ManageStock.bpel
y z
e Design e window, double-click the Assign_newqty
a u s
( s hilp and
activity and modify
“From” Expression
the copy
s ethe
operation by replacing the [1] string in, both the
to“To” XPath expression, with the [position()=$n]
z u e n
y ez Use thelicfollowing image as a guide:
string.

sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 270


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
13) In the ManageStock.bpel Design window, if needed expand the
Switch_acquirestock activity, and in the <case> branch double-click the
Assign_updstock_data activity to modify its two copy operation using the following
steps:
a) In the first copy operation, with prodId, replace the string [1] in the “From”
XPath expression with the string [position()=$n]. Use the 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 271


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-3: Modify OnlineStore with a FlowN Activity
(continued)
b) In the second copy operation, with qtyOrdered, replace the string [1], in “From”
XPath expression, with the string [position()=$n]. Use the 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 windows, and save all
ycomposite.xml
14) Close ManageStock.bpel and
z @
u this
changes.
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 272


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications
In this practice, you deploy and test if the modified InternalStore and OnlineStore
composite applications operate as expected, before you make use of them in the
Fulfillment BPEL Process of the POProcessing composite application. To complete these
tasks perform the following steps:
1) In the JDeveloper Application Navigator window, ensure that the POApplication and
its projects are displayed.

Deploy the InternalStore and OnlineStore Composite Projects


2) To deploy the InternalStore composite application, right-click the InternalStore
project node and select Deploy > InternalStore > to > soaserver. In the SOA
Deployment Configuration Dialog, click OK. b le
Note: Monitor the “Deployment – Log” window to ensure deployment is successful. fer a
ans
t r
3) To deploy the OnlineStore composite application, right-click the OnlineStore project
n -
Configuration Dialog, click OK. a no
node and select Deploy > OnlineStore > to soaserver. In the SOA Deployment

has ideฺ
Note: Monitor the “Deployment – Log” window to ensure deployment is successful.
)
Note: Now that the composite applications are deployed,ฺ c om if tyouGtrust
u that you have
o
correctly and successfully created the InternalStore
h o andeOnlineStore
n composite
applications, to save time you can skip y a rest ofSthis
the t d
u practice and start with instructions
for the practice titled “Add a Flow
z z u@ t h is
to the Fulfillment BPEL Process” in this lesson.
e
y and e
Query the InternalStore
i l p a
t o usOnlineStore Database Tables
In this section
u shperform
(you n setwo SQL queries to view the existing stock for three of the
products
e z
z the database e
lic tables for the InternalStore and OnlineStore. The database tables
y
ilpa
queried are called INTERNAL_STORE and ONLINE_STORE, respectively.
sh 4) In the JDeveloper window, execute a query on the INTERNAL_STORE database
table to check the available stock for the following three product IDs: SKU101,
SKU102, and SKU200. Use the SQL statement in the file called
D:\labs\files\int_store_query.sql in the following steps to perform
this task:
a) On the JDeveloper Application Menu, select the files application name.
Note: If the files application is not open, select File > Open, browse for and
open the D:\labs\files\files.jws file.

Oracle SOA Suite 11g: Build Composite Applications 273


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
b) In the Application Navigator, expand the files > Application Sources > sql folder,
and right-click int_store_query.sql and select Open. Alternatively,
double-click the file name.
Note: The SQL file is displayed in a SQL Worksheet window.
c) In the int_store_query.sql (SQL Worksheet) window, confirm you have
the following SQL statement, and click the Execute Statement icon ( ).

Select * from internal_store


where prod_id in ('SKU101', 'SKU102', 'SKU200');

Use the following image as a guide:


b le
fer a
ans
n - t r
a no
) hastheidSQL
Note: Ensure that the cursor is placed in or at the end of
e ฺ statement.
d) In the Select Connection window, select the o
c m Gu
soademo(POApplication)
connection, and click OK. 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 e) In the int_store_query.sql (SQL Worksheet) window, you can observe
sh the query results displayed in the Results tab below the pane containing the
SELECT statement. Use the following image as a guide:

Note: There is a quantity of 5 for each prod_id value displayed.


f) Close the int_store_query.sql window.

Oracle SOA Suite 11g: Build Composite Applications 274


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
5) In the JDeveloper window, execute a query to check the available stock in the
ONLINE_STORE database table for the same three product IDs: SKU101, SKU102,
and SKU200. Use the SQL statement in the file called
D:\labs\files\onl_store_query.sql in the following steps to perform
this task:
a) In the Application Navigator, under the files > Application Sources > sql folder,
and right-click onl_store_query.sql and select Open. Alternatively,
double-click the file name.
b) In the onl_store_query.sql (SQL Worksheet) window, confirm you have
the following SQL statement, and click the Execute Statement icon ( ). Use the
following image as a guide:
b le
fer a
ans
n - t r
a no
Note: Verify the following SQL statement is executed:) has ideฺ
Select * from online_store ฺcom G u
o o 'SKU102',
e t
n 'SKU200');
where prod_id in ('SKU101', h d
yaselectSthetusoademo(POApplication)
z @
c) In the Select Connection window,
u this
connection.
y e z e
a u s
s ilp e to
d) In the onl_store_query.sql
hresults (SQL Worksheet) window, you can observe
u (
the query
n s
displayed in the Results tab below the pane containing the
z ic e
yez
SELECT lstatement. Use the following image as a guide:

i l p a
sh

Note: There is a quantity of 6,8,2 respectively for the prod_id values


displayed.
e) Close the onl_store_query.sql window.

Test the InternalStore checkStock Operation


In this section you perform two tests of the checkStock operation of the InternalStore
composite by using the Oracle Enterprise Manager Web interface. The first test verifies if
the process correctly reports if ordered product quantities are in stock, and the second test
checks for the out of stock condition by increasing the ordered quantity for one product to
more than is available.

Oracle SOA Suite 11g: Build Composite Applications 275


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
6) In a Web browser, access the Oracle Enterprise Manager page (URL
http://localhost:7001/em), and login as the user weblogic with password
welcome1.
7) On the Oracle Enterprise Manager SOA home page, expand the SOA folder in the
Farm navigator, and click the “InternalStore [1.0]” link.
8) On the “InternalStore [1.0]” page, click Test.
9) On the “InternalStore [1.0]” Test Web Service page, ensure that the Operation
selected is checkStock, for example:

b le
fer a
an s
n - t r
a no
) has ideฺ
10) On the “InternalStore [1.0]” Test Web Servicecpage,
ฺ omunder t G uRequest tab Input
the
Arguments section, select the XML viewo
h o replaceenthe XML data with the contents
and
y a Stud
of the file D:\labs\files\xml_in\prod-in-store.xml, and click Test
Web Service. @ s
zinuthe filesth>i Application Sources > xml_in folder in the
Note: You can find this y e z
file e
a u s
hilp senavigator
JDeveloper Application
( s to window with the files application selected.
a) On
z z uthe Response
c e n tab, click the Launch Message Flow Trace link.
l i
yb)e On the Flow Trace page, click the ManageInventory BPEL component link.
il p a Note: You might need to refresh the page until you observe the following results
sh in the Flow Trace:

c) On the Instance of ManageInventory Audit Trail page, scroll down and expand
the <payload> for the callbackClient activity at the end of the flow.

Oracle SOA Suite 11g: Build Composite Applications 276


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
i) What is the response in the status element of the callback?
Answer: It should be in-stock, as shown in the following image:

b le
fer a
a n s
ii) Optionally, if you are interested, expand other flow activity entries
n r
-t to examine
the flow execution sequence, and verify that each time the n o
InternalStoreService is invoked with each product a
a
Idssupplied in the
inputVariable. ) h ideฺ
d) Close the Flow Trace Web page, and return ฺ c om
to the t
TestG u
Web Service page.
h o o e n
11) On the “InternalStore [1.0]” Test Weby aServiceS t ud click the Request tab again, and
page,
modify the qtyOrdered element
z z u@ t h s second product (prodId value SKU102)
value inithe
a y e Test Web
to the value 10, and Click s e Service. For example:
u
( s hilp se to
z z u cen
ye li
ilp a
sh

a) On the Response tab, click the Launch Message Flow Trace link.

Oracle SOA Suite 11g: Build Composite Applications 277


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
b) On the Flow Trace page, observe that the InternalStoreService was invoked twice
(not three times) and click the ManageInventory BPEL component link.

c) On the Instance of ManageInventory Audit Trail page, scroll down and expand
the <payload> for the callbackClient activity at the end of the flow.
b le
i) What is the response in the status element of the callback? fer a
Answer: It should be out-of-stock, as shown in the following image: 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
a ye Note:liFor a degree of simplicity in the application scenario, the BPEL process
i l p reports an out-of-stock status if any one of the ordered products cannot be
sh filled by the amount of stock available. The While loop condition terminates
additional processing when the first product is encountered that does not have
sufficient quantity in the database to fulfill the order.
ii) Optionally, if you are interested, expand other flow activity entries to examine
the flow execution sequence, and verify that each time the
InternalStoreService is invoked with each product Id supplied in the
inputVariable.
d) Close the Flow Trace Web page.

Test the InternalStore acquireStock Operation


In this section you perform one test with ordered quantities that are less than the amount
available to check that the stock quantities in the database tables are correctly decreased
by the ordered amount.

Oracle SOA Suite 11g: Build Composite Applications 278


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
12) On the “InternalStore [1.0]” Test Web Service page, select the acquireStock
operation.

13) On the “InternalStore [1.0]” Test Web Service page, click the Request tab again and
replace all the XML in the XML View with the data from the b le
D:\labs\files\xml_in\prod-in-store.xml file, and click Test Web fer a
Service. ans
n - t r
a) On the Response tab, click the Launch Message Flow Trace link.
a no
has ideฺ
Note: In the Flow Trace tree there should be six rows of the InternalStoreService
present. )
b) On the Instance of ManageInventory Audit ฺ c ompage,
Trail t G u
scroll down and expand
h o o activity
the <payload> for the callbackClient_fulfilled e n at the end of the flow.
d
yaelementSoftuthe callbackClient_fulfilled?
c) What is the response in the
z @
status
u thiass shown in the following image:
Answer: It should be
y e z e
fulfilled,
a u s
( s hilp se to
z z u cen
ye li
i l p a
sh

Note: The process logic does not yet support the condition that there is not
enough quantity for products being acquired. This is omitted to eliminate a further
degree of complexity in the practices. However, the Fulfillment BPEL process
flow modified in the lesson 8 practice titled “Deploy and Test the POProcessing
Composite Application” will first check if the products are available and then
invoke the acquireStock operation.
d) Close the Flow Trace window.
14) In the JDeveloper window, execute the SQL statement to verify that the quantity
values for the products ordered from the INTERNAL_STORE database table have
been decreased. Use the following steps:

Oracle SOA Suite 11g: Build Composite Applications 279


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
a) In the Application Navigator, in the files application under the files >
Application Sources > sql folder, and right-click int_store_query.sql and
select Open. Alternatively, double-click the file name.
b) In the int_store_query.sql window, click the Execute Statement icon
( ), and select any of the soademo connections. Verify that you obtain the
following results in the Results tab:

b le
|
fer a
ans
Note: The product quantities should be less than 5 for each of the listed products.
- t
There should be two SKU101 products available, three SKU102 products, and
n r
four SKU200 products.
a no
c) Close the int_store_query.sql window.
) has ideฺ
Test the OnlineStore checkStock Operation ฺ c om t Gu
h o o e n
15) On the Oracle Enterprise Manager y a home
SOA d
u expand the SOA folder in the
tpage,
@ s S
Farm navigator, and click the
e z zu“OnlineStore
thi [1.0]” link.
16) On the “OnlineStore a y page,
[1.0]” e
usclick Test.
i l p t o
( sh ns[1.0]”
17) On the “OnlineStore
u e Test Web Service page, ensure that the Operation selected
ez z
is checkStock, e
for
lic example:
y
sh ilpa

Under the Request tab in the Input Arguments section, select the XML view and
replace the XML data with the contents of the file
D:\labs\files\xml_in\prod-in-store.xml, and click Test Web
Service.
Note: You can find this file in the files > Application Sources > xml_in folder in the
JDeveloper Application navigator window with the files application selected.
a) On the Response tab, click the Launch Message Flow Trace link.

Oracle SOA Suite 11g: Build Composite Applications 280


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
b) On the Flow Trace page, click the ManageStock BPEL component link.

c) On the Instance of ManageStock Audit Trail page, scroll down and expand the
<payload> for the callbackClient activity at the end of the flow.
b le
i) What is the response in the status element of the callback? fer a
Answer: It should be in-stock, as shown in the following image: 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 ii) Optionally, if you are interested, expand and examine the flow created by the
sh FlowN activity. Verify that each branch of the FlowN processes a different
product Id supplied from the inputVariable.
d) Close the Flow Trace Web page.

Oracle SOA Suite 11g: Build Composite Applications 281


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
18) On the “OnlineStore [1.0]” Test Web Service page, click the Request tab again, and
modify the quantity to a value of 10 for the second product (with product ID
SKU102), and click Test Web Service. Use the following image as a guide:

b le
fer a
ans
n - t r
no
a) On the Response tab, click the Launch Message Flow Trace link.
a
h a s ฺ link.
b) On the Flow Trace page, click the ManageStock BPEL component
Note: The OnlineStoreService reference row appears
o m de
) threeuitimes.
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 c) On the Instance of ManageStock Audit Trail page, scroll down and expand the
<payload> for the callbackClient activity at the end of the flow. What is the
response in the status element of the callback?
Answer: It should be out-of-stock, as shown in the following image:

Oracle SOA Suite 11g: Build Composite Applications 282


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
d) Why did three rows with the OnlineStoreService reference appear in the Flow
Trace tree?
Answer: Because the FlowN logic executes the invoke activity in each of the
three branches and the process determines if any product out of stock in a Switch
<case Any out of stock?> branch conditional expression.
e) Close the Flow Trace Web page.

Test the OnlineStore acquireStock Operation


In this section you perform one test with ordered quantities that are less than the amount
available to check that the stock quantities in the database tables are correctly decreased
by the ordered amount.
19) On the “OnlineStore [1.0]” Test Web Service page, select the acquireStock b le
operation. 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
20) On the “OnlineStore
h i lp [1.0]”
t Test
o Web Service page, click the Request tab again and
s XMLnsinethe XML View with the data from the
replace all(the
u
z z i c e
D:\labs\files\xml_in\prod-in-store.xml
e l file, and click Test Web
yService.
sh ilpa a) On the Response tab, click the Launch Message Flow Trace link.
Note: In the Flow Trace tree six rows of the OnlineStoreService present.

Oracle SOA Suite 11g: Build Composite Applications 283


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
b) On the Instance of ManageStock Audit Trail page, scroll down and expand the
<payload> for the callbackClient_fulfilled activity at the end of the flow. What is
the response in the status element of the callbackClient_fulfilled?

Answer: It should be fulfilled, as shown in the following image:

b le
fer a
ans
c) Close the Flow Trace window.
n - t r
no
21) In the JDeveloper window, execute the SQL statement to verify that the quantity
a
has ideฺ
values for the products ordered from the ONLINE_STORE database table have been
)
decreased. Use the following steps:
ฺ c om t Gu
a) In the Application Navigator, in the files
h o o application
e n under the files >
Application Sources > sql folder, d
yaand right-click
tu onl_store_query.sql and
select Open. Alternatively, @
u thi s
double-click
S
the file name.
e z z
a y
b) In the onl_store_query.sql u s e window, click the Execute Statement icon
( ), and s ilp anyeoftothe soademo connections. Verify that you obtain the
hselect
(
u results
following nsin the Results tab:
z z li c e
a ye
i l p
sh

Note: The product quantities for the listed products are: three SKU101 products
available, six SKU102 products, and one SKU200 product.
c) Close the onl_store_query.sql window.

Reset the INTERNAL_STORE and ONLINE_STORE Quantities


After decreasing the stock quantities in the database you now modify the code to reset the
stock quantity values in the INTERNAL_STORE and ONLINE_STORE tables.
22) In the JDeveloper window, execute the SQL script to reset the quantity values for the
selected set of products in the INTERNAL_STORE and ONLINE_STORE database
table. Use the following steps:

Oracle SOA Suite 11g: Build Composite Applications 284


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-4: Deploy and Test InternalStore and OnlineStore
Applications (continued)
a) In the Application Navigator, in the files application under the files >
Application Sources > sql folder, and right-click reset_store_data.sql
and select Open. Alternatively, double-click the file name.

b) In the reset_store_data.sql window, click the Run Script icon ( ), and


select any of the soademo connections. Verify that you obtain the following
results in the Results tab:

b le
fer a
ans
n - t r
c) Close the onl_store_query.sql window. a no
s ฺ
hafrom
o m )
23) In the Application Navigator, select POApplication name
u deapplication pull-
ithe
down menu.
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 285


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
In this practice, you create a Flow activity to perform parallel processing of stock
availability checks with the InternalStore and OnlineStore applications. The following
image shows part of the implementation of activities in the Scope_checkstock in the
Fulfillment BPEL Process of the POProcessing composite application:

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 sande OnlineStore
Note: The InternalStore
to composite applications are asynchronous. For
z
brevityzthe ufollowing c e n
activities are not illustrated in diagram within the Switch:
e l i
y• The Assign activities that prepare requests for the invocation of the acquireStock
sh ilpa operations.
• The Receive activities for the acquireStockResponse operations
To create the parallel flow in the Fulfillment BPEL Process, perform the following steps:
1) In the JDeveloper Application Navigator, under the POApplication in POProcessing
project, double-click and open the Fulfillment.bpel file in the BPEL Editor
window.

Create the Partner Links for the InternalStore and OnlineStore


In this section you create the partner links for the InternalStore and OnlineStore
composite applications.
Note: Do not create partner links for the ADF-BC services called InternalStoreService
and OnlineStoreService.
2) In the Fulfillment.bpel Design window, drag Partner Link (Web
Service/Adapter) component into the Partner Link column on the right side of the
window, and configure the partner link using instructions in the following table and
associated images as a guide:

Oracle SOA Suite 11g: Build Composite Applications 286


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
Step Screen/Page Description Choices or Values
a. Create Partner Link In the WSDL Settings click the SOA Resource
Lookup icon ( ).
b. SOA Resource Browser Select Resource Palette from the pull-down menu at
the top. Expand Application Server > soaserver >
SOA > InternalStore [1.0] (soaserver).
Select manageinventory_client_ep, and
click OK.
Note: If the InternalStore entry does not appear in the
Resource Palette, select the File System option and
select the Resource Palette again to refresh the list of
SOA entries displayed. e
c. Create Partner Link Observe that the WSDL URL is populated and the a b l
Name and Partner Link Type. Make the following s fer
changes to settings:
- t r an
no
Name: Replace ManageInventory with n
InternalStore a
Partner Role: Select
) has ideฺ
ฺ c om t Gu
ManageInventoryProvider

h o o
My Role: Select ManageInventoryRequester
e n
ya Stu
Click OK. d
d. Fulfillment.bpel
z @
Verify that the InternalStore partner link icon has
u this
Design
y e z been added into the right-hand column.
e
a u s
a)
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 287


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
b) Note: You may have to select the File System option and then select the Resource
Palette again to refresh the list of SOA entries displayed.

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

d)

Oracle SOA Suite 11g: Build Composite Applications 288


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
3) In the Fulfillment.bpel Design window, drag another Web Service/Partner
Link component into the Partner Link column on the right side of the window.
Configure the partner link using instructions in the following tabled and associated
image as a guide:
Step Screen/Page Description Choices or Values
a. Create Partner Link In the WSDL Settings click the SOA Resource
Lookup icon ( ).
b. SOA Resource Browser Select Resource Palette from the pull-down menu at
the top. Expand Application Server > soaserver >
SOA > OnlineStore [1.0] (soaserver).
Select managestock_client_ep, and click OK.
Note: If the OnlineStore entry does not appear in the b le
Resource Palette, select the File System option and
fer a
ans
select the Resource Palette again to refresh the list of
SOA entries displayed. n - t r
c. Create Partner Link no
Observe that the WSDL URL is populated and the
a
) has ideฺ
Name and Partner Link Type. Make the follow
changes to settings:
c om t Gu
Name: Replace ManageStock with OnlineStore

h o o e n
Partner Role: Select ManageStockProvider
ya Stu d
My Role: Select ManageStockRequester
z @
u this
Click OK.
y e z e
d. Fulfillment.bpela u s Verify that the OnlineStore partner link icon has been
Design hilp to added into the right-hand column.
( s ns e
a) zu c e
ye z li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 289


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
b) Note: You may need to select the File System option and select the Resource
Palette again to refresh the list of SOA entries displayed.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
c) 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)

4) Save the changes to your Fulfillment BPEL Process.

Oracle SOA Suite 11g: Build Composite Applications 290


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
Create a Flow and Switch Activity in Scope_checkstock
In this section, in the Scope_checkstock you create a parallel flow with two branches, and
a Switch to manage the results returned from activities executed in the flow.
5) In the Fulfillment.bpel Design window, expand the Scope_checkstock
activity.
6) In the Scope_checkstock activity, select and delete the Empty activity.
7) Inside the Scope_checkstock activity, create the activities with the name and
sequence listed in the following table:
Activity Type Activity Name
a. Flow Flow_checkstock
b. Switch Switch_selectstore b le
fer a
Use the following image as a guide: 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
8) Expand the Flow_checkstock activity.
9) Save the changes to your BPEL Process.

Configure Activities in the Flow Branch for the Internal Store


In this section, in the left branch of the Flow activity you create an asynchronous
invocation pattern using an Invoke with the InternalStore checkStock operation, and a
Receive with the checkStockResponse operation. You also create a Transform activity to
prepare the data for the Invoke activity.
10) Inside the Sequence_1 activity of the left-branch of the Flow_checkstock activity
create the following three activities in the sequence listed:
Activity Type Activity Name
a. Transform Transform_internalstore
b. Invoke Invoke_internalstore

Oracle SOA Suite 11g: Build Composite Applications 291


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
Activity Type Activity Name
c. Receive Receive_internalstore
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
y a Stu
11) First, to configure the Invoke_internalstore d
activity, double-click the
Invoke_internalstore activity and
z u @ his
associate it with the InternalStore with the
checkStock operation.zEnsure thatt you use the Automatically Create Input
a y ea Local Variable.
s e Use the following Create Partner Link
Variable icon to create u
( s hilp se to
image as a guide:
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 292


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
12) To configure the Transform_internalstore activity, double-click the
Transform_internalstore activity and perform the following steps:
a) In the Transform settings window, select the inputVariable and its payload
as the Source, and the
Invoke_internalstore_checkStock_InputVariable payload for
the target. Enter the name xsl/Transformation_internalstore for the
Mapper File and click the Create Mapping 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
b) In the Transformation_internalstore.xsl
( window, expand the source
u
z and
column
z c n
e the item element to the product element in the target column.
drag
y e Use the l i
following image as a guide:
i l p a
sh

c) In the Auto Map Preferences window, accept the default settings and click OK.

Oracle SOA Suite 11g: Build Composite Applications 293


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
d) In the Transformation_internalstore.xsl window, expand the source
and target elements and verify your mapper file resembles the following image:

b le
fer a
ans
n - t r
a no
) has ideฺ

e) Save the changes to your project, and closec om t Gu
the
h o o e n
ya Stu
Transformation_internalstore.xsl 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

Oracle SOA Suite 11g: Build Composite Applications 294


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
13) To configure the settings for the Receive_internalstore activity, double-click the
Receive_internalstore activity, set Partner Link to InternalStore, set Operation
to checkStockResponse, and click the Automatically Create Variable icon to
create Local Variable with the default name provided. 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 295


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
14) Verify that your Flow_checkstock is configured with activities and partner links
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
15) Save the changes to the y z
eFulfillment
eBPEL Process.
a u s
s hilp seintthe
Configure (Activities
o Flow Branch for the Online Store
z z u in the c e n
In this section, l i right branch of the Flow activity you create an asynchronous
ye pattern using an Invoke with the OnlineStore checkStock operation, and a
invocation
a
p
il Receive with the checkStockResponse operation. You also create a Transform activity to
sh prepare the data for the Invoke activity.
16) Inside the Sequence_1 activity of the right-branch of the Flow_checkstock activity
create the following three activities in the sequence listed:
Step Activity Type Activity Name
a. Transform Transform_onlinestore
b. Invoke Invoke_onlinestore
c. Receive Receive_onlinestore

Oracle SOA Suite 11g: Build Composite Applications 296


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)

Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
17) To configure the Invoke_onlinestore activity, ฺ c om t GtheuInvoke_onlinestore
double-click
h o o with theencheckStock operation.
activity and associate it with the OnlineStore
y ud Variable icon to create a Local
aCreateSInput
t
Variable. Use the followingz z u@ Partner
Ensure that you use the Automatically
Create t h is Link image as a guide:
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh

18) To configure the Transform_onlinestore activity, double-click the


Transform_onlinestore activity and perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 297


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
a) In the Transform settings window, select the inputVariable and its payload
as the Source, and the
Invoke_onlinestore_checkStock_InputVariable payload for the
target. Enter the name xsl/Transformation_onlinestore for the
Mapper File and click the Create Mapping icon:

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, expand the source
z @
b) In the Transformation_onlinestore.xsl
uelementthtoisthe product element in the target column.
column and drag the item
y e z e
a u s
( s h lp sPreferences
c) In the Auto iMap
e to window, accept the default settings and click OK.
d) In the
z z c e n
u Transformation_onlinestore.xsl window, expand the source
ye and l
target ielements and verify your mapper file resembles the following image:
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 298


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
e) Save the changes to your project, and close the
Transformation_onlinestore.xsl window.
19) To configure the settings for the Receive_onlinestore activity, double-click the
Receive_onlinestore activity, set Partner Link to OnlineStore, set Operation to
checkStockResponse, and click the Automatically Create Variable icon to
create Local Variable with the default name provided. 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 299


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
20) Verify that your Flow_checkstock is configured with activities and partner links
shown 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
ya Stu d
z @
u this
y e z e
a u s
( s hilpto the
21) Save the changes
s e to
Fulfillment BPEL Process.

z z e n to Select the Store that Fulfills the Order


u thecSwitch
Configure l i
yesection you configure two <case> branches to check if the responses from each
il p a
In this
sh store are in-stock. The left-to-right visual order of the <case> branches are important,
where the <case> branch for the InternalStore should appear as the left-most <case>
branch (in the source code it appears as the first <case> branch). This ensures that the
InternalStore is selected to provide the products for an order if it returns an in-stock
response. Next the <case> branch for the in-stock condition is evaluated for the
OnlineStore, which is only selected as the supplier of products if the InternalStore returns
an out-of-stock response. Finally, the <otherwise> branch is configured for the
situation where both the InternalStore and OnlineStore return an out-of-stock
response and the order has to be placed in a waiting state until the product quantities in
each store are updated.

Oracle SOA Suite 11g: Build Composite Applications 300


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
22) In the Fulfillment.bpel Design window, expand the Switch_selectstore
activity in the Scope_checkstock and create a second <case> branch by clicking the
Add Switch Case icon ( ) next to the Switch icon.

b le
fer a
ans
23) Configure the left-most Switch Case settings to check the response in the
n - t r
following steps: a no
Receive_internalstore_checkStockResponse_InputVariable by performing the

) as branch.
h<case> e ฺ
a) Double-click the <case> title section on the left-most
om t Gu i d
o ฺ c n
h o d e
@ ya Stu
z z u this
a e window,
ysettings se set Name to internalstore=in-
b) In the SwitchpCase u
l an Expression
to
stock(s hibuild
and
s e that compares the status element in the
u
z lice n
Receive_internalstore_checkStockResponse_InputVariable
z with the string 'in-
y e stock'. Use the following image as a guide:
i l p a
sh

Oracle SOA Suite 11g: Build Composite Applications 301


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
24) Configure the second Switch Case settings to check the response in the
Receive_onlinestore_checkStockResponse_InputVariable by performing the
following steps:
a) Double-click the <case> title section on the middle <case> branch.

b) In the Switch Case settings window, set Name to onlinestore=in-stock


and build an Expression that compares the status element in the
b le
Receive_onlinestore_checkStockResponse_InputVariable with the string 'in-
fer a
stock'. Use the following image as a guide:
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
25) Save the changes to the Fulfillment BPEL Process.

Create the Activity Sequences in the Switch_selectstore Branches


In this section you create and name all the activities that are executed in the two <case>
branches and the <otherwise> branch of the Switch_selectstore activity.

Oracle SOA Suite 11g: Build Composite Applications 302


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
26) In the Fulfillment.bpel Design window, create the named activities in the
branches and sequence shown 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
ya Stu d
z @ is steps:
u the following
h
For additional instructions,
e z use
e t
p a
a) To create activities
y u s
h i l in the
t o <case internalstore=in-stock> branch perform the
(s steps:nse
following
u
e z z i
i) Drag lan c e activity into the left <case> branch and rename it to
Assign
a y
i l p Assign_acquireinternal.
sh ii) Drag an Invoke activity into the left <case> branch after the
Assign_acquireinternal activity and rename it to
Invoke_acquireinternal.
iii) Drag a Receive activity into the left <case> branch after the
Invoke_acquireinternal activity and rename it to
Receive_acquireinternal.
b) To create activities in the <case onlinestore=in-stock> branch perform the
following steps:
i) Drag an Assign activity into the middle <case> branch and rename it to
Assign_acquireonline.
ii) Drag an Invoke activity into the middle <case> branch after the
Assign_acquireonline activity and rename it to Invoke_acquireonline.

Oracle SOA Suite 11g: Build Composite Applications 303


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
iii) Drag a Receive activity into the middle <case> branch after the
Invoke_acquireonline activity and rename it to
Receive_acquireonline.
c) For the <otherwise> branch, drag an Assign activity into branch and rename the
activity to Assign_waiting.
27) Save the changes to the Fulfillment BPEL Process.

Configure Activities in the <case internalstore=in-stock> Branch


In this section, you configure the Invoke_acquireinternal to use the acquireStock
operation in the InternalStore, assign the items already in a local scope variable to the
request message, and configure the Receive_acquireinternal to execute the
acquireStockResponse operation of the InternalStore. b le
Note: For simplicity, activities that check the response in messages returned from the fer a
an
acquireStockResponse operation are not included. For now assume that the products are
s
successfully acquired and the order fulfilled. n - t r
n o
28) To configure the Invoke_acquireinternal, set the Partner Link a
s to InternalStore,
Operation to acquireStock, and for Input automatically
) h a create aฺLocal Variable
e
with the default name provided. Use the imagecasoamguide: u i d
o ฺ 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

29) To configure the Assign_acquireinternal, create two copy operations using the
following steps:

Oracle SOA Suite 11g: Build Composite Applications 304


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
a) In the first copy operation, assign the StoreRequest element from the
Invoke_internalstore_checkStock_InputVariable to the StoreRequest element in
the Invoke_acquireinternal_acquireStock_InputVariable.
Note: The Invoke_internalstore_checkStock_InputVariable was already
populated by the Transform_internalstore activity.

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
ya theSliteral
b) In the second copy operation, assign d
tu string 'completed' to the
z @
u thi
shipStatus in the outputVariable. Usesthe image as a guide:
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 305


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
30) To configure the Receive_acquireinternal, set Partner Link to InternalStore,
Operation to acquireStockResponse, and use the Automatically Create
Variable icon to create the variable as a Local Variable with the default name
provided.

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
31) Save the changes
( s e to
Fulfillment BPEL Process.
z u
z lice n
y e
Configure Activities in the <case onlinestore=in-stock> Branch
p a
il In this section, you configure the Invoke_acquireonline to use the acquireStock operation
sh in the OnlineStore, assign the items already in a local scope variable to the request
message, and configure the Receive_acquireonline to execute the acquireStockResponse
operation of the OnlineStore.
Note: For simplicity, activities that check the response in messaged returned from the
acquireStockResponse operation are not included. For now you assume that the products
are successfully acquired and the order fulfilled.

Oracle SOA Suite 11g: Build Composite Applications 306


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
32) To configure the Invoke_acquireonline, set the Partner Link to OnlineStore,
Operation to acquireStock, and for Input automatically create a Local Variable
with the default name provided. Use the 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
33) To configure theilp aye o use create two copy operations using the
Assign_acquireonline,
s h se t
following (steps:
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 307


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
a) In the first copy operation, assign the StoreRequest element from the
Invoke_onlinestore_checkStock_InputVariable to the StoreRequest element in the
Invoke_acquireonline_acquireStock_InputVariable.
Note: The Invoke_onlinestore_checkStock_InputVariable was already populated
by the Transform_onlinestore activity.

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
b) In the second copy operation,
z @
u assign h s literal string 'completed' to the shipStatus
ithe
in the outputVariable. z t
e Use theseimage as a guide:
a y 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 308


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
34) To configure the Receive_acquireonline, set Partner Link to OnlineStore,
Operation to acquireStockResponse, and use the Automatically Create
Variable icon to create the variable as a Local Variable with the default name
provided.

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 hilpto the
35) Save the changes s e to
Fulfillment BPEL Process.
z u e n
y
Configure lic
ez Activities <otherwise> Branch
p a
il In this section, you configure the Assign_waiting activity in the <otherwise> branch to
sh update the shipStatus in the outputVariable to indicate the order is not shipped because
neither store has items in stock.

Oracle SOA Suite 11g: Build Composite Applications 309


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
36) To configure the Assign_waiting, create a copy operation that stores the literal value
'waiting' in the shipStatus element of the outputVariable. Use the 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
@
zu Design h iswindow verify that the Switch_selectstore
z
37) In the Fulfillment BPELeProcess e t
activity resembles a
they u
followingsimage:
( s hilp se to
z z u cen
ye li
ilp a
sh

Oracle SOA Suite 11g: Build Composite Applications 310


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
Important Note: In above image of the Switch_selectstore activity flow, 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 this 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:
a) In the Fulfillment.bpel Design window, expand the Switch_selectstore
activity.

b le
fer a
ans
n - t r
a no
b) In the Fulfillment.bpel Design window, select thes“<case onlinestore=in-
stock>” branch. ) ha 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
li
yc)e In the Fulfillment.bpel Design window, at the bottom-left side of the
i l p a window click the Source tab.
sh

d) In the Fulfillment.bpel Source window, just below the “<switch


name=="Switch_selectstore">” element, click the collapse icon in the line gutter
for the line containing the source code starting with
“<case condition="bpws:getVariableData('Receive_onlinestore_...”

Oracle SOA Suite 11g: Build Composite Applications 311


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
e) In the Fulfillment.bpel Source window, just below the collapses “<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_...”

f) In the Fulfillment.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 b le
the “<switch name="Switch_selectstore">” element):
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
g) z
ye li Source window, after dragging the internal store

i l p a <case> branch the Source window automatically expands the code and you can
sh verify that the “<case
condition="bpws:getVariableData('Receive_internalstore_...” line appears
immediately after the “<switch name="Switch_selectstore">” element:

h) In the Fulfillment.bpel Source window, at the bottom-left side of the


window click the Design tab.

Oracle SOA Suite 11g: Build Composite Applications 312


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
i) In the Fulfillment.bpel Design window, verify that the “<case
internalstore=in-stock>” branch is the left-most branch.

38) Save the changes to the Fulfillment BPEL Process.

Modify Fulfillment to Ship Completed Products


In this section, you create one more Switch activity that checks the shipStatus in the b le
fer
outputVariable. In the <case> branch check if the shipStatus is ‘completed’ and execute
a
the Scope_shiporder activity. an s
n - t r
no
39) In the Fulfillment.bpel Diagram window, collapse the Scope_checkstock and
a
Scope_shiporder activities.
) h as eฺ
40) In the Fulfillment.bpel Diagram window, drag
o m a Switch
u idactivity between the
c
oฺ Rename
Scope_checkstock and Scope_shiporder activities.
n G
t the Switch to
Switch_orderstatus. 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
ilp a
sh

41) Expand the Switch_orderstatus activity and configure with the following steps:
a) Select and delete the <otherwise> branch.
Note: Click Yes, when the Confirm Delete window is displayed.

Oracle SOA Suite 11g: Build Composite Applications 313


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
b) Double-click the <case> branch title to open the Switch Case settings window, set
Name to order completed? and create an expression that compares the
shipStatus element of the outputVariable to the string literal value
'completed'. Use the following image as a guide:

b le
fer a
ans
n - t r
a no
) has ideฺ
c o m Gu
o ฺ n t
c) Drag the Scope_shiporder into the <caseoorder completed?> branch. Use the
h d e
following image as a guide:
@ 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

Oracle SOA Suite 11g: Build Composite Applications 314


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)
42) Collapse all the scope activities in the Fulfillment.bpel Design window, and
verify that the Fulfillment BPEL Process flow resembles 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
ye li
i l p a
sh 43) Save changes to the Fulfillment BPEL Process.

Oracle SOA Suite 11g: Build Composite Applications 315


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
In this practice/task, you deploy the updated POProcessing composite application with all
the changes made to the Fulfillment BPEL process. You perform the following tests:
• Submit an order that is fulfilled by the internal store.
• Submit an order that is fulfilled by the online store.
• Submit an order that cannot be fulfilled by any store.
You initiate and monitor the results of these tests in Oracle Enterprise Manager.
1) In the JDeveloper Application Navigator, ensure that the POApplication and its
projects are displayed.

Deploy the POProcessing Composite Project


2) To deploy the POProcessing composite application, right-click the POProcessing
project node and select Deploy > POProcessing > to > soaserver. b le
fer a
3) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
an s
composites with the same revision ID” option, and click OK.
n - t r
no
Note: Monitor the “Deployment – Log” window to ensure deployment is successful.
a
4) In a Web browser window, login to the Oracle Enterprise a s page
hManager ฺ (URL
http://localhost:7001/em), as the user weblogic with )
m Guid
password e
welcome1.
c o
5) On the Oracle Enterprise Manager SOA home
h o oฺ page,eexpand
n t the SOA folder in the
Farm navigator, and click the “POProcessing
y a S[1.0]” t ud link.
z @ his
uthe
Test an Order Fulfilled e z by
e t
Internal Store
In this test you submit a y u s
pthe po-medium-ipod.xml for processing and verify that the
h i l t o
sby thenInternalStore,
(has
order is fulfilled
u e
sdecreased. and verify that the stock quantity levels for the
products
e z z
order e
been
lic
y
ilpa
6) In the JDeveloper window, first display the current stock quantity levels for the
sh internal and online stores by performing the following steps:
a) In the Application Navigator, select the files application.
b) Expand the files > Application Sources > sql folder, and double-click
ipod_query.sql.
c) In the ipod_query.sql window, click the Execute Statement icon ( ), and
select any of the soademo connections. Confirm these results in the Results tab:

Oracle SOA Suite 11g: Build Composite Applications 316


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
d) Do not close the ipod_query.sql window, because you reuse the query on
this page in subsequent practice steps.
7) On the “POProcessing [1.0]” Test Web Service page, under the Request tab Input
Arguments section, select the XML View and perform the following steps:
a) Replace the XML data with the contents of the file
D:\labs\files\xml_in\po-medium-ipod.xml.
b) Observe that the order has a quantity of 10 for products with the ID of SKU303
and SKU304. Then click Test Web Service.
c) On the Response tab, click the Launch Message Flow Trace link.
8) On the Flow Trace page, examine the Trace tree and answer the following questions: e
a b l
a) What is one indicator that can be used to quickly tell if the order was fulfilled? er
n s f
b) Which store was selected to fulfill the order? Explain your answer. tra
Answers for Step 8. n on-
a with a JMS Adapter
a. A quick indication that the order was fulfilled is to locate asrow
component being executed. This indicates that the order ) a
hwas shipped,
e ฺ and therefore
oFormexample:u i d
it must have been fulfilled by one of the stores.
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 317


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for Step 8.
b. The InternalStore was used to fulfill the order request. This can be determined by the
presence of the second occurrence of the InternalStore Reference row, with the
ManageInventory BPEL Component containing four nested InternalStoreService
Reference rows. Two of the InternalStoreService Reference rows are used to check
if they can obtain the database product quantities and the second two entries are for
updating the product quantities in the database. For example:

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 9) On the Flow Trace, verify your answers by clicking the Fulfillment BPEL
Component link, and using the “Instance of Fulfillment” > Flow tabbed page, answer
the following questions:
a) In the Scope_checkstock activity flow, what was the response returned by the
OnlineStore? Explain how you determined your answer.
b) In the Scope_checkstock activity flow, what was the response returned by the
InternalStore? Explain how you determined your answer.
c) In the Scope_checkstock activity flow, what is the name of the first Assign
activity in the Switch that appears after the parallel flow? Describe two ways to
determine the answer.
d) What are the carrier and shipStatus values returned as response in the
callbackClient activity?

Oracle SOA Suite 11g: Build Composite Applications 318


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for Step 9.
a. The result return is out-of-stock. The result returned from the OnlineStore can
be determined by clicking the Receive_onlinestore activity icon. In the Activity
Details window, click the “View xml document” link:

b le
fer a
an s
n - t r
no
In the Web browser window that is opened you can view the response message:
a
) has ideฺ
ฺ c om t Gu
h o o e n
d
yaresultSreturned
tu from the InternalStore is
b. The result return is in-stock.@ The
u thi s
zReceive_internalstore
y z
determined by clickingethe e activity icon. In the Activity
a s
u xml document” link:
Details window,lpclick the “View
h i t o
u (s nse
e z z l i c e
y
sh ilpa

In the Web browser window that is opened you can view the response message:

Oracle SOA Suite 11g: Build Composite Applications 319


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for Step 9.
c. The name of the first Assign activity in the Switch appearing after the parallel flow
contained in Scope_checkstock, is called Assign_acquireinternal.

You can determine the name either by moving and holding the mouse over the
Assign icon or clicking the Assign icon. Clicking the icon displays the full activity
name in the Activity Details window. The sample image demonstrates the first
technique:

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 320


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for Step 9.
d. The shipStatus value is completed, and the carrier is UPS. Click the
callbackClient activity icon in the Flow page to view the values in the Activity
Details window. For example:

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 z
e display ethe updated stock quantity levels for the internal
a
10) In the JDeveloper window, u s
( s hilpby sperforming
and online stores e to the following steps:
a)ez
u cen
Inzthe ipod_query.sql
y li window, click the Execute Statement icon ( ), and

ilpa
verify that you obtain the following results in the Results tab:
sh

Note: The original values for the product with SKU303 was 15 and SKU304 was
10. The order acquired a quantity of 10 for each product. Therefore, the database
results of 5 and 0, respectively, are consistent with the processing performed.
b) Do not close the ipod_query.sql window.

Oracle SOA Suite 11g: Build Composite Applications 321


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Test an Order Fulfilled by the Online Store
In this test you submit the po-medium-ipod.xml a second time with different
quantity values and verify that the order is fulfilled by the OnlineStore, and verify that the
stock quantity levels for the products order has been decreased.
11) On the “POProcessing [1.0]” Test Web Service page, click the Request tab.
Note: The Input Arguments section should contain the XML data submitted in the
previous test. If not then select the XML View and replace the XML data with the
contents of the file D:\labs\files\xml_in\po-medium-ipod.xml.
a) First update the <quantity> element values for both products to a value of 5. 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) After updating the new quantities, click Test Web Service.


c) On the Response tab, click the Launch Message Flow Trace link.
12) On the Flow Trace page, examine the Trace tree and check if the order was fulfilled
by the OnlineStore. Explain how you can verify the answer using the Flow tabbed
page for the Fulfillment BPEL component instance.

One Possible Answer:


The online store was used to fulfill the order because the order requested a quantity of
5 for each product. The online store database has a quantity of more than 5 for each
product. However, the internal store has a zero quantity for one of the products
ordered. To verify the outcome:
a) Click the Fulfillment link in the Trace tree.

Oracle SOA Suite 11g: Build Composite Applications 322


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
b) On the “Instance of Fulfillment” page, click the Flow tab.
c) On the Flow tab, scroll down and click the Receive_internalstore activity. In the
Activity Details window click the “View xml document” link.
d) On the Web page that is opened the response from the internal store is out-of-
stock for example:

e) On the Flow tab, scroll down and click the Receive_onlinestore activity. In the
Activity Details window click the click the “View xml document” link.
b le
f) On the Web page that is opened the response from the online store is in-stock
f er a
for example:
an s
- t r
n on
s a
) a
h ideฺ
c m Gu
opage,
13) On the JDeveloper ipod_query.sql tabbed
o ฺ
ohas reduced t the Execute Statement
click
n
h e
a Stud the product quantities by a
icon and confirm that the ONLINE column
value of 5 for the two products @ y
SKU303 s and SKU304 from 8 and 7 to the values 3
z u
z following
and 2, respectively. Useethe h i
t image as a guide:
a y u s e
h i lp t o
u (s nse
e z z l i c e
y
sh ilpa

14) Do not close the ipod_query.sql tabbed page in JDeveloper.


15) Close any Activity Details windows and Web pages that display the XML responses
or Flow Trace pages.

Test an Order Not Fulfilled by Any Store.


In this test you submit the po-large-ipod.xml for processing and verify that the
order is not fulfilled by any store and that the Fulfillment process returns a “waiting”
status. You also verify the Scope_shiporder is not processed and that the stock quantity
levels for the products are not altered.
16) On the “POProcessing [1.0]” Test Web Service page, click the Request tab, and
perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 323


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
a) In the XML View of the Input Arguments section, replace existing data with text
in the D:\labs\files\xml_in\po-large-ipod.xml file, and click Test
Web Service.
b) On the Response tab, click the Launch Message Flow Trace link.
17) On the Flow Trace page, and while viewing the Trace tree, how do you know that the
order was not fulfilled by either of the stores? Use this 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 Answer: If you examine the rows under the Fulfillment BPEL Component you can
sh see that there is no instance for a JMS Adapter service. This indicates the order was
not shipped. In addition, there is not a second instance for either the OnlineStore or
InternalStore. The presence of a second instance indicates the acquireStock operation
is invoked.
18) On the Flow Trace page, click the Fulfillment link to examine the Audit Trail tabbed
page on the “Instance of Fulfillment” page. Answer the following questions:
a) What is the shipStatus response returned by the Fulfillment BPEL process?
b) What is the XML response from the Receive_onlinestore?
c) What is the XML response from the Receive_internalstore?
d) Have the quantities for the products in the online and internal store database
tables been changed by this instance of the POProcessing composite application?
Explain your answer.

Oracle SOA Suite 11g: Build Composite Applications 324


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for step 18.
a. The shipStatus response returned by the Fulfillment BPEL process is “waiting”. This
indicates that the order cannot be fulfilled yet. To verify the response message,
expand the <payload> part of the callbackClient in the Audit Trail tabbed page:

b le
fer a
ans
n - t r
no
b. The response received from the online store is out-of-stock, as expected. To
a
) has ideฺ
view the response, on the Audit Trail tabbed page scroll down and click the “View
XML Document” link that appears below the Receive_onlinestore activity. For
example: ฺ 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
The following XML response message is displayed in another Web page:

Oracle SOA Suite 11g: Build Composite Applications 325


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
Answers for step 18.
c. The response received from the internal store is out-of-stock, as expected. To
view the response, on the Audit Trail tabbed page scroll down and click the “View
XML Document” link that appears below the Receive_internalstore activity. For
example:

b le
The following XML response message is displayed in another Web page:
fer a
an s
n - t r
a no
) has ideฺ
d. No. The quantities for the product with the ID of
ฺ c om t G u not been changed.
SKU305 have
Note: The po-large-ipod.xml order
h o orequestedena quantity of 20 for the product
with ID of SKU305. Neither storeyhasa enough t d to fulfill the order.
uquantity
u@ this S
e z z
a y u s e
( s hilp se to
z z u cen
ye li
ilp a
sh

Increase the Quantity of iPod Products in each Store


In this section, you execute the SQL statement supplied in the update_ipod.sql file
to increase the quantity of selected iPod products.
19) In the JDeveloper window, first display the current stock quantity levels for the
internal and online stores by performing the following steps:
a) In the Application Navigator, with the files application selected and the files >
Application Sources > sql folder expanded, and double-click
ipod_update.sql.

Oracle SOA Suite 11g: Build Composite Applications 326


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 9-6: Deploy and Test POProcessing with Stock Checks
(continued)
b) In the ipod_update.sql window, click the Run Script icon ( ), and select
any of the soademo connections.

c) In the ipod_update.sql window, under the Script Output tabbed section


verify that you see following results:

b le
fer a
an s
n - t r
a
commit the database changes performed by the UPDATE statements.
no
d) In the ipod_update.sql window, click the Commit icon or press F11, to

) has ideฺ
ฺ c om t Gu
h o o e n
ya Stu d
z @
u this
e) In the ipod_query.sqly e z e click the Execute Statement icon ( ), and
window,
a u s
s
results(in hthe pResults
select any ofilthe to connections. Verify that you obtain the following
soademo
e
z z u cens tab:

ye li
i l p a
sh

20) Close the ipod_query.sql and ipod_update.sql windows.


21) Close any Web browser windows displaying a Flow Trace page.

Oracle SOA Suite 11g: Build Composite Applications 327


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practices for Lesson 10
The goal of this practice is to create and handle a business fault condition in the
CreditCardValidation and the POProcessing composite applications.

You modify the CreditCardValidation composite application implementation to include a


BPEL process that obtains the credit card status from the database and performs a credit
limit check on valid cards. The following image shows the changes to the
CreditCardValidation composite application assembly model:

b le
fer a
an s
The changes to the assembly model include: n - t r
• Create the CheckCCLimit BPEL Process component a no
BPEL Process components. ) has ideฺ
• Create new wire between the ValidateCreditCard Mediator and CheckCCLimit

ฺ c om t Gu
• Create a new wire between the CheckCCLimit BPEL Process and
h o o e n
CreditCardDBService.
ya Stu d
Note: When creating new wires from the Mediator component you also need to create
z @
u this
new transformation files. In this case, you also configure filters to ensure you direct the
y e z e
a u s
appropriate cards to the correct target service.
s h ilp e to
You createu ( ntosget theBPEL
the CheckCCLimit Process implementation to invoke the
e z z li
CreditCardDBService c e credit card status and its credit limit, and check if the
y
ilpa
order total exceeds the credit limit. This is illustrated in the following image:
sh

Note: If the order total exceeds the credit limit you throw a BPEL fault, which is

Oracle SOA Suite 11g: Build Composite Applications 328


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
propagated to the Mediator component, and then to the composite application client,
which is the ApproveCCOrder BPEL process in the POProcessing composite application.

Finally, you modify the ApproveCCOrder BPEL process to handle the fault propagated
for the credit limit error, 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 theSfault d
tu and sets the order status in the
The ApproveCCOrder BPEL process handles
@
zuto indicate s
outputVariable response message
e z e thi the order is rejected.
p a y us
i l t o
u (sh nse
e z z lice
y
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 329


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model
In this practice, you modify the CreditCardValidation composite application
implementation to include a BPEL process that obtains the credit card status from the
database and performs a credit limit check on valid cards. The changes require:
• Creating the CheckCCLimit BPEL Process component
• Creating new wire between the ValidateCreditCard Mediator and CheckCCLimit
BPEL Process components.
• Creating a new wire between the CheckCCLimit BPEL Process and
CreditCardDBService.
• Creating transformations needed for the new wire added to the Mediator
component.
• Creating filters in ValidateCreditCard Mediator to ensure credit cards that do not le
a b
fer
start with the digits “9000” are sent to the BPEL process and all cards that begin
with the digits “9000” are sent to the CreditCardDBService.
ans
t r
Note: The implementation approach chosen enables us to retain existing functionality in
n -
use of wires and appropriate filters. a no
the composite while extending the implementation with new functionality, through the

) has ideฺ
To complete this task perform the following steps: om u
ฺ c t G
o theePOApplication
n
1) In the JDeveloper Application Navigator,
a h oensure d is the selected
application. y S t u
z u@ h i s
a y ez se t
i lp t o u
h
(s nse
z z u c eApplication Navigator, if needed expand the CreditCardValidation
2) Inethe i
JDeveloper
l
y> SOA Content folder and double-click the composite.xml to open the assembly
sh ilpa model in the Composite Editor window.
3) In addition, open the ValidateCreditCard.wsdl file in the WSDL Editor and
answer the following questions:
a) What is the name of the fault for the validateCC operation?
Hint: Expand the validateCC operation node in the validateCC_ptt tree under the
Port Types column, and select the fault node. The fault name can be found in
Property Inspector, which may require you to click View > Property Inspector to
be visible.
b) What is the message name for the fault? Find two places where you can determine
this information.
c) What are the fault message type and part names?
d) Where can you find the definition of the fault message type name, and what leaf
child element name in the fault message type structure?
Hint: Click the Imports button in the WSDL editor.

Oracle SOA Suite 11g: Build Composite Applications 330


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
Answers to step 3.
a. The name of the fault is validateCCfault. The following image reveals the name
property in the Property Inspector after you click the fault component in WSDL
operation:

b le
fer a
ans
n - t r
no
Note: To ensure the Property Inspector is visible, select View > Property Inspector.
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 331


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
Answers to step 3.
b. The fault message name is called faultMessage, which is defined in a
<message> element in the Source tab of the WSDL Editor.
However, the name of the fault message can be found in two places on the Design
tab. The first place, is the in the message property in the Property Inspector, as
shown in the image for answer “a.” The second location where you can find the
message name is by expanding the Messages section in the WSDL editor by clicking
the “Messages (Show contents)” icon:

b le
fer a
ans
n - t r
a no
) has ideฺ
With the Messages section expanded and theฺc omselected
fault t G u
in the Port Types section,
the message name and its definition ish o o in theeMessages
visible n section:
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

c. The message fault type name is CreditCheckFault, and the message fault part
name is called fault in this case.
The message type and part names are visible in the expanded message name entry
listed under the Messages section of the WDSL Editor (refer to the last image in
answer “b.”

Oracle SOA Suite 11g: Build Composite Applications 332


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
Answers to step 3.
d. You can find the definition of the fault message type name in the imported
creditcheck.xsd XML Schema file. To determine the leaf child element name
of the CreditCheckFault XML schema type, click Imports > creditcheck.xsd:

Note: Clicking the Imports > creditcheck.xsd opens the XSD file in the XML
Schema Editor, where you can expand the CreditCheckFault element and view its
b le
definition and child leaf node, which is named “error’:
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
4) Close the creditcheck.xsd and ValidateCreditCard.wsdl windows in
sh JDeveloper.

Create the CreditCCLimit BPEL Process Component


In this section you create a new BPEL component in the assembly model and use the
ValidateCreditCard.wsdl for the BPEL component interface.
Note: You use ValidateCreditCard.wsdl file for the interface to make the BPEL
interface compatible with the ValidateCreditCard Mediator component and for the
WSDL fault definition that is used in the BPEL process flow implementation.
5) In the composite.xml file with the CreditCardValidation assembly model, create
a new BPEL Process component called CheckCCLimit and use the “Base on a
WSDL” template. Ensure the BPEL Process component is not exposed as a SOAP
service. Use instructions in the following table and associated screenshots:

Oracle SOA Suite 11g: Build Composite Applications 333


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
Step Screen/Page Description Choices or Values
a. Create BPEL Process Name: CheckCCLimit
Template: “Base on a WSDL”
Deselect the “Expose as a SOAP service”
option.
WSDL URL: Click the Find Existing
WSDLs icon ( ).
b. SOA Resource Browser Accept the default “File System” project
location for the WSDL, select
ValidateCreditCard.wsdl and click
OK.
c. Create BPEL Process Verify the following additional fields are set:
b le
WSDL URL:
fer a
ValidateCreditCard.wsdl
ans
Port Type: validateCC_ptt
n - t r
Click OK.
a no
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 10-1: Modify CreditCardValidation Composite Assembly
Model (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
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 335


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
6) In the composite.xml window, verify that the BPEL Component has been added
to the assembly model without wires.

7) Save the changes to the composite.xml.

Create New Wires in the CreditCardValidation Assembly Model


In this section you create the new wires in the assembly model to send validation requests
from the Mediator component to the BPEL Component in addition to the
CreditCardDBService, and from the BPEL Component to the CreditCardDBService.
Note: In this practice in the next section of this practice titled “Configure the Mediator
Filters and Transformations” you add the filters and transformations needed to send credit
cards to the appropriate target for processing.
b le
8) In the composite.xml window, create the following two wires: fer a
a n s
a) Create a new wire between the ValidateCreditCard Mediator component
n r
-t and the
CheckCCLimit BPEL component. n o
a
) h as eฺ and the
b) Create a new wire between the CheckCCLimit BPEL component
CreditCardDBService external reference.
c o m Guid
9) In the composite.xml window, verify that
h o oฺ your efinal
n t CreditCardValidation
y a image:
assembly model resembles the following
S t ud
z z u@ this
a y e s e
u
( s hilp se to
z z u cen
ye li
ilp a
sh
10) Save the changes to the composite.xml file.

Configure the Mediator Filters and Transformations


In this section you add the filters and transformations needed to send credit cards to the
appropriate target for processing. The filters ensure that credit cards beginning with the
string “9000” are sent to the CreditCardDBService, and all other cards numbers are sent
through the CheckCCLimit BPEL process first.
11) In the composite.xml window, double-click the ValidateCreditCard Mediator
component icon to open it in the Mediator Editor window.
12) In the ValidateCreditCard.mplan window, to create the filter expression for
the first routing rule section whose target is
CreditCardDBService::CreditCardDBServiceSelect perform the following steps:

Oracle SOA Suite 11g: Build Composite Applications 336


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
a) Collapse the routing rule section for the
CreditCardDBService::CreditCardDBServiceSelect target, and click the Invoke
Expression Builder icon ( ) to the right of the <<Filter Expression>> field.
b) In the Expression Builder window, create the following expression:

starts-with($in.request/inp1:CreditCheckRequest
/inp1:CCNumber, '9000')

Note: Enter the expression on a single line. 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 h ilp e to
( nssection whose target iswindow, to create the filter expression for
13) In the ValidateCreditCard.mplan
uroutingcrule
the
e z z
first li e
a yCheckCCLimit/checkcclimit_client::validateCC perform the following steps:
sh ilp a) In routing rule with the CheckCCLimit/checkcclimit_client::validateCC target,
click the Invoke Expression Builder icon ( ) to the right of the <<Filter
Expression>> field.
b) In the Expression Builder window, create the following expression:

not(starts-with($in.request/inp1:CreditCheckRequest
/inp1:CCNumber, '9000'))

Oracle SOA Suite 11g: Build Composite Applications 337


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
Note: Enter the expression on one line. Use the following image as a guide:

b le
fer a
an s
n - t r
a no
c) Save the changes to the Mediator component file.
) has ideฺ
14) In the ValidateCreditCard.mplan window,
ฺ c omcreate
t Gtheurequest message
transformation for the BPEL component by
h o operforming
e n the following steps:
ya Stu d
a) In the request section for the CheckCCLimit/checkcclimit_client::validateCC
@
anuexisting
z h is file or create a new one.” icon ( )
z
target, click the “Select
e containing t mapper
e the text “request: <<Transformation Map>>”
next to Transforma yUsing u s
( s hilp se to
z z u cen
ye li
ilp a
sh
b) In the Request Transformation Map window, select the Create New Mapper File
option accepting the default name supplied, and click OK.
c) In the CreditCheckRequest_To_CreditCheckRequest.xsl XLST
Mapper window, map all source elements to their corresponding target elements.
Use the following image as a guide:

d) Save the changes to the XSLT map and close the


CreditCheckRequest_To_CreditCheckRequest.xsl XSLT Mapper
window.

Oracle SOA Suite 11g: Build Composite Applications 338


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
15) In the ValidateCreditCard.mplan window, create the reply message
transformation for the BPEL component by performing the following steps:
a) In the second (bottom) routing rule Synchronous Reply section which also
contains “*Initial Caller*::validateCC:output” as the target, click the “Select an
existing mapper file or create a new one.” icon ( ) for Transform Using with
text “reply: <<Transformation Map>>”.
Note: Ensure this is done next to the field where Transform Using contains
“reply: <<Transformation Map>>”.
b) In the Reply Transformation Map window, select the Create New Mapper File
option accepting the default name supplied, and click OK.
c) In the CreditCheckResponse_To_CreditCheckResponse.xsl XLST
b le
Mapper window, map the source elements to its corresponding target element.
fer a
Use the following image as a guide:
an s
n - t r
a no
) has ideฺ
c m Gu
othe
d) Save the changes to the XSLT map and close
o o ฺ n t
h
a Stud
CreditCheckResponse_To_CreditCheckResponse.xsl e XSLT
Mapper window. y
z z u@ this window, observe that the Mediator Editor
a y e
16) In the ValidateCreditCard.mplan
s e created a routing rule to return the fault (if it
section u
lp initialtcaller.
has created the Fault and already
o Create the fault message transformation for the
should arise)
( s htoithe e
u ceby
BPELzcomponent
z nsperforming the following steps:
li section for the “*Initial Caller*::validateCCfault” target, click the
ya)e In the Faults
ilp a
sh “Select an existing mapper file or create a new one.” icon ( ) for Transform
Using with text “fault: <<Transformation Map>>”.
b) In the Fault Transformation Map window, select the Create New Mapper File
option accepting the default name supplied, and click OK.
c) In the CreditCheckFault_To_CreditCheckFault.xsl XLST Mapper
window, map all source elements to their corresponding target elements. Use the
following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 339


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
d) Save the changes to the XSLT map and close the
CreditCheckFault_To_CreditCheckFault.xsl XSLT Mapper
window.
17) Close the ValidateCreditCard.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 340


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
In this practice/task, you create the CheckCCLimit BPEL Process implementation to
invoke the CreditCardDBService to get the credit card status and credit limit for the given
card number, and then for VALID cards check if the order total exceeds the credit limit.
The process should throw an exception if the order total exceeds the credit limit.
1) In the composite.xml window, for CreditCardValidation, double-click the
CheckCCLimit BPEL Component icon to open it in the BPEL Editor.

Create the CheckCCLimit Main Process Activity Sequence


In this section you create the main activities that form the BPEL process flow.
2) In the CheckCCLimit.bpel Design window, create the activity types and names
in the order listed in the following table (between the receiveInput and replyOutput
activities): b le
fer a
Activity Type Activity Name Purpose
ans
a. Assign Assign_ccinfo - t r
Copies the credit card number to
n
no
CreditCardDBService request
a
has ideฺ
variable.
b. Invoke Invoke_ccservice )
m Gu Invokes the CreditCardDBService
c. Assign Assign_ccstatus ฺco Copies the credit card status value
o o e n t from the CreditCardDBService
y h
a Stud response variable.
d. Switch
z z u@ this
Switch_cclimit Checks if the card status is VALID
a y e s e and if the order total exceeds the
u
( s hilp se to credit card limit returned with the
CreditCardDBService response.
z z u cen
ye li
i l p a Note: These activities form the main process flow. In subsequent steps you configure
sh the settings for each of the activities, and then add activities to throw the exception
and propagate the exception message to the invoker of this BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 341


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
Note: Your initial BPEL activity flow should resemble 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
ye li
i l p a
sh
3) Save the changes to the CheckCCLimit BPEL process diagram.

Oracle SOA Suite 11g: Build Composite Applications 342


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
Configure the Invoke_ccservice Activity
4) In the CheckCCLimit.bpel Design window, double-click the Invoke_ccservice
activity and configure it to invoke the CreditCardDBService. Use the Automatically
Create Variable’s icons to create Global variables for the Input and Output settings,
accepting the default variable names provided.
Note: The partner link for the CreditCardDBService was created in the BPEL process
when you created the wire between the BPEL process and the CreditCardDBService
in the composite assembly mode. Use the following image as a guide to the Invoke
activity settings:

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
5) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 343


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
Configure the Assign_ccinfo Activity
6) To configure the Assign_ccinfo activity, double-click the icon and create a single
copy operation that copies the CCNumber element from the inputVariable to the
ccNum element in the Invoke_ccservice_CreditCardDBServiceSelect_InputVariable.
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
7) Save the changes to your BPELz @
u process.h is
e z e t
a y u s
h i lp
Configure the Assign_ccstatus
t o Activity
u (s the Assign_ccstatus
8) To configure n se activity, double-click the icon and create a single
z z c e
e operationli that copies the status element returned in the
a ycopy
Invoke_ccservice_CreditCardDBServiceSelect_OutputVariable into the status
sh ilp variable of the process outputVariable. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 344


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
9) Save the changes to the BPEL process.

Configure the Switch_cclimit Activity Condition and Branches


In this section, you expand the Switch and delete the <otherwise> branch. You create the
condition in the <case> branch, and add and configure a Throw activity inside the <case>
branch.
10) In the CheckCCLimit.bpel Design window, expand the Switch_cclimit activity
and delete the <otherwise> branch. 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
11) To configure the <case> branch condition,
a Stu
ytitle
performd the following steps:
@
a) Double-click the <case> branch
z s
u thisection.
y z
e window, e set Name to check status and
b) In the Switch Case
a settings
u s
limit. hilp to
( s
u cens e
z z li
a ye
sh ilp

Oracle SOA Suite 11g: Build Composite Applications 345


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
c) In the Switch Case Expression create a conditional expression (by using the
Expression Builder) that compares the outputVariable status element to the case-
sensitive string literal 'VALID' and if the (order) amount in the inputVariable is
greater than the creditLimit element in the
Invoke_ccservice_CreditCardDBServiceSelect_OutputVariable.
Important Note: Ensure that you enclose the values comparing the amount and
creditLimit in the number() function to force the comparison to be based on the
numeric value, otherwise the XML expression is compared based on the string
values. 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 condition should resemble the following expression, showing where
sh the number() function is applied and that the literal value 'VALID' is required
to be in uppercase by highlighting them in bold and underline font:

bpws:getVariableData('outputVariable','reply','/ns3:CreditC
heckResponse/ns3:status') = 'VALID' and
number(bpws:getVariableData('inputVariable','request','/ns3
:CreditCheckRequest/ns3:amount')) >
number(bpws:getVariableData('Invoke_ccservice_CreditCardDBS
erviceSelect_OutputVariable','CreditcardsCollection','/ns4:
CreditcardsCollection/ns4:Creditcards/ns4:creditLimit'))
d) Save the changes to you BPEL process

Add and Configure a Throw Activity to Raise an Exception


Having detected the credit limit business fault, you throw a fault to terminate additional
processing in this BPEL process.
12) To create and configure a Throw activity inside the <case> branch of the
Switch_cclimit activity by performing the following steps:

Oracle SOA Suite 11g: Build Composite Applications 346


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
a) Drag a Throw activity from the Component Palette into the <case> branch.
b) Rename the Throw activity to Throw_validateccfault

b le
fer a
ans
n - t r
13) To configure the Throw_validateccfault activity, using the following image as a
guide:
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

To edit the settings double-click the Throw_validateccfault icon and use instructions
in the following table and associated screenshots:
Step Screen/Page Description Choices or Values
a. Throw > General tab To set the fault Namespace URI and Local
Part in the Faults QName section, click the
Browse Faults icon ( ).
b. Fault Chooser Expand the Project WSDL Files >
ValidateCreditCard.wsdl entry,
select validateCCfault and click OK.
c. Throw > General tab Observe that the Namespace URI and Local
Part fields are filled in by your selection.
Fault Variable: Click the Auto Create Fault

Oracle SOA Suite 11g: Build Composite Applications 347


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
Step Screen/Page Description Choices or Values
Variable icon.
d. Create Variable Name: creditFault
Accept default values for others fields.
Click OK.
a)

b le
fer a
an s
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 348


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
c)

b le
fer a
ans
n - t r
d)
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 a14) Save the changes to your BPEL process.
sh
Add a Main Process Catch Branch to Propagate the Exception
In this section you create a Catch branch for the validateCCfault in the main process
scope, and add an Assign activity to set a fault message that is sent to the invoker by
using the fault variable in a Reply activity.
Note: If you did not use a Reply activity with the fault information the invoker can still
see the business fault. However, it is received as if it is a system fault. By using the Catch
branch you are creating a robust error handling sequence.

Oracle SOA Suite 11g: Build Composite Applications 349


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
15) In the CheckCCLimit.bpel Design window, create a Catch branch on the main
scope by clicking the Add Catch Branch icon ( ) on the scope sidebar. Use the
following image as a guide:

b le
fer a
16) To configure the Catch branch to handle the validateCCfault, double-click the Catch
an s
branch icon use the following image as a guide to the settings:
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
If needed perform the following steps to create the Catch settings:

a) In the Catch window, in Faults QName, click the Browse Faults icon ( ).
b) In the Fault Chooser, expand the Project WSDL Files >
ValidateCreditCard.wsdl entry, select validateCCfault and click OK.

c) In the Catch window, for Fault Variable click the Browse Variables icon ( ).
d) In the Variable Chooser window, select creditFault and click OK.
e) In the Catch settings window, click OK.
17) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 350


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
18) In the CheckCCLimit.bpel Design window, expand the Catch and add the
following activities into the catch sequence:
Step Activity Type Activity Name Purpose
a. Assign Assign_ccerror Assigns an error message
about exceeding the credit
limit to the fault variable.
b. Reply Reply_ccerror Propagates the fault and fault
message in the fault variable to
the invoker.

Note: 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 351


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
19) To configure the Assign_ccerror activity, double-click the Assign_ccerror icon and
create a copy operation that stores the result of an expression, which concatenates the
text ' Error: order total exceeds the credit limit of ' with
the creditLimit element in the
Invoke_ccservice_CreditCardDBServiceSelect_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
a u s
( s hilpvalue
Note: The “From” e to resemble the following expression (noting the space
should
at thezend
z nsstring literal parameter in the concat function):
u of thecefirst
ye li
i l p a concat('Error: order total exceeds the credit limit of ',
sh bpws:getVariableData('Invoke_ccservice_CreditCardDBServiceSele
ct_OutputVariable','CreditcardsCollection',
'/ns4:CreditcardsCollection/ns4:Creditcards/ns4:creditLimit'))

Oracle SOA Suite 11g: Build Composite Applications 352


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
20) To configure the Reply_ccerror, double-click the Reply_ccerror icon and use the
following image as a guide to the settings:

b le
fer a
an s
n - t r
a no
) has ideฺ
ฺ c om t Gu
h o o e n
d
yaReplySactivity
tu settings, perform the following
@
Note: if you require help to create
zu thi
the
s
steps:
y e z e
p a u s
hilwindow,
a) In the Reply
( s e o Partner Link click the Browse Partner Links icon ( ).
tfor
u Partner
b) Inzthe
z c e ns Chooser window select checkcclimit_client and click OK.
Link
ye li
i l p a c) In the Reply window, for Variable click the Browser Variable icon ( ).
sh d) In the Variable Chooser window, select creditFault and click OK.

e) In the Reply window, in Fault QName, click the Browse Faults icon ( ).
f) In the Fault Chooser window, expand the Project WSDL Files >
ValidateCreditCard.wsdl entry, select validateCCfault and click OK.
g) In the Reply window, click OK.
21) Save the changes to your BPEL process and CreditCardValidation composite
application.

Deploy the Modified CreditCardValidation Composite Application


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

Oracle SOA Suite 11g: Build Composite Applications 353


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-3: Modify ApproveCCOrder BPEL to Handle Credit
Exceptions
In this practice, you modify the ApproveCCOrder to handle the exception that can be
returned when invoking the CreditCardValidation composite application as a service. If
you do not handle the exception the process ungracefully terminates when the exception
is detected. Handling the exception is done in the scope called Scope_validatecc, in
which the ValidateCCService (external reference for the CreditCardValidation composite
application) is invoked.

Note: Creating the Catch block and fault handling is similar to what you did in the
CheckCCLimit BPEL Process in Practice 10-2. In this case, you do not propagate the
exception because it is handled by storing the ‘rejected’ status in the outputVariable to
track the occurrence of an exception.
b le
To complete the task of handling the validateCCfault, perform the following steps:
fer a
an
1) In the JDeveloper Application Navigator, if needed expand the POProcessing project
s
n - t r
> SOA Content tree and double-click ApproveCCOrder.bpel to open it in the
BPEL Editor. a no
) h as eฺ
Create and Configure a Catch Block on Scope_validatecc
c o m Guid
h o oฺ entscope.
In this section create a Catch block on the Scope_validatecc
2) In the ApproveCCOrder.bpel y a window,
Design S t ud create a Catch branch on the
Scope_validatecc scope by z z u@ the
clicking t h is Catch Branch icon ( ) on the scope
Add
y
sidebar. Use the following
a e imagesase a guide:
i lp t o u
h
(s nse
z z u c e
y e l i
sh ilpa

Oracle SOA Suite 11g: Build Composite Applications 354


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-3: Modify ApproveCCOrder BPEL to Handle Credit
Exceptions (continued)
3) To configure the Catch branch to handle the validateCCfault, double-click the Catch
branch icon use the following image as a guide to the settings:

b le
fer a
ans
n - t r
a no
has ideฺ
If needed perform the following steps to create the Catch settings:

a) In the Catch window, in Faults QName, clickothe


)
mBrowse uFaults icon ( ).
ฺ c t G
oLinks >eValidateCCService
n
h o
b) In the Fault Chooser, expand the Partner d
a Stuentry, select validateCCfault > Imported
WSDL > ValidateCreditCard.wsdl
@ y and
u i s
click OK.
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

c) In the Catch window, for Fault Variable click the Auto-create Fault Variable icon
( ).

Oracle SOA Suite 11g: Build Composite Applications 355


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-3: Modify ApproveCCOrder BPEL to Handle Credit
Exceptions (continued)
d) In the Create Variable window, enter creditFault in Name accepting other
default values, and click OK.

e) In the Catch settings window, click OK. le


a b
4) In the ApproveCCOrder.bpel Design window, expand the Catch and add a
s fer
- t r an
single Assign activity into the Catch and rename it to Assign_rejected. Use the
following image as a guide:
no n
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 356


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-3: Modify ApproveCCOrder BPEL to Handle Credit
Exceptions (continued)
5) To configure the Assign_rejected activity, double-click the Assign_rejected activity
icon and create a copy operation that stores the literal string 'rejected' in the
order > status element of the process outputVariable. Use the following image as a
guide for creating the copy operation:

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
6) Save the changes toayour
z
e BPEL sprocess.
e
ilp e to u
( s h
Deploy the
z z c e ns
u POProcessing Composite Application
7) yDeploy li
e the modified POProcessing composite application, by right-clicking the
il p a POProcessing project name and selecting Deploy > POProcessing > to soaserver.
sh Overwrite the existing version and ensure deployment is successful.

Oracle SOA Suite 11g: Build Composite Applications 357


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions
In this practice, your tasks are to:
• Perform the following two tests of the CreditCardValidation composite
application.
o Test a valid card with an order amount less than the credit card limit
o Test a valid card with an order amount exceeding the credit limit.
• Perform the following two tests of the of the POProcesssing composite:
o Test an order with a valid card and order total less than the credit limit to
verify normal processing occurs.
o Test an order with a valid card and order total greater than the credit limit
to test if the exception is correctly handled.
To complete these tests perform the following steps:
b le
1) In the JDeveloper window, to help with selecting credit cards and amounts for the
fer a
tests display the credit card data by performing the following steps:
ans
n - t r
a) In the Application Navigator, select the files application, expand the files >
a no
Application Sources > sql folder, and double-click creditcard_query.sql.
s ฺ
haExecute
b) In the creditcard_query.sql window, click
o m ) the
u ideStatement icon
( ).
o o ฺc nt G
ah select
c) On the Select Connection dialog box,
y t u de“soademo (POApplication)”
the
connection, and click OK.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
d) Confirm your results in the Results tab with the following image:

Note: The tests will use the second credit card row, credit card number 1234-
1234-1234-1234 that has a credit limit of 20000.
e) Close the creditcard_query.sql window.
2) In a Web browser window, login to the Oracle Enterprise Manager page (URL
http://localhost:7001/em), as the user weblogic with password welcome1.

Oracle SOA Suite 11g: Build Composite Applications 358


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Test the CreditCardValidation Composite Application
3) On the Oracle Enterprise Manager SOA home page, expand the SOA folder in the
Farm navigator, and click the “CreditCardValidation [1.0]” link
4) On the “CreditCardValidation [1.0]” Test Web Service page, under the Request tab
Input Arguments section with Tree View mode selected, perform the following steps:
a) Enter 1234-1234-1234-1234 in the CCNumber field and 1000 in amount,
and click Test Web Service.

b le
fer a
ans
n - t r
a no
) has ideฺ
ฺ c om t Gu
b) On the Response tab, the reply status o
h o displays
value e n the value VALID. This is
expected. For example: 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
5) To perform the second test, click the Request tab, and perform the following steps:
a) The CCNumber field should already have the value 1234-1234-1234-1234
and the amount contains 1000. Replace the amount with 22000 (this is 2000
above the credit limit), and click Test Web Service.

Oracle SOA Suite 11g: Build Composite Applications 359


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
b) This time the Response page is not displayed. Instead the “Webservice invocation
failed” window is displayed. Click Close.

Note: The CreditCardValidation composite process validateCC operation is a


synchronous interaction. Therefore, Oracle Enterprise Manager displays a e
“Webservice invocation failed” window when a synchronous service is initiated a b l
s fer
from the Web based testing tool. To find out what the cause is it is easier to locate
t r an
the instance id in the Dashboard or Instances tab on the “CreditCardValidation
-
[1.0]” home page.
no n
6) On the “CreditCardValidation [1.0]” Test Web Service page,
a
sto return to the
h a ฺ
) >uHome
composite application home page click the SOA Composite
o m ide menu (at the top
of the page). For example:
o o ฺc nt G
y ah Stude
z z u@ this
a y e s e
u
( s hilp se to [1.0]” home page, under the Dashboard tab you can
7) On the “CreditCardValidation
click
z z
the nInstance ID column for the faulted instance.
ulink incthe
e
ye l i
il p a
sh

Note: The Instances ID for a synchronous process instances are not normally visible
in the Enterprise Manager Web page for production systems. However, since the
Audit Level has been set to the Development setting (instead of Production) the
faulted synchronous instance information is saved in the SOA Schema database
tables. Otherwise, you would have to consult the log files for errors.

Oracle SOA Suite 11g: Build Composite Applications 360


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
8) 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
h i lp
a) Why is the CheckCCLimit
t o BPEL Component not showing a Faulted value in the
(s nse
State column?
u
b)ez z i
How can lyouc etell that the validateCCfault business fault has been propagated
a y externally to the composite application?
i l p
sh

Oracle SOA Suite 11g: Build Composite Applications 361


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Q Answers for Step 8.
a. The CheckCCLimit BPEL Component State is Completed because it internally handled
the exception. However, it returns a fault message as its response, which is not
considered a fault for the BPEL process. The invoker of the BPEL process, in this case
the ValidateCreditCard Mediator component receives the fault.

You can verify this information by clicking the CheckCCLimit BPEL link:

b le
fer a
ans
n - t r
n o
In the “Instance of CheckCCLimit” Audit Trail page, scrolls a
down and locate the Throw
ha such
activity and observe that the fault is thrown and then )caught,
i d e ฺ the final Assign
that
m Gthe
and Reply activities are successfully executed toopropagate
c u fault message to the
invoker of the BPEL process: o o ฺ n t
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

Oracle SOA Suite 11g: Build Composite Applications 362


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Q Answers for Step 8.
b. To verify that the validateCCfault business fault has been propagated externally click the
Flow Trace link in the breadcrumbs (if needed) and click the ValidateCreditCard link to
display the Mediator component Audit Trail page.

b l e
fer a
ans
n - t r
On the “Instance of ValidateCreditCard” Audit Trail page, you can scroll to and locate
the error when the 2-way operation “validateCC” is displayed. After the error is detected
a no
the Mediator performs a transformation of the fault message data received from the
has ideฺ
BPEL process and it performs a step showing “Rethrowing fault” after which the fully
)
fault has been propagated externally. ฺ c om t Gu
qualified QName for the validateCCFault is shown. This action is the indicated that the

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: Now that you have tested the basic functionality for the CreditCardValidation
composite application changes, you can proceed to perform similar tests in the context of
the POProcessing composite application.

If you have time, perform a final test case to test the credit card number (4321-4321-
4321-4321) that has an INVALID status, and verify that the INVALID status is
returned to the caller without performing a credit limit check for INVALID cards.

Oracle SOA Suite 11g: Build Composite Applications 363


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Test the POProcessing Composite Application
9) On the Oracle Enterprise Manager SOA home page, expand the SOA folder in the
Farm navigator, and click the “POProcessing [1.0]” link.
10) To perform a test with a valid credit card and an order total within the credit limit, on
the “POProcessing [1.0]” Test Web Service page, under the Request tab Input
Arguments section, perform the following steps:
a) Replace the XML data with the contents of the file
D:\labs\files\xml_in\po-small-ipod.xml.
b) Replace the quantity with a value of 1 (one), and then click Test Web Service.
c) On the Response tab, click the Launch Message Flow Trace link.
b le
d) On the Flow Trace page, examine the Trace tree verify that the processing
fer a
ans
completed successfully and that the product has been fulfilled by the InternalStore
and shipped. Use the following Flow Trace 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: If you desire confirm that the response from the ValidationCCService is the
status of VALID.
e) Close the Flow Trace Web browser window.

Oracle SOA Suite 11g: Build Composite Applications 364


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
11) To perform a test with a valid credit card and an order total that exceeds the credit
limit, on the “POProcessing [1.0]” Test Web Service page, click the Request tab and
perform the following steps:
a) In the Input Arguments section with the XML View selected, replace the XML
data with the contents of the file D:\labs\files\xml_in\po-large-
guitar.xml.
b) Replace the quantity for both products to a value of 5 (five). This causes the order
total to be 20500, which is 500 more than the credit limit of 20000 for this
credit card. 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
z z u cen
ye li
i l p a c) On the Response tab, click the Launch Message Flow Trace link.
sh 12) On the Flow Trace page, confirm that the validateCCfault is thrown for the credit
limit being exceeded for this order.

Oracle SOA Suite 11g: Build Composite Applications 365


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (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 ethe Trace tree and answer the following questions:
a u s
13) On the Flow Trace
s h ilp e to
page, examine
a) What (
u is inthethe nsorder status in outputVariable
final supplied to the callbackClient
e z z
activity li c e ApproveCCOrder BPEL process? Explain your answer.
y
sh ilpa b) Was the order processed by the Fulfillment service? Explain your answer.
c) Did the fault message get received by the ApproveCCOrder BPEL process?

Oracle SOA Suite 11g: Build Composite Applications 366


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Step Answers for Step 13.
a. The final order status element contains the string value rejected. To view the result,
click the ApproveCCOrder link in the Trace tree.
On the “Instance of ApproveCCOrder” page, scroll down to the end of the Audit Trail
and expand the callbackClient to view 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
Note: The reason why theustatus
z @ s set to rejected is because the
has ibeen
h
ApproveCCOrder y BPELz
e process t
e caught the fault condition. In the catch block the
a u s
Assign_rejected
h i lp activity
t osets the status.
u (s nse
b.
eThe
z z Fulfillment
l i c e BPEL process was not invoked by the ApproveCCOrder BPEL Process,
y because it does not appear in the Trace tree due to the Invoke_validatecc activity
sh ilpa receiving the validateCCfault. This caused the Catch block to execute and end the process
with the callbackClient activity. Therefore, the Fulfillment BPEL process was not
invoked because its activity sequence could not be executed due to the fault handling
implementation.

Oracle SOA Suite 11g: Build Composite Applications 367


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ
Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Step Answers for Step 13.
c. Yes, the fault message text is received by the Invoke_validatecc activity, which saves the
fault in creditFault variable.

b le
fer a
ans
n - t r
a no
h a s ฺ and can be viewed in
Note: However, that the fault message text is not saved anywhere,
) uide
the Audit Trail pages for the relevant component instances.
m
o
ฺc nt G
o o
h tude
y
14) Close the Flow Trace and any Activity
a Swindow you have opened.
z u@ hDetaili 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

Oracle SOA Suite 11g: Build Composite Applications 368


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

You might also like