Sie sind auf Seite 1von 372

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

s a
) h a
o m
c ideฺ
i l ฺ
Oracle SOA g ma 11g:
Suite t G u
Build
o @ e n
Composite
r c S tud
ad Applications
ฺ m e this
m in usIe• Activity Guide
Volume

ฺ j a z to
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

D53946GC20
Edition 2.0
September 2010
D65409
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,
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Tom Hardy If this documentation is delivered to the United States Government or
Clemens Utschig anyone using the documentation on behalf of the United States
Valli Pataballa
s
Government, the following notice is applicable: a
David McCann
David Shaffer
Vasiliy Strelnikov U.S. GOVERNMENT RIGHTS ) h a
Vikas Anand
c o m ฺ
The U.S. Government’s rights to use, modify, reproduce, release,
David Twelves
i l ฺ i d e
perform, display, or disclose these training materials are restricted by
Deirdre Matishak Vikas Jain
ma t Gu
the terms of the applicable Oracle license agreement and/or the
g
Demed L’Her Viktor Tchemodanov
d o @ den
applicable U.S. Government contract.

Dhiraj Thakkar William Prewitt


ca s Stu
Trademark Notice
e r
Gangadhar Konduri
Yan Jing
Yi Lu i ฺ m e thi
Oracle and Java are registered trademarks of Oracle and/or its
n
affiliates. Other names may be trademarks of their respective owners.
Heidi Buelow
Yogesh Kumar jaz
m o us
Holger Dindler Rasmussen
a ฺ e t
i k s
(er licen
James Mills Yosuke Katsuki

Jay Kasi o
ad Editors le
Joe Greenwald r c
e feArijit a b
r Ghosh
John Cobb a M s
KalpakE rik n-tran Nita Pavitran
Kothari
Ken Cooper no
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
Contents
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s
Practice 3-1: Create the POProcessing Composite ....................................................... 21
a
) h a
Practice 3-2: Add a Transformation to the Mediator Component ................................ 38
o m
c ideฺ
Practice 3-3: Deploy and Test the POProcessing Composite Application ................... 43
i l ฺ
g ma t Gu
Practices for Lesson 4 ....................................................................................................... 51
Practice 4-1: Modify the POProcessing File Adapter to use a Logical Name.............. 52
d o @ den
Practice 4-2: Generate and Validate a Configuration Plan ........................................... 59
rca is Stu
Practice 4-3: Test a Composite Deployed with a Configuration Plan .......................... 62
e
i n ฺm e th
Practices for Lesson 5 ....................................................................................................... 68

ฺ j a zm to us
Practice 5-1: Create the CreditCardValidation SOA Project........................................ 69

e r ika ense
Practice 5-2: Create a Database Adapter to Query Credit Cards .................................. 78
Practice 5-3: Deploy and Test the CreditCardValidation Composite........................... 91
o ( lic
Practices for Lesson 6 ....................................................................................................... 93
d l e
rca erab
Practice 6-1: Restructure the POProcessing Assembly Model ..................................... 94
e
M nsf
Practice 6-2: Calculate Order Totals with XSL Transformations................................. 99
a
k
Eri on-tra
Practice 6-3: Test the Modified POProcessing Application ....................................... 107
Practices for Lesson 7 ..................................................................................................... 111
nPractice 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
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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

In the sample image observe that each XML element (the tree nodes below the
<sources> root) has an XML namespace prefix, such as “imp1:” in the image
s a
h a
example. The XML namespace prefix, which maps to an XML Namespace string, is:
)
• Used to uniquely identify (qualify) each XML element o m
c ideฺ
i l ฺ
• Generated dynamically by the JDeveloper tool that creates the XML structure.
g ma t Gu
When you carry out the practice instructions in this document, dynamically generated
o @ den
XML namespace prefixes for your XML elements may differ from those shown in the
d
screenshots of this document.
e rca is Stu
i n ฺm e th
Note: Therefore, the practice instructions do not specify the XML namespace prefixes for

j zm to us
XML elements that you work with, even though the screenshots related to those
a
instructions contain XML namespace prefix values. The screenshots are provided as

e r ika ense
sample and guide. Your job is to ensure that the XML element names and structures
( lic
created, mapped, or referenced are correct as documented, and not to be concerned about
o
d l e
rca erab
different XML namespace values.
e
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 1


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
before creating the WSIL connection.
s a
• Setting JDeveloper preferences, such as disabling the HTTP Proxy setting in the
) h a
o m
Web Brower and Proxy JDeveloper preferences. This is done to avoid network
c ideฺ
i l ฺ
access problems as a result of network proxy configuration for Oracle University
classroom environments. g ma t Gu
d o @ den
The following image depicts the connections created
e Stu
rcain thisispractice:
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 2


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
4) In the Database Connection dialog box, enter the a
rcfollowing
S tu
details:
e
m e this
a) Use the IDE Connections option. inฺ
j a zm to us
b) Enter the following fieldฺvalues:
Connection Name: e r ikasoademo
e n se
Username:do
( lic
soademo
l e
rca erab soademo
Password:
e
a M
Hostname:
n s f localhost
r i k -t r
Port: a 1521
E onSID: XE
n
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


Practice 1-1: Start JDeveloper and Create a Database
Connection (continued)
Note: Use the following image as a guide:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 4


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
text similar to the following display in the terminal window: s a
) h a
INFO: FabricProviderServlet.stateChanged SOA Platform o m
is
c ideฺ
running and accepting requests i l ฺ
g ma t Gu
o @ SOA
Note: You can ignore the warnings displayed in the command
d e nServer command
d
window.
e rca is Stu
i n
3) In the JDeveloper Resource Palette, clickฺm
New icon
e t(h ) > New Connection >
Application Server.
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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)
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nb)

Oracle SOA Suite 11g: Build Composite Applications 6


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d)
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 7


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 8


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
j a zm us
displays taoline number for each line of source code.
Note: Show Line Numbers ฺ
r ika etonlocate
This is a useful preference
e se specific lines of code reported for compiler
o
errors and when ( variouslidesign-time
c tools detect errors in your application code
a d l e
M erc ferab
or structures.

r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 10


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
Note: If you o (
are working licwith these practices in a non-Oracle University
d l e
rca ethen
environment
e r abit is likely that you do not have to change this preference. It
M f
s whether your corporate network proxy allows or denies access to
r i ka depends
r a
various
n on
external URLs in HTTP requests that are used by JDeveloper.
E on-t
3) nIn the Preferences window, click OK to apply the selected preference changes. Close
the Preferences window.

Oracle SOA Suite 11g: Build Composite Applications 11


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
2) On theeWSILrca Connection
e r ab wizard pages, enter the information specified in the
M s f
r i kafollowing
-t r a
table:
n
E SteponScreen/Page Choices or Values
n 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


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

s a
) h a
b) m
l ฺ o
c ideฺ
i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nc)

Oracle SOA Suite 11g: Build Composite Applications 13


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

s a
h a
)expand
3) To confirm that the WSIL connection is operational, on the Resource Palette o m
csee twoideฺ
the WSIL node and expand the WSILConnection1 entry. You should i l ฺ
subfolders called: soa-infra and usermessagingserver, as shown
g minathe tfollowing
G u
image:
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 14


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
In addition, you examine the CREDITCARDS
j a zm totableusdata in the soademo database
schema used by the purchase order
k ฺ
a processing
e application.
r i n s
The following image o (e lithe c e
c d ble JDeveloper Database Navigator window, from which
represents
amodify,
e r
you can browse,
e r a and create database structures, as well as query and modify the
M f
r i k -trans
dataathey contain:
E on
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
b) Double-click the po.xsd file to open the file in the XSD Editor. s a
h a
) data
c) Expand the OrderItemType and answer the following question: What is mthe
type for the price element? l ฺ o
c ideฺ
i
a Gu
d) Expand the PurchaseOrderType complex type and answer g m t
the following
questions: o @ e n
r c ad Stud
i) What are the type and values for the payOption
ฺ m e thiselement?
ii) What are the name and type m ofin se element?
the repeating
z u
jathe internalorder.xsd,
to
3) To compare the po.xsd with
k a ฺ e open both files and
r i n s
answer the following
o (eXML
questions:e
ic files at the same time, JDeveloper allows you to
lschema
Hints: To view d both l e
rearrange
e rcthea XSD e r b side-by-side (horizontally) or one above the other
awindows
M f
sneeded ask your instructor to demonstrate this capability.
r i ka(vertically).
-t r a n If
E a)onAssociate the first-level child elements of the PurchaseOrder element in the
n 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


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

b) In the Confirm Close Application dialog box, accept the default “Close
application and remove it from IDE” option and click OK.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
5) In JDeveloper, close the
r a and
ikpo.xsd seinternalorder.xsd windows.
( e e n
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 17


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
ID orderId s a
payOption, type:payOptionType ) h a
payMethod, type:payMethodType
shipChoice, type:shipOptionType o m
c ideฺ
shipMethod, type: shipMethodtype
i l ฺ
ccType and ccNumber, both string
types g ma t Gu
creditCard, type:ccInfoType

d o @ den
orderTotal
rca is Stu
Note: The payOptionType values are the same as the payMethodType values
e
i n ฺm e th
(as observed by the enumerated values in each schema). The same applies to

ฺ j a zm to us
the shipChoiceType and the shipMethodType definitions. If a single

e r ika ense
company is sharing these XSD definitions one could rearrange XML
elements definitions to share a consistent type definitions.
o ( lic
3b) d
The “items” element in the internalorder.xsd contains the additional
l e
e rca erab
child called inStock.
a M nsf
Note: The inStock element is used to track if all items for a given order are in
k
Eri on-trastock (value = true) so that an order can be fulfilled. If any item in the order
is not in stock (value = false) then the whole order is place in a “waiting”
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 a
b) Double-click the CREDITCARDS table. This expands the CREDITCARDS table h a s
entry and opens a tab page with a description of the columns. m )
l ฺ o
c ideฺ
c) On the CREDITCARDS page, click the Data subtab at the m i
a of G
bottom theuwindow
to view the data in the table. g
@ den t
d o
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k -trathe CREDITCARDS page, and soademo page.
Eri d)onClose
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 20


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Create an Empty Composite Application a


2) To create the application workspace with an SOA Project containing an empty ha
s
m
composite application, use instructions in the following table and acceptodefault
)
values for all fields that are not specified in the “Choices or Values”i l ฺ c ideฺ
column:
m a Gu
Step Screen/Page Choices or Values @ g n t
Description d o ud e
a. Create SOA Application Application r c a S t
ฺ m e Name:t h s
iPOApplication
- Step 1 of 3 i n
Application Template: SOA Application
m u s e
ฺ j a z ClicktNext.
o
b.
ika enProject
Create SOA Application
- Step 2 of 3(er
se Next.
Click
Name: POProcessing

c. Create d o
SOA e lic Composite Template: Empty Composite
Application
l
e ca3 of r3ab
- rStep Click Finish.
M s f e
r i kaNote:-tUse
r anthe following screenshots as a guide for the corresponding steps in the
E table
non above.

Oracle SOA Suite 11g: Build Composite Applications 21


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 22


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
c) o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
icons. a
c. Type Chooser
Click the Import Schema ( ) icon. ) h
as
d. Import Schema File Click the Browse Resources icon.
l ฺ c om eฺ
e. SOA Resource Browser ai Gufolder
Locate the D:\labs\files\xsd
m id and
g OK.nt
select po.xsd, and click
@
f. Import Schema File With the po.xsd
a o u de click OK.
d filetselected,
g. Localize Files Copy e c
r Deselect
Options: s S the “Maintain original
ฺ m h i
t for imported files” option,
m indirectory
s e
u OK.
structure

h. Type Chooser kaฺ


jaz eand toclick
Expand the Project Schema Files > po.xsd
r i n s
o (e lice entry (if needed), select the PurchaseOrder
c a d ble entry, and click OK.
i. r
eCreate WSDL
e ra Click OK.
M s f
r i kaj. -tCreate
r a n Web Services Click OK.
E Optionally,
na)on
use the following screenshots as a guide for the steps in the above table:

Oracle SOA Suite 11g: Build Composite Applications 24


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

c)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
d) e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 25


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
f) e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
ng)

Oracle SOA Suite 11g: Build Composite Applications 26


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

i)
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
j)

Oracle SOA Suite 11g: Build Composite Applications 27


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

7) Select File > Save all to save the changes to the project. a
h a s
Create and Wire the Service Mediator Component m )
l ฺ o
c to the e ฺ
i
8) Create a Mediator component and wire the ReceivePO service entry
a Gu point i d
Mediator component, by performing the following steps: gm t
o @ e n
a) In the Composite Editor (composite.xml),adrag
r c S t ud component into
d a Mediator
the Components column.
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 28


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Note: The Mediator interface is defined by wiring the SOAP service to the
s a
Mediator component. The interfaces are implicit.
) h a
c) Create a wire from the ReceivePO exposed service icon to the RoutePO o m ฺ
Mediator
c iservice
icon, by dragging the right-edge arrow icon from the ReceivePO i
a Gul ฺ
exposed d e
to the left-edge arrow on the Mediator component. Use the g mfollowing t image as a
o @ e n
guide:
r c ad Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
9)ka
M f
Select Filen>sSave, or click the Save All icon to save the changes to your application.
Eri on-tra
Create
n 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


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
a zm o us
11) In the composite.xml a ฺ j
window, drage ta File Adapter component from the
i k s
erto thelicExternal
Component Palette(on
o en References column.
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
b) e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 31


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d)
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 32


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

s a
)h a
m
co ideฺ
i l ฺ
g ma t Gu
13) On the Adapter Configuration Wizard page, continue d o @ dethen File Adapter
to configure
WSDL interface by importing the internalorder.xsdrca is SXML tu schema and
selecting its “order” element, by performing
e
ฺm the efollowing
th steps:
i n
Step Screen/Page Descriptionj a zm Choices
t o us or Values
Messages rika

a.
e e n se Click Browse for schema file icon.
b. Typeo (
Chooser lic Click the Import Schema ( ) icon.
d
a ab File l e
c.ercImport rSchema Click the Browse Resources icon.
a Md. nSOA s feResource Browser In the D:\labs\files\xsd folder select
k
Eri on-tra internalorder.xsd, and click OK.
n e. Import Schema File 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


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

s a
) h a
o m
c ideฺ
i l ฺ
b)
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
c)

Oracle SOA Suite 11g: Build Composite Applications 34


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
e)
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
f) M
a n s f
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 35


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

s a
h)
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

16) Select File > Save All to save the changes to your project, and verify that your
composite application matches the following diagram:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 37


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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” ( )
s
icon, next to the Transform Using “body: <<Transformation Map>>” field. a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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. Auto Map Preferences Click Show Dictionaries.
s a
c. Auto Map Preferences h a
Under Dictionaries field, Click Add.
)
d. Open Navigate to folder o m
c ideฺ
i l ฺ
D:\labs\files\xml, and select
g ma t Gu
the file Order-Dictionary.xml
Click Open.
d o @ den
e. Auto Map Preferences rca is Stu
Click OK to perform the automatic
e
i n ฺm e th
mapping operation with the

ฺ j a zm to us
dictionary applied.
a)
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 39


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
c)
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 40


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
e)
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 41


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
Note: At this time, there areฺnoj a zm elements
source t o us that directly map to the orderPrice,
a > itemTotals
items > inStock, itemsr>ikitem se elements in the “XSLT File:
( e e n
WritePOFileService.wsdl”
d o e ic Mappings for these elements are done in a
lcolumn.
subsequentcapractice.
rbecause a l
The
b “for-each” construct is automatically inserted for the “item”
e
element r
M nsfe a repeating element.
it is
a
k -the
Er6)i Click
n traRoutePO.mplan window, and confirm that the Transform Using field
o the new mapping file. Use the following screenshot as a guide:
nshows

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Deploy the POProcessing Composite Application


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 43


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
3) Since this is the o ( licare deploying an application in your JDeveloper
first time you
d l
caAuthorization e
session, rthe
e f e r ab Request window is displayed. Enter weblogic
M
in the Username field, welcome1 in the Password field, and click OK.
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 44


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
Test POProcessing using Enterprise Manager d o @ en
WebuInterface
d
In this section you use a Web browser to access e therc
a Enterprise
Oracleis St Manager 11g
Fusion Middleware Control and initiate ain ฺmof theedeployed
test th POProcessing application.
5) Log in to Oracle Enterprise Managerj a us Middleware Control application and
zm 11gtoFusion
a ฺ e following steps:
open a Web browser by
e r ikperforming
e n sthe
a) In the Web o ( window,
browser lic enter the URL http://localhost:7001/em.
d
a ab l e
rcOracle
b) Onethe erEnterprise Manager 11g Fusion Middleware Control login page,
a M s f
r i k -tran
enter the User Name weblogic, and Password welcome1, and click Login.
E on
n

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

Oracle SOA Suite 11g: Build Composite Applications 45


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
7) On the Test Web Service page, scroll down to the Input o @Arguments
d e n to the
section
d
ca XML
Request tab, select XML View and replace therinitial tu with the XML
contents
e S
i n ฺ m e this
data in the file D:\labs\files\xml_in\po-medium-ipod.xml. If you
require help to replace the initial XML
m text, use
s the following steps (or similar):
a z
j > Open o u
tand browse to the
a) With JDeveloper, select
k a ฺFile e
i s
er licenfolder, select po-medium-ipod.xml and select
D:\labs\files\xml_in
Open. o (
r c ad able
b) M
a
In e er po-medium-ipod.xml window, press Ctrl +A to select all
the JDeveloper
s f
k the text,nand press Ctrl + C to copy the selection to the clipboard.
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 46


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
rcapage,
d) On the “POProcessing [1.0]” Test Web Service S tuTest Web Service.
Click
e
ฺm e this
i n
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

If you see the above error dialog box, then perform the following steps to correct and
s a
resubmit the data:
) h a
i) On the “Input arguments validation failed” dialog box, click OK. o m
c ideฺ
i l ฺ
ii) On the Request tab, in Input Arguments section modify g mthea contents
t G uof XML
View field based on the following options: o@
d e n
d
caend sof all u XML data, delete
tthe
(1) If there is extra space or lines atrthe
e S
those spaces and lines ensuring
i n ฺm thee XMLthi data is unaffected, and click
Test Web Service, or
ฺ j a zm to us
aextra space
(2) If there isikno
r e or lines at the end of all the XML data, put
spointer
( e
the cursor or e
mouse
c n after the last character on the last line of
o l i
r c ad able
the XML data, press Enter, and click Test Web Service

a M s f er the rest of the course you may have to repeat this process as
e Throughout
Note:
k required nwhen submitting XML data to initiate tests for each composite
-tra
Eri onapplication.
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den folder and
10) In a Windows Explorer window, navigate to the D:\labs\podata
examine the XML file created for the order. erc
a S tu
i n ฺ m e this
a) Ensure that the order_1.xml mfile has been
s created in the podata subfolder, as
a z o u
k a ฺj
shown in the following image:
e t
i s
o (er licen
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 49


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
In e
c) M
rca erabwindow, close the order_1.xml and the po-medium-
the JDeveloper
a n s f
k windows.
Eri on-tra
ipod.xml

Oracle SOA Suite 11g: Build Composite Applications 50


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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
by using Enterprise Manager. s a
The above tasks are represented in the following image: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 a
instructions as a guide:
h a s
Step Screen/Page Description Choices or Values m )
l ฺ o
c ideฺ
a. composite.xml i
Double-click the WritePOFileService
a Gu
g micon.
external reference t
o @ e n
r c ad Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
rca eConfiguration
b. eAdapter rab Wizard Click Next.
a M s f
k an Configuration Wizard
Step 1
Eri oc. n-trAdapter
of 7 – Welcome
Click Next.
n 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


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
g. Adapter Configuration Wizard e rcaNext.is Stu
Click
Step 6 of 7 – Messages i n ฺm e th
h. Adapter Configurationja zm to uClick
Wizard
s Finish.

e r ika ense
Step 7 of 7 – Finish
o
3) To set the path value ( for theliorderfiles
c logical name perform the following steps:
a d l e
M therc
a) In e rab
composite.xml
f e window, click the WritePOFileService external
i ka reference
a s
n icon ensure that the File Adapter reference is selected.
r t r
E b)onIn- the Property Inspector for the Reference – WritePOFileService (in the lower
n 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

the property.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e r ca s Stu
4) Select File > Save All to save the changes
i n thi
ฺmto theeapplication.
Deploy the Modified POProcessing j a us
zm toComposite Application
a ฺ e
5) In the JDeveloper window,
( e rik deploy
e nsthe modified POProcessing project by performing
the following d o le li
steps: c
a
c rabNavigator, right-click POProcessing project name, and select
a) In ether Application
a M fe
Deployn>sPOProcessing > to > soaserver
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 54


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
c) In the Log window, observe
a thesloge messages to ensure that deployment is
successful. r i k n
o (e lice
r c
Test the Modifiedad aPOProcessing
b le Composite Application
M e fer
6)ka
i a n s window, enter the Enterprise Manager URL
In a Web browser
r -t r
E http://localhost:7001/em,
n and login as weblogic with password
o
nwelcome1.
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


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

s a
) h a
o m
c ideฺ
i l ฺ
andain the item
b) While still in the Tree View mode, expand the items field,m u field (as
shown above) enter the value 1 in the OrderItemTypeArrayg t G
nand click the
d o @ dSize, e
rca is Stu
document icon.
e
ฺm e th
i n
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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

10) On the “POProcessing [1.0]” Response tab page, click the Launch Message Flow
Trace link.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
11) On the Flow Trace page, verify that the
i n ฺm e th composite application instance
POProcessing

ฺ j a zm to us
completed all processing successfully.

e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 57


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 58


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
2) In the e rca erConfiguration
Composite ab Plan Generator dialog box, accept the default plan
a M s f
kfile name, nand click OK.
Eri on-tra
n

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


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

s a
) h a
o m
c ideฺ
i l ฺ
4) Select File > Save All to save the changes to the project files. ma G u
@ deng t
Validate the Configuration Plan d o
e r ca s Stu
5) On the Application Navigator, right-click
i n ฺ m e t hi
the composite.xml file and select
Validate Config Plan.
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 60


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
7) In the POProcessing_cfgplan_report.log window, verify that the) h a
orderfiles Reference Property is replaced with the new value of ฺco
m ฺ
D:\labs\podata specified in the configuration plan beingm
l de
ai GUseuithe
validated.
following image as a guide: @ g nt
a d o t u de
e r c s S
m h i
m inฺ use t
ฺ j a z to
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 61


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
soa-infra Farm tree s a
h a
b. “POProcessing In the Archive or Exploded Directory section, select)
[1.0]” Redeploy c
“Archive is on the machine where this Weblฺbrowserom is eฺ
SOA Composite running” option, and click Browse. ma
i u id
c. File Upload g nt
Navigate to the D:\labs\mywork\POApplication
G
@
d foldertuanddeselect the
o
\POProcessing\deploy
r c a S file, and click Open.
e
sca_POProcessing_rev1.0.jar
m h i s
d. “POProcessing inฺ usePlan
Under the Configuration
m
t section, select the
[1.0]” Redeploy
ฺ j a z tplan
“Configuration o is on the machine where this Web
SOA Composite ik
r a issrunning”
browser e option, and click Browse.
e. File Upload ( e Navigatee n
d o l e lic to the
rca erab folder and select the POProcessing_cfgplan.xml file,
D:\labs\mywork\POApplication\POProcessing
e
M nsf
r i k a r a and click Open.
- t
E f. on“POProcessing Scroll back to the top (if needed) and click Next.
n [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


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

s a
b) ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri c)on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 63


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

e)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

f)

Oracle SOA Suite 11g: Build Composite Applications 64


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

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.
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
3) In the Definition window, locate the XML
i n ฺm<property>
e th element with the
name="orderfiles" attribute,
j a o usthat the value is D:\labs\podata,
zmand tverify
k ฺ
as expected due to redeployment
a with ethe configuration plan. Then click OK to close
the window. r i n s
o (e lice
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 65


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
D:\labs\files\xml_in\po-small- a
a s
ipod.xml file (using copy and paste
h
techniques). m )
ฺ o
c ideฺ
Click Test Web Service
l
i
ma t Gu
Note: If you require help to perform this task, use these screenshots as a guide for
g
instructions in the preceding table:
d o @ den
a)
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 66


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
j a us
zm to composite
5) After verifying that the new POProcessing application instance completed
successfully in the Flowik ฺ
a page,seuse Windows Explorer to verify that the
Trace
order_1.xml file ( e r
has been en with supplied data in the D:\labs\podata
created
o l i c
folder.
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s
The following image represents the composite application design for your
a
CreditCardValidation project: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 68


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

the Application menu, click the Application Menu icon and select New Project.

2) In the New Gallery window, select the SOA Project in the Items list of the Project a
category, and click OK. h a s
3) In the “Create SOA Project – Step 1 of 2” Project Name window, enter o them
)
Projectฺ
Name: CreditCardValidation, and click Next. a ilฺc uide
4) In the “Create SOA Project – Step 2 of 2” Configure SOA @ gm window,
Settings n t G select the
Composite With Mediator for the Composite Template
a declick Finish.
dooption,tuand
e r c s S
m h i
m inฺ use t
ฺ j a z to
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 69


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

click the “Generate WSDL from Schema(s).” icon (next to the WSDL URL field).
For example:

Use the following image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nNote: 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Port Type Name: validateCC_ptt a
Click the Reply tab. h a s
Note: Do not click OK. m )
l ฺ o
c ideฺ
a) i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 71


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

c)
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
d) i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 72


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

f)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
g) e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 73


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
o@ message d e n
7) On the Create WSDL > Reply tab page, to define a
c d
the Reply
tufollowing structure for the
e r
Mediator component WSDL interface, use instructions
i in
s S
the table as a
guide: m
inฺ use t h
a m
z Choices
Step Screen/Page Description
a ฺ j e totheorBrowse
Values
a.
e k
Create WSDL >riReply
n sClick icon next to the URL field.
b. (
Type Chooser
o e
lic Expand the Project Schema Files >
d l e
e rca erab creditcheck.xsd nodes (if needed) and
select the CreditCheckResponse element, and
a M nsf
k ra WSDL click OK.
Eri oc. n-tCreate Click the Fault tab.
na)

Oracle SOA Suite 11g: Build Composite Applications 74


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

s a
) h a
o m
c ideฺ
i l ฺ
c)
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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

s a
) h a
b) o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
c)

Oracle SOA Suite 11g: Build Composite Applications 76


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca istab.
10) In the JDeveloper window, click the composite.xml Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a n s f
M composite.xml
11) In the window, verify you initial composite assembly model
k trathe following image:
Eri resembles
n -
no

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

Oracle SOA Suite 11g: Build Composite Applications 77


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

1) In the CreditCardValidation composite.xml window, drag a Database Adapter on


the External References column.

s a
) h a
2) To configure the Database Adapter with the Adapter Configuration Wizard the
following instructions: o m
c ideฺ
i
a Gul ฺ
a) Adapter Configuration Wizard – Welcome, click Next. gm t
Step Screen/Page Description o @
Choices ordValues ud e n
b. Adapter Configuration Wizard Service
a CreditCardDBService
rcName: S t
– Service Name
e
m Next.
ฺClick this
i n e
c. Adapter Configuration Wizard
j a zm toClick usthe Browse (flashlight) icon next to
– Service Connection
k a ฺ e the connection field.
d. r i
e lice
Select IDE Database n s Select the soademo entry, and click Copy
Connectiono ( Connection.
d ble
e. e rca eConfiguration
Adapter r a Wizard Observe the JNDI Name has the value
M f
ns Configuration
r i kaf. -t–Adapter
r
Service
a
Connection eis/DB/soademo, and click Next.
E on – Operation Type Wizard Select option,
the “Perform an operation on a Table”
and ensure the Select check box is
n 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


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

c)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nd)

Oracle SOA Suite 11g: Build Composite Applications 79


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
f) d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 80


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

s a
) h a
h)
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 81


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
j)
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 82


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

s a
) h a
l) m
l ฺ o
c ideฺ
i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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)
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nb)

Oracle SOA Suite 11g: Build Composite Applications 84


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

s a
) h a
o m
c ideฺ
d) i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 85


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
f) e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 86


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

s a
) h a
o m
c ideฺ
i l ฺ
h) g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
Wire
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
a) In the Request Transformation Map window, click the Create New Mapper ) h a
File
option, accept the default file name supplied, and click OK. o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic map the CCNumber element in the Source column
b) In thec d
a ab
XSLT Mapper l ewindow,
r ccNum
a M nsferelement in the target column, as shown in the following image:
to e
the
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 88


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
cMapperidFileeฺ
a) In the Reply Transformation Map window, select the Create Newi l ฺ
g ma t Gu
option, accept the default file name supplied, and click OK.
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k raXSLT Mapper window, expand the source tree and map the status element
Eri b)onIn-tthe
n 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


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

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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 90


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
test, login to the Enterprise Manager application (if required) as weblogic with s a
password welcome1. ) h a
o m
c the ฺ
a) On the Farm navigator pane, expand SOA > soa-infra (in needed i l ฺ
refresh
a theGu i d e
page)
so that you can see the “CreditCardValidation [1.0]” entry.
g mClick t
“CreditCardValidation [1.0]” link. o @ e n
b) On the “CreditCardValidation [1.0]” home r c
page,
tud
adclickSTest
ฺ m e this
m in down
c) On the Test Web Service page, scroll
u e page to the Input Arguments
the
svalues:
section Request tab and enter
ฺ zthe
ja e tofollowing
a
rik ens
CCNumber: 1234-1234-1234-1234
amount: 1000 (e
d o l e lic
e r a erab
Click c
Test Web Service.

a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 91


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

3) To perform a second test, to enter another request click the Request tab.
a) On the Request tab page, modify the CCNumber value to be 4321-4321-
s a
4321-4321, leave the amount at 1000, and click Test Web Service.
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e r a asershown
b) On thecResponse
INVALID,
a btab page, verify that the status string value returned is
in the following image:
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 92


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
As a result you learn how to: g ma t Gu
• Manage service virtualization and how to restructure o @ e
a composite
d nassembly model
with a new Mediator component and makerchanges
d
ca sto S thetu
component wires
without affecting the exposed serviceฺm e i
(external tclient
h interface)
• Modify the XSL transformation, i n
between e
m o us and second Mediator
the first
components, to calculateฺthe a z
j itemetotals.
t In this case, you reuse and modify the
i k a
existing XSL Transformation. s
• Create a newoXSL (erTransformation,
l i c en in the routing rule between the second
c
Mediator
d the bWritePOFileService,
aand le to calculate the order total using the item
e r r a
a M n s fecalculated by the XSL transformation between the Mediator
totals already
i k traare multiple solutions for calculating the item and order totals. One solution
components.
ErNote: n -
There
nothat uses a single XSL file without the need for an additional Mediator component.
exists
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

Delete the RoutePO Mediator Component Routing Rule s a


2) To remove the wire between the RoutePO Mediator component and the ) h a
WritePOFileService external reference, edit the RoutePO Mediator component o m
c idand ฺ
i l ฺ e
delete the existing Routing Rule.
g ma t Gu
Note: If you require help to perform this task, you can d o @ den steps:
use theufollowing
r c a S t
a) Double-click the RoutePO Mediator component e
ฺm e thicon is to edit the component.
i n s execute operation select the existing
b) In the RoutePO.mplan window,
ฺ j
static routing rule by clickinga zinmtheunder
t o
grey
uthe
section just below the “<<Filter
i k a s e
(er licen
Expression>>” field.
o
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 94


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 ( ).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Note: Deleting a routing rule from a Mediator component deletes the associated
wire from the composite.xml file. However, deleting the wire from the
composite.xml removes the target service from the associated Mediator s a
) h a
routing rule, that is, a routing rule is not deleted when its associated wire is
deleted. o m
c ideฺ
i l ฺ
d) In the Confirm Delete dialog box, click Yes. g ma t Gu
o
e) In the JDeveloper window, click the composite.xml
@ tabdand
e nverify that the
d tu removed. Use the
rca ishasSbeen
wire between the RoutePO and WritePOFileService
e
following image as a guide:
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n and Wire a new Mediator Component between RoutePO and
Insert
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


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 ( ).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

c. Type Chooser Expand Project Schema Files >


internalorder.xsd, select the order element,
and click OK.
d. Create Mediator Click OK.
a)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
b)
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 96


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

s a
) h a
o m
c ideฺ
i l ฺ
d)
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
cMediator ฺ
b) In the composite.xml window, drag a wire from the EnrichPO i
a Gul ฺ i d e
“Drag to add a new Reference” icon ( ) to the service g m
interfacenicont ( ) of the
o @ e
WritePOFileService external reference.
r c ad Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
5) aIn the n f window, select File > Save All to save the changes to all files in the
M JDeveloper
s
k tra
Eri project.
n -
no

Oracle SOA Suite 11g: Build Composite Applications 98


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
If you require help to perform this task, use the following steps:
s a
a) In the composite.xml window, double-click the RoutePO Mediator ) h a
component to open the Mediator Editor.
l ฺ c om eฺ
b) In the RoutePO.mplan window, under the Routing Rules m ai G
section u idStatic
in the
Routing for the execute operation, click the “Selectoan @ g nt file or
existingemapper
create a new one.” Icon ( ). r c ad Stud
c) In the Request Transformation Map ฺ m e box,taccept
dialog his the Use Existing Mapper
i n e
File (default) option, and click
j a zm
the Browse
t o usMappings icon ( ).
a ฺ
d) In the SOA Resource
e r ikBrowsere n se select the
window,
(
PurchaseOrder_To_order.xsl
o lic file and click OK.
d l e
a Transformation
e) In therc
e Request
f e r ab Map window, confirm the Use Existing Mapper
M
File fieldscontains the value xsl/PurchaseOrder_To_order.xsl and
ka click n
E on-traOK.
r i
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
multiply component, from the s a
Mathematical Functions in the ) h a
o m
c ideฺ
Component Palette, to the middle column
of the XSLT Mapper. i
a Gul ฺ
c. g m t
PurchaseOrder_To_order.xsl Drag the price from the source column
o @ e n
r c ad Stud
onto the left-side handle of the multiply
function in the middle column of the
ฺ m e this
XLST Mapper.
in use
zm
a ฺ ja e to Drag the quantity element to the multiply
( e rik ens function.
d. o l i c
PurchaseOrder_To_order.xsl Drag the right-side handle (the result)
r c ad able from the multiply function to the
M e fer itemTotal in the target column.
r i ka -trans
E a)on
n

Oracle SOA Suite 11g: Build Composite Applications 100


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
c)
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nd)

Oracle SOA Suite 11g: Build Composite Applications 101


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

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:
s a
Step Screen/Page Description Choices or Values
) h a
a. PurchaseOrder_To_order.xsl Right-click the orderTotal in the
m
ฺ o
c ideฺ
target column, and select Set
l
i
ma t Gu
Text > Enter Text.
g
b. Set Text @ den
Select the Text option, and enter
d o
c. e
PurchaseOrder_To_order.xsl rca is Stu
the value 0.0. Click OK.
Verify the value 0.0 is assigned
i n ฺm e th
as text to the orderTotal element
ฺ j a zm to us in the target column.

e r ika ense
a) o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

b)

Oracle SOA Suite 11g: Build Composite Applications 102


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

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. Set Text s
Select the Text option, and enter
a
)
the value: true. Click OK. h a
c. o m
c ideฺ
PurchaseOrder_To_order.xsl Verify the value true is
i l ฺ
ma t Gu
assigned as text to the inStock
g
d o @ den
element in the target column.
a)
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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) In the EnrichPO.mplan window, under the Routing Rules section in the Static s a
h a
Routing for the execute operation, click the “Select an existing mapper file or
)
create a new one.” Icon ( ). o m
c ideฺ
i l ฺ
maNewt Mapper
c) In the Request Transformation Map window, select the Create
g G u File
d o @ den and click
option, accept the default XSL file name order_To_order.xsl,
OK.
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
ฺm thee items
c) Drag a line from the itemTotal (expanding
i n th > item element, if required)
j a zm handle
from the source on to the left-side
t o uofs the sum function in the middle
column. ฺ
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 106


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
c) On the Deployment – Log window, confirm that deployment is successful. s a
) h a
2) In a Web browser window, if needed enter the URL m
http://localhost:7001/em and login with the user name weblogic l ฺ o
c idand e ฺ
i
password welcome1.
g ma t Gu
3) Test the updated POProcessing composite application, o @ writes
which d e norder files in the
d
D:\labs\podata folder, by using Oracle Enterprise
e Stu with instructions in
rca isManager
the following table:
i n ฺm e th
Step Screen/Page Descriptionjazm Choices
t o usor Values
a. Enterprise Manager ihome ฺ
ka nseExpand the SOA folder in the Farm navigation
( e r e tree, and click the “POProcessing [1.0]” link.
o l i c
b.
r c ad a[1.0]”
“POProcessing
b le Click Test.
c.
M e fer
“POProcessing [1.0]” Test Web In the Input Arguments Request tab section,
i ka Service a n s select the XML View option, and replace the
r
E on- t r supplied XML data with the contents of the
n 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


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

b)

s a
) h a
o m
c ideฺ
c) i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 108


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th file has been created with
5) In Windows Explorer, verify that the order_2.xml
supplied data in the D:\labs\podata
j a us
zm tofolder.

e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
nNote: 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
7) In JDeveloper, close the order_2.xml window.

Oracle SOA Suite 11g: Build Composite Applications 110


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
rca istwoStBPEL
After modifying the assembly model you edit the following
u process
components and create their structure with their
e
ฺm initial th Assign, and Transform
Scope,
activities: i n
m o us e
1. The ApproveCCOrder BPEL ฺ j a zprocess
t that validates the credit card and is later
k a workflow
modified to includerihuman s e to manually approve orders if their total
( e c e n
exceeds 3000.
a d o le li
c raBPEL
2. The Fulfillment
e r b process that performs processing tasks to fulfill approved
a n s fe processing includes checking if stock (inventory) for the order
orders. Fulfillment
M
k -tra forfrom
Eri onproducts
is available an internal and online store, selecting the store to supply the
an order, and sending the order to a shipping company.
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Add the ApproveCCOrder BPEL Component


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

s a
) h a
o m
c ideฺ
To complete these tasks perform the following steps: i l ฺ
g ma project
1) In the JDeveloper Application Navigator, expand the POProcessing t G uand
double-click the composite.xml file under the SOA o @ e n
Contentdfolder.
d tuperform this step.
ca yousdoSnot
Note: If the composite.xml file is already e ropen
2) In the composite.xml window, toin ฺma neweBPEL
add thi component, drag the BPEL
Process icon from the Component
j a zm
Palette
t o usthe Components column.
into

e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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”
option is not selected, and click OK.
s a
a) ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 113


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

s a
) h a
o m
c ideฺ
c) i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 114


Practice 7-1: Add BPEL Components to the POProcessing
Assembly Model (continued)
d)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
e) i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 115


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
5) Verify that your composite.xml assembly model resembles the following image:
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
6) Click File > Save All to save a changes eto all files in the POProcessing project.
r i k n s
Add the Fulfillment o (eBPEL l i c e
Component
r
In this section,c ayoud addathe
b e
lFulfillment BPEL Process component to the composite
M eassembly f e r
application
i k a a n s model, and create wires from the EnrichPO Mediator component
r
E and r
-timage as a guide:BPEL process to the Fulfillment BPEL process. Use the
the ApproveCCOrders
n
o
following
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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: a
h a s
m )
l ฺ o
c ideฺ
i
g ma t Gu
Click OK. o@ d e n
g. Type Chooser Expandrc the
d tu Files >
aProjectSSchema
e
m e this
fulfillment.xsd,
ฺFulfillmentRequest select
i n
m o us and click OK.
h. ฺj
Create BPEL Process a z t
Output: Click the Browse Output Elements
i k a s e
i. Typeo (er licen icon
Chooser Expand
( )
the Project Schema Files >
a d l e
M erc ferab fulfillment.xsd, select
FulfillmentResponse and click OK.
k a n s
Eri onj.-tra Create BPEL Process Verify the following settings:
Template: Asynchronous BPEL Process
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

10) To create a wire from the EnrichPO Mediator component to the Fulfillment BPEL
s a
) h a
component, click and drag the “Drag to add a new Reference” icon ( ) from the
right edge of the EnrichPO Mediator component to the left edge service interface icon
m
l ฺ o
c ideฺ
( ) of the Fulfillment BPEL component. i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
i k traa wire from the ApproveCCOrder BPEL component to the Fulfillment
Er11) Ton -
create
o component, click and drag the “Drag to add a new Reference” icon ( ) from
nBPEL
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


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

13) Click File > Save All to save changes to all files in the POProcessing project.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 120


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
case, you need to create a new XSL Transformation to calculate the order total,
s a
and cannot reuse the order_To_order.xsl file, because the target XSD has
) h a
different parent element to the order element.
o m
c ideฺ
i l ฺ
To complete these tasks perform the following steps: g ma t Gu
1) In the POProcessing composite.xml window, todedit o @ d e
the routing
nrule definitions
of the EnrichPO Mediator double-click the EnrichPO rca MediatorS tucomponent icon.
e
ฺm e this
i n
Add a Paypal Filter to the First
j a zmRouting
t o usRule

2) In the EnrichPO.mplan
e r iktheawindow,e n sein the first routing rule (with
(
WritePOFileService::Write
o as
l i target
c service) add a filter that checks if the input
ad abelement
message payMethod
r c le is equal to the 'paypal' string value. Use instructions
in the e
Mfollowing f r and associated screenshots as a guide:
etable
a
ik Screen/Pagean s
ErStep o n - t r
Description
Choices or Values

a.n 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


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

b)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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'
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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) In the Request Transformation Map window, use the Use Existing Mapper File s a
option (the default), and click the Browse Mappings icon ( ). ) h a
o m
c idefileฺ
i l ฺ
c) In the SOA Resource Browser window, select the order_To_order.xsl
from the project XSL folder, and click OK.
g ma t Gu
d) In the Request Transformation Map window, with othe d n Mapper File
@Use Existing
e
d
a OK.Stu
field set to xsl/order_To_order.xsl,
e rcclick
i n ฺm e this
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Fulfillment/fulfillment_client::process, click the “Select an existing mapper file or a
create a new one.” icon ( ). h a s
m )
b) In the Request Transformation Map window, select the Create New l ฺ o
c Mapper ฺ
File
e
option, and accept the default Mapper File Name
i
a Gu i d
order_To_FulFillmentRequest.xsl and click g m
OK. nt
o @
d window, demap all elements
c) In the order_To_FulFillmentRequest.xsl r c a S t u
by dragging the order element from ฺ m e
the sourcesh i s
t on to the
tree
FulfillmentRequest element i n
m o us tree.
in the e
target
a z
ฺj acceptealltthe default settings and click OK.
d) In the Auto Map window,
r i k a s
( e c e n
a d o le li
e) In the order_To_FulFillmentRequest.xsl window, delete the map line

e rc erab
connecting the orderTotal elements.
M s f
f) In the order_To_FulFillmentRequest.xsl
a n window, to calculate the
r i k -t r a
E onorderTotal correctly, perform the following mapping actions:
n 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


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:


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ikato savee n setransformation map file and
o (
g) Select File > Save All the
licchanges.
d
EnrichPO.mplan
ca rab l efile
e r
9) Close
a n s fe
Mthe EnrichPO.mplan and order_To_FulFillmentRequest.xsl
k tra
Eri windows.
n -
no

Oracle SOA Suite 11g: Build Composite Applications 125


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

The following image represents the BPEL process flow diagram you create in this
practice:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

Additional Note: You can use either of the following ways to rename BPEL activities: s a
• Double-click the activity name, enter the new name, and press Enter. ) h a
o m
c ideฺ
• Double-click the activity icon, replace the name in the General tab, and click OK.
i l ฺ
out the specific steps to rename an activity. g ma t Gu
For brevity, subsequent instructions just ask you to rename the activity and do not spell

d o @ den
To create the initial ApproveCCOrder BPEL process e Stu the following steps:
rcaflow,isperform
i n ฺm e th
Create and Name the Flow Activities
ฺ j a zm to us
ikaiconetonopen
1) In the POProcessing composite.xml
e r se window, double-click the ApproveCCOrder
o (
BPEL Process component
l i c the BPEL Editor.
c ad able
2) In the ApproveCCOrder.bpel
r window, create and name the three activities
e
M in the
shown
r
fe image:
following
k a n s
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
a renameStituto Assign_orderinfo.
rcand
b) Double-click the name of the assign activity
e
ฺm e this
i n
ฺ j a zm to us
e r ika ense
o ( lic
d
ca rab  l e
e r
c) M
a
Drag a Scope
n s fe activity from the Component Palette into the flow after the assign
k activity.
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 128


Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
d) Rename the Scope activity to Scope_validatecc.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
e) Drag another Scope activity from the Component o @ intodthe
Palette e nflow after the
d
Scope_validatecc activity.
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 129


Practice 7-3: Design the initial ApproveCCOrder BPEL Process
(continued)
f) Rename the second Scope activity to Scope_fulfillment.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
3) Select File > Save to save the changes to the ApproveCCOrder BPEL Process. m
l ฺ o
c ideฺ
i
Configure the Assign_orderinfo Activity
g ma t Gu
In this section, you edit the Assign activity and create a copy@
o operationeto
d n store a working
d
rca is Stu
copy of the order from the inputVariable in the outputVariable.
e
4) In the ApproveCCOrder.bpel window,
i n ฺm to edit
e h activity and add copy
tthe
a zm tthe
operations double-click the Assign_orderinfo
Note: Alternatively, you canฺjright-click o usactivity.
Assign_orderinfo activity and select Edit.
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s
as seen in image associated with this step) can
a
) h a
differ, they are excluded from the instructions.
c. Assign o m
c ideฺ
Confirm the addition of the copy operation in the
i l ฺ
OK. g ma t Gu
row below the From and To headings, and click

d o @ den
a)
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 131


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e
Note: When you select an element in a variable Stu you are creating an
rca treeisstructure
XPath expression for that elementin ฺmis added
that e ttohthe BPEL source code in the
j a t o usvalues. The XPath expression helps the
zm attribute
associated activity XML element
BPEL Engine extractkthe ฺ
a XMLsfragment
e or value and copy it to the target
r i n
element.
o (e lice
c)
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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,
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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. a
h a s
m )
l ฺ o
c ideฺ
i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
9) nConfirm 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k ra window, create the fulfillmentRequest variable and set its type to the
i In the-tVariables
Er13) o n
nFulfillmentRequestMessage 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


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

s a
) h a
b) o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 135


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
d)
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 136


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
15) In the Variables window, create the fulfillmentResponse variable and i l ฺ cset its type
i d etoฺ
the FulfillmenResponseMessage type defined in the project g ma t Gu
fulfillment.wsdl
file. Use instructions in the following table as guide (no o @
screenshots
d e nare provided):
d
Step Screen/Page Description rca is Stu
Choices oreValues
a. Variables Click
i n ฺmCreatee icon
the th ( ).
b. Create Variable
j a zName: t o us
m fulfillmentResponse
k ฺ
a Type: e Select the Message Type option and click the
r i n s
o (e lice Browse Message Types icon ( ).
c.
r c ad able
Type Chooser Expand the Message Types > Project WSDL Files >
e
M nsfe r Fulfillment.wsdl > Message Types folders,
k a select the FulfillmentResponseMessage,
Eri on-tra and click OK.
d.n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
h a
)to have
Note: The fulfillmentRequest and fulfillmentResponse variables are defined o m
ilฺc ubecause
message structures compatible with the Fulfillment BPEL processainterface, i deฺ
their message types are obtained from the WSDL file created m the Fulfillment
gfor t G
@ n
BPEL Process component interface.
c a do tude
17) Select File > Save to save the changes to thee r S BPEL Process.
ApproveCCOrder
i s
m
inฺ use t h
Create a Transform Activityzin
a m the Scope_fulfillment
o Activity
a ฺ j
In this section you create a Transform t
e to copy the contents of the outputVariable
activity
r i k n s
(e locallicvariable.
into the fulfillmentRequest
o e Therefore the Transform activity must be
c d ble
added inside theascope to access the fulfillmentRequest variable.
r
feraby mapping the parent elements and using the Automap tool to
Note: Thee children elements of each variable are the same; therefore, the transformation
mapais M s
quicklyncreated
ik -the
Ercomplete traXSL mapping required.
o n
18)nIn 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

19) Configure the transformation source variable as the outputVariable payload, and the
target variable as the fulfillmentRequest payload and create a new transformation a
a
map file called Transformation_to_fulfillment. Use instructions in the following table
h s
and associated screenshots as a guide: m )
l ฺ o
c ideฺ
Step Screen/Page Description Choices or Values i
a theG u
a. Transform > Transformation g mclick
Next to the Source section, t Create icon
( ). d o @ den
b. Source Variable rca Select
Source Variable: S tu
outputVariable
e this is already selected
ฺmPart:epayload
Source
i n
j a us
zmClicktoOK.
c.
k a ฺ
Transform > Transformation e Variable: fulfillmentRequest
Target
r i n s
o (e lice (should already be selected. If not select it)

r c ad able Target Type:


Mapper File:
payload (should also be selected)

M e fer
i ka -tran s xsl/Transformation_to_fulfillment
r
E on Click the Create Mapper File icon ( ).
n
Note: The XSL file is created and opened in the
XSLT Mapper Editor window.

Oracle SOA Suite 11g: Build Composite Applications 139


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
b) d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 140


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
20) In the Transformation_to_fulfillment.xsl
r ca swindow,
S tu create the mappings
rules such that all elements in the source are
ฺ m e
mappedhtoi their respective target
t
elements by performing the followingm i n
steps: se
azsourcetcolumn
o u
a) Drag the order elementainฺjthe e to the FulfillmentRequest element in
the target column. r i k n s
o (e lice
r c adMapaPreferences
b) In the Auto
b le window, accept all default settings and click OK.
c) M e thatfeallr elements in the source are mapped to their respective elements in
Confirm
r i a a nsby expanding the child node. Use the following image as a guide:
k the-trtarget
E on
n

Oracle SOA Suite 11g: Build Composite Applications 141


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
22) In the JDeveloper window, closezthe
j a t o us
mApproveCCOrder.bpel window.

e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 142


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

implementation details later, after dependent services have been constructed. The
following image illustrates the initial structure of the Fulfillment BPEL Process
component:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

Create and Name the Flow Activities s a


) h a
In this section you create and name three Scope activities to structure the BPEL process.
o m
cbetweenidtheeฺ
3) In the Fulfillment.bpel window, in the BPEL process diagram i l ฺ
ma activities
receiveInput and callbackClient activities create three namedgScope t G u called
@ dand
(in the order listed here): Scope_insertorder, Scope_checkstock,
o e n
Scope_shiporder. Use the following image as arc a d
guide: tu
e S
i n ฺm e this
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Scope_checkstock. However, to successfully compile and deploy the composite with this a
BPEL process you add an Empty activity into each scope. To complete this task perform
h a s
the following steps: m )
l ฺ o e ฺ
c as iadguide
i
5) Expand the Scope_insertorder activity, and using the following screenshot
drag an Empty activity from the Component Palette into theg ma t Gu
scope.
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 145


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
7) Collapse each of the Scope activities and save the changes to your
g maproject. t G u
Add and Configure an Assign Activity in Scope_shiporder d o @ den
e
In this case, you initialize the response data in the
ca s Stuwith hard-coded string
routputVariable
m section
ฺThis i
thenables
that are later replaced with dynamic results.
m i n s e you to learn how to
create two copy operations in the same z Assign
ja e to u
activity.
a ฺ
8) In the Fulfillment.bpel
( e rik ewindow,
ns expand the Scope_shiporder, drag an Assign
activity into theo
d i c
scope, and lrename the Assign activity to Assign_shipstatus. Use the
a l e
M erc ferab
following image as a guide:

r i ka -trans
E on
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
Note: If you require help to createin ฺmcopy operation,
the e th perform the following
steps:
ฺ j a zm to us
r a
ikCopy se tabbed page, click the Add icon ( ) and
i) On the Assign ( e > e n
Operations
select d o
Copy lic
Operation.
l e
ii) e rcthea Create
In e rabCopy Operation window, in the “From” section select
a M s f
k an
Expression
Eri on-trsingle
as the Type, and in Expression enter: 'none' (including the
quotes).
n 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


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
Note: If you require help to create the
i n ฺmcopy operation,
e th perform the following
steps:
ฺ j a zm to us
r>ik
a se tabbed page, click the Add icon ( ) and
i) On the Assign e
(Operation. e n
Copy Operations
select Copy
d o l e lic
rcthea Create
ii) eIn
e rabCopy Operation window, in the “From” section select
M s f as the Type, and in Expression enter: 'none' (including the
r i ka -trExpression
a n
single quotes).
E on
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
ma t Gu window,
11) Collapse the Scope_shiporder activity, and close the Fulfillment.bpel
g
and save the changes to the POProcessing project. o@ d e n
d
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 149


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
To complete the testing tasks, perform the following steps:
) h a
1) Using JDeveloper, deploy the POProcessing project to the soaserveroconnection. m
c selectidtheeฺ
When the SOA Deployment Configuration Dialog window is displayed i
a Gul ฺ
“Overwrite any existing composites with the same revision ID.” g mcheck t box.
Note: Enter the login weblogic and welcome1 credentials @ n
o tuindane Authorization
c a d
Request window, if it is displayed. Monitor therMessages –SLog and Deployment -
Log windows to ensure the composite application ฺ m e isthsuccessfully
is deployed. If not,
i n e
ฺ j a zm to us
correct the errors and repeat this step.
2) Open a Web browser window,
r i k a and senter
e the Oracle Enterprise Manager URL
n
(e lice and if necessary login with Username:
http://localhost:7001/em,
weblogicawith o
d Password: le welcome1.
r c a b
3) OnM
a theeOracle s f er
Enterprise Manager home page, locate and click the deployed
k a n
Eri Farm
“POProcessing
r [1.0]” composite application link (located under the SOA tree in the
- t
non navigation pane).

Oracle SOA Suite 11g: Build Composite Applications 150


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

paypal. Use the image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k Note: If you require help to perform this task, use the following substeps:
Eri a)onOn-trthea “POProcessing [1.0]” page, click Test.
n
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


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

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
7) On the Flow Trace page, to examine
zlink s BPEL Process in the Audit Trail
mthe Fulfillment
uInstance
a ฺ
tabbed page click the Fulfillmentj a o
intthe column of the Trace tree and
i k s e
( r licen
answer the followingequestions:
o
a) What isa
c dvalueboflethe <orderTotal> element in the inputVariable?
the
b) M
r
e thefesteps
Describe ra to find the orderTotal in the inputVariable.
i s
kac) On-trtheanFlow tabbed page, what is the value of the <carrier> element after the first
r
E oncopy operation is executed in the Assign_shipstatus activity?
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
c. The <carrier> element is an empty XML element, for exampleg ma<carrier/>
t G uafter the
o @ activity,
first copy operation is executed in the Assign_shipstatus d e nas shown in the
d
following image:
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm BPEL
Note: Since this process is an asynchronous e th process the callbackClient
activity holds the responseja zmThe tlast
data.
s in a synchronous process is a
uactivity
ฺ o
Reply activity. One-way
e r ikaprocesses
e n sedo not have an activity to return a response
message. (
o Trace lic
g. d
Click theaFlow l elink in the breadcrumb path at the top of the Flow Trace
erc ferab
page.
M
r i ka -trans
E on
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
M Thisntime
Note:
a s f leave the <payOption> value as credit. Do not change any text in
k traIf you require help to perform this task, use the following substeps:
Eri then
input.
-
na)o 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

And answer the following questions:


a) Did the WritePOFileService get executed? Explain your answer.
s a
b) Remember that the ApproveCCOrder is wired to the Fulfillment BPEL process.
) h a
Now, can you explain why the Fulfillment BPEL process did not execute? m
l ฺ o
c ideฺ
Table of Answers for Step 13 i
g ma t Gu
Step Answer
d o @ den
a. No, the WritePOFileService did not execute. The tubecause the filters in
reason is
rca with S
the EnrichPO Mediator component routeseorders is payOption=credit to the
ApproveCCOrder BPEL Process and ฺ m t h
in notutheseWritePOFileService.
b. A wire in the composite assembly
a zm model
o is not an invocation pattern. A wire in an
ฺ j t
e r ika process
assembly model represents
e n e interaction pattern. Although the
a possible
scontains
ApproveCCOrder
o ( BPEL
l i c a Partner Link (a reference) to the
dBPELbProcess
Fulfillment le service interface, it does not have activities to invoke
rcaprocess.
a
a M nsfer
theeBPEL
kOn the-trFlow
14) a Trace page, click the ApproveCCOrder link and use the Audit Trail or
Eri Flow
na)onWhat change has been made by the Assign_orderinfo activity?
tabbed pages to answer the following questions:

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
before the Transform_fulfillment activity is executed the data in the s a
fulfillmentRequest variable can differ from the inputVariable. ) h a
o m
c ideฺ
Note: At this stage, the BPEL process does not modify the outputVariable before
i l ฺ
it is copied to the fulfillmentRequest variable.
g ma t Gu
15) Close the Flow Trace Web browser window.
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 157


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
i k trato the POProcessing composite application assembly model include:
ErThe n -
changes
n•o 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


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

s a
) h a
The changes made to the ApproveCCOrder BPEL Process include: m
• Invoking the synchronous CreditCardValidation composite application l ฺ o
c asiadeฺ
service. This requires that you create an external referencemor a
i
partnerG u for the
link
CreditCardValidation service.
g
@ den t
• Checking the result of credit card validationcby d o tu activity. If the card
ausing aSSwitch
e r
in the <case> branch of the Switch i ฺm e th s place the Fulfillment scope
is valid, then you restructure the ApproveCCOrderito
nactivity.
• Invoking the asynchronous j a zm to BPEL
Fulfillment us component and receive its callback

a Fulfillment
message. In this case,
e r ikthe e n se partner link has already been created, in the
ApproveCCOrder
o ( BPELlicprocess, from a wire created between the
d
ApproveCCOrder
c a aband le Fulfillment components in the practices for lesson 7.
r
e fer
a
Inkpart
M s
two thenfollowing image shows the changes implemented in the Fulfillment BPEL
r i
E on-
process: t r a
n

The changes to the Fulfillment BPEL Process include:

Oracle SOA Suite 11g: Build Composite Applications 159


• 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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 160


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

it from the ApproveCCOrder BPEL component. The following image shows the changes
to the composite application:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
To complete these tasks, perform the following i n ฺmsteps:e th
j a zm toopen us the POProcessing
1) On the JDeveloper Application ฺ Navigator,
composite.xml file,
e r ikifait isenotnsalready
e open.
o ( lic
Create the
d
a ab l e
e rcValidateCCService
r External Reference
2) a In the n fe
M composite.xml
s window, drag a Web Services component from the
r i k r a
-t Palette into the External References column.
E Component
o n
n

Oracle SOA Suite 11g: Build Composite Applications 161


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

external reference:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
r c a S tu
e
ฺm e this Web Service window:
Note: If it helps use the following steps to fill in the Create
i n s accept default Type value of
a) In Name enter ValidateCCService,
Reference. ฺ j a zm to uand
e r ika ense
b) To the right o of (the WSDLl icURL field, click the Find Existing WSDLs icon ( ) to
d l e
e rcaSOA
open the
r
Resource
a b Browser window.
c) M
a In the SOA
n s feResource Browser window, select the Resource Palette option from
k a
Eri onthe-trpull-down menu, expand the Application Server > soaserver > SOA >
CreditCardValidation [1.0] (soa_server1) entry, select ValidateCreditCard_ep and
n click OK.

Oracle SOA Suite 11g: Build Composite Applications 162


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

4) In the composite.xml window, verify that the external reference icon has been
added as shown in the following image:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
Create the Wire from ApproveCCOrder
ฺ j a zm to usto ValidateCCService
5) In the composite.xml
e r ikawindow,
e n e a wire from the ApproveCCOrder BPEL
screate
composite icon o ( ValidateCCService.
to the lic Use the following image as a guide:
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 163


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

As shown in the above image, you can verify the partner link is created if you opens a
the ApproveCCOrder.bpel file, which can be done by double-clicking the ) h a
o m
ApproveCCOrder.bpel file (in the Application Navigator) or the double-clicking
c ideฺ
ApproveCCOrder BPEL Process component icon. i
a Gul ฺ
g m t
6) Verify that your composite application, shows the addition
o @ e n
of the ValidateCCService

r c d Process
external references wired to the ApproveCCOrderaBPEL
S t udcomponent, as
shown in the following image,
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 164


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
i k tra
ErNote: n -
noThe 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


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”.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
2) In the ApproveCCOrder.bpel Design window, locate and expand the
s a
Scope_validatecc activity, and delete the existing Empty activity contained within the
) h a
scope. In the Confirm Delete window, click Yes. o m
c ideฺ
i l ฺ
g
activity create three named activity types in the order that they
marealistedt G
3) In the ApproveCCOrder.bpel Design window, inside the Scope_validatecc
in
u
the
o @ e n
following table:
r c ad Stud
Activity Type Activity name me s
a. Assign i n
Assign_ccinfo
ฺ e thiPurpose
Assign credit card number to
zm u s
a ฺ ja e to the credit card validation

e r ik ens service request variable.


b. Invoke o ( lic
Invoke_validatecc Invoke the credit card
c d
a ab l e validation service.
r er
a Mc.eSwitch s f Switch_ccvalid Check the response from the
r i k -tran credit card validation service.
E on
nNote: Use the following image as a guide to the resulting process flow within the

Oracle SOA Suite 11g: Build Composite Applications 166


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
If you require help to perform the task of constructingo @flow inside
the
d e nthe
d
r a is Stu
Scope_validatecc activity, perform the followingcsteps:
e
ฺm ePalette
a) Drag an Assign activity from the Component
i n th into the expanded
Scope_validatecc activity. zm
j a t o us

e r ika activity
b) Double-click the Assign
e n sename and rename it to Assign_ccinfo.
o
c) Drag an Invoke
(activitylifrom
c the Component Palette and drop it inside
d l e
rca erabafter the Assign_ccinfo activity.
Scope_validatecc
e
d) M
a s f the Invoke activity name and rename it to Invoke_validatecc.
Double-click
n
k -traa Switch activity from the Component Palette and drop it inside
Eri e)onDrag
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k tra
Eri Note:
n -
no 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
d) ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 170


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
Note: When you click a OK the Errors indicator should be removed, provided you
e activity
r i k n s
o (e lice
have correctly configured the Invoke settings.

r c ad toathe
7) Save the changes b leBPEL process.
MeAssign f r
eActivity
i a
Edit the
k -tran s to Supply Credit Card Information
r
E Nowothat
n the input variable has been created for the Invoke activity, you can populate the
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

local variable in Scope_validatecc. Use the following screenshot as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 172


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
c) In the Assign window,
e r ikaverify
e n seyour two copy operations have been created and
that
click OK.
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Expression icon ( ) in the <case> branch heading.

s a
) h a
o m
c ideฺ
i l ฺ
maBuilder
12) In the Condition Expression window, click the XPath Expression
g t G u( )
icon
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 174


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
a ab l e
Click e rcafter er the complete Expression shown.
a M nsfbuilding
OK
ikIn the-tApproveCCOrder.bpel
Er14) ra Design window, verify your condition is correctly
n o n
shown and click outside the Condition Expression window:

15) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 175


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k tItrais easier to drag the Scope when it is in the collapsed state. However, the
Eri Note:
n -
o Editor expands the Scope_fulfillment activity after it is dropped in the <case>
nBPEL
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
caAssignraactivity
b to Assign_invalidcc.
e
19) Rename rthe e
M f
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 177


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k ra window, verify the copy operation is created and listed and click OK.
i In the-tAssign
Er21) n
no

Oracle SOA Suite 11g: Build Composite Applications 178


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k trachanges to your BPEL Process.
i Save-the
Er23) n
no

Oracle SOA Suite 11g: Build Composite Applications 179


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 a
Invoke activity you browse for and use the existing variables instead of automatically
h a s
)
creating new variables. In addition, the Scope_fulfillment activity contains a Transform
m
o
c ideฺ
activity that has already initialized the input data in the fulfillmentRequest variable.
l ฺ
i
a Gu
g m t
To complete this task perform the following steps:
o @ e
d then
1) In the ApproveCCOrder.bpel Design window, r c adif needed,
S tuexpand
m
Scope_fulfillment activity in the <case>ฺbranche of the s
thiSwitch_validatecc activity.
i n s e
Create the Activity Flow ฺSequence j a zm totouInvoke the Fulfillment Service
a
rik Receive, e
In this section you createeInvoke,
( c e ns and Assign activities to form the sequence
needed to asynchronously
d o interact
l e li with the Fulfillment BPEL process.
2) In the e
a
rc erab
ApproveCCOrder.bpel Design window, after the Transform_fulfillment
M s f
kaactivity addnthe three named activity types in the sequence shown in the following
E on- a
r i table: t r
n 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


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
If you required o
help
(to createlithe
c flow, then perform the following steps:
l e
caInvokeraactivity
b into Scope_fulfillment and drop it after the
a) Drage ran e
M s f
r i ka Transform_fulfillment
- t r a n activity. Rename the Invoke activity to
E onInvoke_fulfillment.
nb) 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
s a
Note: Since the Fulfillment service is
) h a
o m
asynchronous you cannot specify an output
c ideฺ
i l ฺ
variable for the response. Therefore, a
ma t Gu
Receive activity is used to get the response.
g
e. Invoke @ den
Verify your settings and click OK.
d o
e r ca s Stu
Note: An alternative way to do steps a) and
i n ฺ hi a line connecting the right-
mb) isetotdrag
edge Invoke Settings icon from them Invoke_fulfillment
s activity to the Fulfillment
j
partner link. However, the table a z
of o u
instructions
t is suggested to avoid scrolling the
a ฺ e
window to accommodate
( e rikthe drage s drop approach.
nand
a) d o le li c
a
M erc ferab
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 182


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

s a
) h a
o m
c ideฺ
i l ฺ
c) g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 183


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e) e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 184


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

7) Save the changes to your BPEL process. a


h a s
Configure the Receive_fulfillment Activity m )
l ฺ o
c Receivee ฺ
8) In the ApproveCCOrder.bpel Design window, drag a line from i the i d
Settings icon (on the right-edge) of the Receive_fulfillment g ma tottheGu
activity
Fulfillment.fulfillment_client partner link.
d o @ den
Note: The Fulfillment callback operation, called r a S tu is used to
c“processResponse,”
receive a response from an asynchronousฺm e
service. The
t s
hiOperation and Partner Link
fields are set by performing this step. i n e
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 185


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

following image as a guide to the Invoke activity settings:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
a ab l e
Configure e rcthe r
Assign_fulfillment_status
e Activity
M s f
rThe
i kaFulfillment
- t r anBPELthe service returns a shipStatus and carrier response values. In this
E section
o nyou configure Assign activity to copy the shipStatus from the
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 187


Practice 8-3: Invoke the Fulfillment Process from
ApproveCCOrder (continued)
12) Verify that your Scope_fulfillment activity sequence resembles the following image:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
13) Save the changes to e r
your
a process
ikBPEL se and project.
e n
d o ( completed
Note: You haveamostly l e lic the main end-to-end flow for the ApproveCCOrder
process. The
M f e rabenables you to construct the core flow pattern for the
c practice
ernext
Fulfillment
i k a rBPELa n s process. After this lesson’s practices, you update and change the BPEL
r
E processn -t (and composite application) implementation to include business rules and
flow
human
n o workflow patterns where applicable.

Oracle SOA Suite 11g: Build Composite Applications 188


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

check the shipMethod chosen by the customer and create the order shipping request
message for an invoke activity for each JMS Adapter:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( licthe following steps:
To complete thesed
ca rabtasks l e
perform
e r
a n s fe composite.xml window, double-click the Fulfillment BPEL
M POProcesing
1) In the
k a
Eri Process
n - trcomponent icon, to open it in the BPEL Editor.
no and Configure JMS Adapter Partner Links
Create
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
b) In the Fulfillment.bpel Design window, drag the JMSa i l ฺ
g m Adapter G u the
from
Component Palette into the right-hand Partner Link column.
@ e n t
d
Note: This opens the Adapter Configuration Wizardo d
window.
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Click Next. a
f. Operation Operation Type: Select the Produce
h a s
Message option. m )
l ฺ o
c ideฺ
Operation Name: Accept the default value of
i
Produce_Message
g ma t Gu
Click Next.
d o @ den
g. Produce Operation Parameters
rca is Stu
Destination Name (Queue):
e
jms/demoFulfillmentQueue
i n ฺm e th
JNDI Name: eis/demo/Queue
ฺ j a zm to us
Accept default settings for other fields.

e r ika ense Click Next.


o ( lic Note: To set the Destination field click Browse
d l e
e rca erab and select the queue name from the Select
Destination window. Manually change the
a M nsf JNDI Name as specified.
k -tra
Erh.i onMessages URL: xsd/fulfillment.xsd
n 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


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

b) s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
ca rab l e
e r
c) M
a n s fe
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 192


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

s a
) h a
o m
c ideฺ
i l
a Gu ฺ
g m t
e)
o @ e n
r c ad Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 193


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 194


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 195


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
h) On the Messages page,
r i k aclick thesBrowse
e icon ( ) to display the Type Chooser
where you can (select e n
e thelicShippingRequest element from the
a o
d ble
internalorder.xsd (either nested in the fulfillment.xsd or the
r c
Project
e Schema raFiles folders):
M s f e
r i ka -tran
E on
n

Oracle SOA Suite 11g: Build Composite Applications 196


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
i)
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 197


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
5) In the Fulfillment.bpel Design i n ฺm confirm
window, e th that the partner link for the
j a
JMS Adapter exists in the Partner zm o usthe right-side of the window.
Link column
t

e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k trathe POProcessing composite.xml window, and observe that a wire has
Er6)i Click
n -on
o created between the Fulfillment BPEL Process component icon and the newly
nbeen
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


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):
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
d. Server Connection Connection exists in: Select the Resource s a
Palette option. ) h a
Connection: soaserver o m
c ideฺ
Click Next. i l
a Gu ฺ
e. Adapter Interface g m t
Accept the default “Define operation and schema
o @ e n
Click Next. r c ad Stud
(specified later)” option.

ฺ m e this
f. Operation Operation Type: Select the Produce Message
in use
zm
option.
a ฺ ja e to
Operation Name: Accept the default value of
( e rik ens
Produce_Message
d o l e lic
Click Next.
g. rcaOperation
Produce
e e rab Destination Name (Queue):
M s f jms/demoFulfillmentQueue
r i ka Parameters
r a n
E on-t JNDI Name: eis/demo/Queue
Accept default settings for other fields.
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s a
(specified later)” option
) h a
Click Next. o m
c ideฺ
f. Operation i l ฺ
Operation Type: Select the Produce Message
option g ma t Gu
o @ den
Operation Name: Accept the default value of
d
Click Next.e rca is Stu
Produce_Message

i n ฺm e th
g. Produce Operation
Parameters ฺ j a zm to us
Destination Name (Queue):
jms/demoFulfillmentQueue
e r ika ense
JNDI Name: eis/demo/Queue
o ( lic Accept default settings for other fields.
d
ca rab l e Click Next.
h. e r
Messages fe URL: xsd/fulfillment.xsd
a M n s
r i k r a Schema element: ShippingRequest
E on-t Note: If you click the Browse icon to select the
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
Note: The Fulfillment BPEL Process component
i n ฺm ehasththree wires, where each wire is
j a t us Remember, you could have also
m oreference.
linked to a different JMS adapterzexternal

created and configured theaJMS Adapters
composite.xml(e rikwired e
and n
themstoethe asFulfillment
external references in the
BPEL Process component to
o
yield the samedresults. e l i c
r c a abl
Add a
e ftoerChoose the JMS Adapter for the Shipment Request
MSwitch
i k a a n s
r
E In r
-t<case>
this section
n you create the activity sequence in the Scope_shiporder that uses a Switch
with
n othree 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
a
rcsequence S u
tthe
Note: Only if you require help to create the flow e is in Scope_shiporder
activity, perform the following steps: inฺm t h
m u s e
a) Drag a Switch activity asฺjthe z
a first activity
to in Scope_shiporder.
a e
k Switch_shiporder.
b) Rename the Switch
( e riactivity
c e ns
c) Expand a d
the l e li activity.
oSwitch_shiporder
rc erab
d) MToethe left
s fof the Switch_shiporder activity icon, click the Add Switch Case icon
k a n
Eri on( -tr) atwice to create two new <case> branches:
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k -traOnly if you require help to build the expression, use the following
Eri onNote:
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
a right-most l e
17) Configure
e rcthird
f e ab <case> branch name and condition expression for the
rperforming
a M
FedEx service
n s by the following steps:
k
Eri a)onOn-trthea middle <case> branch, double-click the text “<case>” shown in the title.
nb) 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


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

s a
) h a
o m
c ideฺ
i l ฺ
18) Save the changes to your Fulfillment BPEL Process, after g ma thatt G
verifying
u
your
o@ timage: d e n
d
Switch_shiporder activity appears as shown in theafollowing
e rc is S u
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
a ab l e
Note: e rcnames
The erUPS,as USPS, and FedEx (as specified in each of the Switch Case
a M now s f
r i k -tran
settings) appear visual annotations in the title for each <case> branch.
E on
Create
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
r ikahelpetoncreate
Note: Only if you require
e se the variable, perform the following steps:
o ( lic
d
a ab
a) On the expanded
c l e
Scope_shiporder, click the Variables icon ( ).
r
e fer window, click the Create icon ( ).
b) M
In the Variables
r i a
kc) In-tthe
r a ns
E on Create Variable window, perform these steps:
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g
of the shippingAddress variable (in the Scope_shiporder). Use
mtheafollowing
21) Configure the Assign_shiporder, with three copy operations to initialize
t
theucontents
G steps
o @ e n
(and their associated screenshots as a guide):
r c ad Stud
a) Create a copy operation that copies the
ฺ m e telement
orderId his in the inputVariable to the
i n
orderId element in the shippingRequest e
variable:
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 207


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
c) Create a copy operation that
j a t us XML Fragment into the
m theo following
zcopies

e r ika ofethe
shippingAddress element
n e
sshippingRequest variable:
o ( lic
d
<ns0:shippingAddressl e
e rca erab
xmlns:ns0="http://www.example.org/ns/fulfillment">
a n s f
M <ns0:street></ns0:street>
k
Eri on-tra<ns0:city></ns0:city>
n <ns0:state></ns0:state>
<ns0:zip></ns0:zip>
<ns0:country></ns0:country>
</ns0:shippingAddress>

Oracle SOA Suite 11g: Build Composite Applications 208


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

XML Fragment area of the copy operation. Observe that the Type in the “From”
section is set to XML Fragment.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
Note: When copying
e r ikana XMLe n se the XML Namespace prefix and its
fragment
associated path(are required
d o l e lic to preserve the BPEL process source XML structure.
ca rtoayour
22) Save therchanges
e b BPEL Process.
M s f e
r i ka -tand
Create r a nConfigure the <case UPS> Branch Activities
E In thisonsection, you create an Invoke activity to invoke the UPSJmsService and Assign
n
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


Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:


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

s a
) h a
24) Configure the Invoke_UPS activity to execute the Produce_Message operationc o m of ฺ
the
i l ฺ
UPSJmsService, and use the Automatically Create Input Variableaicon to create i d e
local variable, by performing the following steps: g m t Gu a
d o @ den
a) Drag a line from the Invoke_UPS activity tocthe
S tu
r a UPSJmsService
e this
m theeAutomatically
b) In the Edit Invoke Activity window, ฺclick Create Input
Variable icon, and in the Create i n
m o us
Variable window ensure the Local Variable
j a
option is selected. Click ฺOK.
z t
i k a s e
o (er licen
r c ad able
a Me nsfer
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 210


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
b) Append the literal string ' (UPS)'
i n ฺm e h leading space to the custName
including tthe
a z m o us
element in the Invoke_UPS_Produce_Message_InputVariable.
Note: Appending the carrier
a ฺ j text e t customer name is included here so that
to the
i k s
consumer d o (er that
you can see the carrier
application
usedeinnthe shipping message received by the JMS message
licyou use in the testing section of this practice. In this
l
cathe followinge
case ruse
M e f e rab steps to create an Append Operation:
r i nsAssign window, click the Create icon ( ) and select Append
ka i)-trInathe
E on Operation.
n

Oracle SOA Suite 11g: Build Composite Applications 211


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r i ka nse
o l i e '(UPS)' into the carrier element in the
c) Copy the literal(string expression
c
process a
c d ble
outputVariable.
r
e fera
M
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 212


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
26) Save the changes to your BPEL a Process.
e r i k
e n se
Create and Configure o ( the lic<case USPS> Branch Activities
d l e
rcayou ecreate
In this section,
e raban Invoke activity to invoke the USPSJmsService and Assign
M
withamultiple copy
n f
s operations preparing the JMS service request message. In the same
r i k r a
-t create copy operations to set 'USPS' as the carrier and 'completed'
E Assign
as n
the nactivity
ostatus 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


Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
o @ denoperation of the
28) Configure the Invoke_UPS activity to execute the Produce_Message
d
USPSJmsService, Use the Automatically Create rcInput S tu icon to create a local
a Variable
e
ฺm e this
variable, by performing the following steps:
i n
a) Drag a line from the Invoke_USPS
j a t o usto the USPSJmsService
zm activity

ika ewindow,
b) In the Edit Invoke rActivity
e n se click the Automatically Create Input
Variable icon,
o ( in thelicCreate Variable window ensure the Local Variable
and
d le OK.
optioncisaselected.bClick
r a
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 214


Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
29) Configure the Assign_toUSPS activity with the following three copy operations and
one append operation:
a) Copy the ShippingRequest element from the shippingRequest variable into the
ShippingRequest element of the Invoke_USPS_Produce_Message_InputVariable.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 s a
“To” section use Variable as the Type and select the custName child element ) h a
in the Invoke_USPS_Produce_Message_InputVariable as the target. o m
c ideฺ
i l ฺ
a inGtheuprocess
c) Copy the literal string expression 'USPS' into the carrierm element
outputVariable. @ g n t
o d e
d) Copy the literal string expression 'completed' r c ad intoSthetushipStatus element in
m e h i s
the process outputVariable.
m inฺ use t
30) Save the changes to your BPEL
ฺ j a zProcess.to
r a
ikthe seFedEx> Branch Activities
Create and Configure ( e e n
<case
In this section, a d
you
ocreate l
an e lic activity to invoke the FedExJmsService and Assign
Invoke
with multiple
M rab to prepare the JMS service request. In the same Assign
erccopyfeoperations
ka create
activity
i a n s operations to set 'FedEx' as the carrier and 'completed' as the
copy
r r
E statusoinn-thet outputVariable.
n
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


Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)

Use the following image as a guide:


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
32) Configure the Invoke_FedEx activity to execute thed o @ den operation of
Produce_Message
the FedExJmsService, and use the Automatically
e StuVariable icon to create
rcaCreateisInput
i n ฺm steps:
a local variable, by performing the following
e th
a) Drag a line from the Invoke_FedEx
j a o usto the FedExJmsService
zm tactivity

ika ewindow,
b) In the Edit Invoke rActivity
e n se click the Automatically Create Input
Variable icon,
o ( in thelicCreate Variable window ensure the Local Variable
and
d le OK.
optioncisaselected.bClick
r a
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 216


Practice 8-4: Invoke JMS Adapters in the Fulfillment BPEL
Process (continued)
33) Configure the Assign_toFedEx activity with the following three copy operations and
one append operation:
a) Copy the ShippingRequest element from the shippingRequest variable into the
ShippingRequest element of the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 s a
Expression for the Type and enter ' (FedEx)' in the Expression field. In ) h a
o m
c ideฺ
the “To” section use Variable as the Type and select the custName child
i l ฺ
ma t Gu
element in the Invoke_FedEx_Produce_Message_InputVariable as the target.
g
c) Copy the literal string expression 'FedEx' into the@
o d e n in the
carrier element
d
process outputVariable.
e rca is Stu
i n ฺm e th into the shipStatus element in
d) Copy the literal string expression 'completed'
the process outputVariable. zm
j a t o us

ka Design
34) In the Fulfillment.bpel
e r irepresented
e n sinethe
window, verify that your Scope_shiporder has
o (
the BPEL Process flow
l i c following image:

r c ad able
a Me nsfer
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 217


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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


1) Using JDeveloper, deploy the POProcessing project to the soaserver connection. s a
When the SOA Deployment Configuration Dialog window is displayed select the ) h a
“Overwrite any existing composites with the same revision ID.” Option. o m
c ideฺ
i l
Note: If the Authorization Request window is displayed, enter the username ฺ
g ma t Gu
weblogic and password welcome1. Ensure the composite application is
successfully deployed. d o @ den
2) In a Web browser window, enter the Oracle e Enterprise Stu URL
rca isManager
http://localhost:7001/em. If required login
i n ฺmwith Username:
e th weblogic with
Password: welcome1.
ฺ j a zm to us
r a
ikManager e page, locate and click the deployed
shome
3) On the Oracle Enterprise
e
( composite e n
“POProcessing o
d [1.0]”
l e lic application link (located under the SOA tree in the
rca epane).
Farm navigation
e rab
4) a M ns f
r i kOn the-tr“POProcessing
a [1.0]” page, click Test.
E Teston1: Order with a Valid Credit Card and two_day Ship Method
n
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


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?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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: a
h a s
m )
l ฺ o
c ideฺ
i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 219


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

names of the Assign_toUPS and related activities in the Switch that confirm the flow
of the shipping request. For example:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
)h a
m
co ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
The child element containingzthe
j a t o usinformation is the <inp1:status> element,
mvalidation
and the value returnedkis ฺ
a the string evalue VALID.
r i n s
(e window
7) Close the Web browser
o l i c econtaining the Flow Trace, Audit Trail or Flow
tabbed page.
r c ad able
M e fer
i a
Read
k the n s
Shipping
a Request from the JMS Message Queue
r - t
E The oShippingr
n Request JMS message is still retained in the JMS queue until a JMS
n
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


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

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:
s a
a) With the files application selected in the Application Navigator select File >
) h a
Open. o m
c ideฺ
a
b) In the Open dialog box, browse to the D:\labs\files\JmsSendReceive i l ฺ
gm u
folder, select the JmsSendReceive.jpr file and@ click Open.nt G
Note: If the Open Warning dialog box is displayed,
a doat thetu“Dodeyou want to
c
r Migration
migrate these files?” prompt click Yes. Inethe s SStatus dialog box, click
m h i
OK.
m inฺ use t
a z toand receive the JMS message, perform the
10) To run the Receive.javaฺjapplication
following steps:
e r ika ense
o
a) In the JDeveloper
( Application
lic Navigator, right-click the JmsSendReceive project
d
a selectaRun.l e
b In the JDeveloper “Message – Log” window area a new
e rcand
folder
e r“Running:JmsSendReceive.jpr
a M n s f
window titled – Log” is opened to display the
k -tra output (the JMS messages consumed) and receive application input
Eri onapplication
(the letter q and Enter to terminate the application).
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
c) In the Running:JmsSendReceive.jpr – Log” window, to terminate the ) h a
Receive.java application, at the Input prompt press q and then Enter. o m
c ideฺ
i l ฺ
d) Close the Running:JmsSendReceive.jpr window.
g ma t Gu
o @ d e n
Deploy a Supplied JMS Consumer Composite
c a d Application
tu
e r S
i n
the rest of the practices, you deploy the supplied e this and consumption
To simplify management and handling of JMS message delivery
ฺm JMSConsumerDemo during
project, which is a
composite application that:
ฺ j a zm to us
• Reads the JMS messages
e r i ka produced
n se by JMS Adapters in the POProcessing
(
composite application.
o e
lic JMS message to a file called shiporder_#.xml, where
d l e
e rca ea rnumber
• Writes the
# represents
shipping request
ab that is incremented for each message file created. There is
M f
s file per message and the files are stored in the D:\temp folder.
r i ka one r n
message
a
-t image shows the component assembly model for the JMSConsumerDemo
E The ofollowing
n
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

Test 2: Order with an Invalid Credit Card s a


h
) and a
For this test you use the D:\labs\files\po-small-ipod.xml file as input,
o m
corder data. ฺ
change the customer ID and credit card information before submitting the
i l ฺ i d e
15) To run the second test, perform these steps: g ma t Gu
o @ d e n
a) In the JDeveloper Application Navigator, expand
c a dthe “files”
tuCopy all theproject
> xml_in
folders and double-click the po-small-ipod.xmle r i s S
file. text in the
file into the clipboard. m
inฺ use t h
b) On the “POProcessing [1.0]” a m
zpage intothe Web browser, in the Request tab Input
ฺ j
ka thenXML
Arguments section,riselect
e se View, and paste the clipboard contents into
the text area. (
o lic e
d
caXMLrelementsl e
c) Edit rthe
e f e ab in the data in the XML View area such that:
a MThe <ns0:custID>
n s element contains the value 3.
k a
Eri onThe -tr<ns0:ccNumber> element contains the string 4321-4321-4321-4321
n

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


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?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
The Fulfillment
o (was notlinvoked
ic by the ApproveCCOrder BPEL process because
d
cacard rwas
the credit l e
bnot valid and Switch activity that checks the
e r a
a n s fe response executed the <otherwise> branch, as seen in the Flow
ValidateCCService
M
k tabbed page for the ApproveCCOrder BPEL component link:
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 225


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):
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
c. The status value returned by
j athe
t o us activity is “invalid credit card” as
zmcallbackClient
seen in the expanded k a ฺ
<payload> ethe callbackClient activity in the Audit Trail
of
r i
e ApproveCCOrder
tabbed page for(the e n s activity.
o l i c
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:
The <ns0:shipChoice> element contains the value five_day. s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l
a WebaService. e
c) Clickrc
M e Test
f e r b
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 227


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
a) To which JMS Adapter service was the
i n ฺmordereshipping
th request sent?
b) Why is the JMSConsumer_ep
j a zm t o usbelow the Fulfillment BPEL
entry shown

aFlow Trace?
Component entry inik
e r the
e n se
(
c) Why are theoRouteOrder licand the associated FulfillmentFileService components
d l e
e rcain theerFlow
present
a b Trace?
d) M
a Was a n s f
shiporder_#.xml file created in the D:\temp folder?
r i k r a
E on-t
Stepn 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

POProcessing composite application.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 229


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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:
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Part 2: Implementing Parallel Processing with a Flow Activity


This part is illustrated by the following image:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
ca rab l e
e rdepends
a M nsfe on the completion of part 1 tasks. If you do not have enough time,
Note: Part 2
ik consider
then
Erworkspace- t r adeploying the solution projects from the POApplication.jws
nonand composite applications. The changes you make to the POProcessing
in the D:\labs\soln\lesson09\POApplication folder for part 1
services
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Application Navigator. For example:

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


required for Practice 9-2 through Practice 9-4.

s a
To complete the deployment tasks, perform the following steps:
) h a
1) On the JDeveloper Application Navigator, open the ADFBCApplicationoworkspace m
file, from the D:\labs\files\ADFBCApplication folder.aUse i d eฺ
ilฺcthe following
steps: g m t Gu
o @ d e n
a) On the JDeveloper Application Navigator, click
c a d
the t u
pull-down menu containing
r
the POApplication (or files) application name,
e and S
iselect
s Open Application.
ฺ m
in use t h
zm
a ฺ ja e to
( e rik ens
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 232


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
2) Deploy the InternalStoreSDO project, i n
by
ฺm e ththe following steps:
performing
a zm o us
a ฺ j
a) In the Application Navigator, click
e t Application Menu and select Deploy >
the
i k s
o (er licen
InternalStoreSDO_InternalStoreSDOProfile > to > soaserver

r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 233


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

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


successful.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
3) Deploy the OnlineStoreSDO project, iby n m e ththe following steps:
ฺperforming
a) In the Application Navigator, j a zclick t us
m theoApplication Menu and select Deploy >
k a ฺ e
i
OnlineStoreSDO_OnlineStoreSDOProfile
er licen s > to soaserver
b) In the Select o (
r c ad Deployment
b l e Targets window, select soa_server1 and click OK.
c) In e
M f e ra – Log” window, monitor and verify that deployment is
the “Deployment
i ka successful.
an s
r -
E 4) Inothe t r
n JDeveloper window, select File > Save All to save changes to the application
nworkspace 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Refresh to ensure the deployed applications become visible.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
b) Expand the InternalStoreSDO_InternalStoreSDOProfile
d o @ andden
OnlineStoreSDO_OnlineStoreSDOProfile entries,
r c tu that the service entry
a andSverify
e
points InternalStoreService and OnlineStoreServiceisare present, respectively.
ฺm e th
i n
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
6)ika
Test the a n sf
M InternalStoreService with the Test Web Service tool in JDeveloper. Use the
Er following
- t r steps:
na)onOn the Resource Palette, right-click the InternalStoreService entry, and click Test
Web Service.

Oracle SOA Suite 11g: Build Composite Applications 235


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
rca while S tu
Note: JDeveloper displays the followinge message is sending the message and
waiting for the response. ฺ m
in use t h
z m
a ฺ ja e to
( e rik ens
d o l e lic
In e
c) M
rca eAnalyzer:
the HTTP rab # window (where # is a message request number) confirm
s f
r i ka that rthe
a nresponse (in the right window pane) displays the ProdId SKU101 and
-t value 5. Use the following image as a guide:
E onQuantity
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e r ca s Stu
c) In the HTTP Analyzer: # window (where
i n ฺ hi request number) confirm
m # isea tmessage
that the response (in the right window
z m u s displays the ProdId SKU101 and
pane)
a o
Quantity value 6. Use theฺjfollowing timage as a guide:
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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 a
operations and ensure appropriate responses are returned.
h a s
m )
To complete this task, perform the following steps: l ฺ o
c ideฺ
i
a Gu
Copy the InternalStore Project into the POApplication g m t
Workspace
o @ e n
In this section you copy the InternalStore compositecapplication
r ud into your
ad Stproject
POApplication workspace folder, and open the project
ฺ m e tinhthe is POApplication.
i n e
1) Open a Windows Explorer window,
j a zmandtcopy
o ustheto the
D:\labs\files\InternalStore ฺ folder
r ika ense folder.
D:\labs\mywork\POApplication
e
o ( ic the InternalStore project in the POApplication
lopen
d
2) In the JDeveloper
a ab l
window,e
e
workspacercby using
e r the following steps:
M s f
i kaa) In-tthe n
aApplication Navigator, click the application names on the pull-down menu
E onandrselect
r POApplication.
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
l ฺ
a) Is the checkStock operation a synchronous or an asynchronous iinteraction?
b) Which InternalStoreService operation is used to determine g mtheaavailable
t G u
stock
o @ e n
level for a specific product?
r c ad Stud
c) Which InternalStoreService operations can
ฺ m e be used
t h isto update stock quantity
values in the underlying table? in
zm u se
Note: The SOADEMO a ฺ ja in the
schema e o Database 10g XE instance contains a
tOracle
( e rik ens that maintains the product quantity values. You
table called INTERNAL_STORE
can use a d
the
o le lic Line tool (in Start > Programs > Oracle Database 10g
SQL Command
erc fEdition
Expression
M e rab menu to start SQL*Plus), or the SQL Worksheet in
i ka JDeveloper
a n s to query the database table.
r r
-t for step 3
E SteponAnswers
a.
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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):

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e) What does the <case inStock> branch condition rca test,isand u are the actions for
Stwhat
each of the condition outcomes? e
ฺm e th
i n
Step Answers for step 5
ฺ j a zm to us
a. The Invoke_checkinstore
r i k a invokes s ethe getInternalStoreView1 operation.
(e the Invoke
Hint: Double-click c n
e activity to view the settings.
Note: The o l i
d ble a product ID as the input message and returns the
operation accepts
r c a
product
M e ID fand e raquantity available from the database (INTERNAL_STORE table).
i k input a s
b. a The Assign_prodid
n to thecopies the prodId element from the first product element of the
r
E on- t r structure request message used by the invocation of the
n 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


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-
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
product that is out of stock is encountered. You also have to modify the XPath expression
s a
) h a
in the Assign_prodid and Assign_prodinstock copy operations to dynamically access the
nth element in the XML array structure.
o m
c according ฺ
6) In the ManageInventory.bpel window, restructure the BPEL i l
a Gu ฺ
flow i d e to
the following image: m
g nt
d o @ de
r c a S t u
m e h i s
m inฺ use t
ฺ j a z to
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 242


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
element in the input XML structure. Use the following image as a guide:
s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
Hint: Use the count Mathematical Function in the XPath Expression Builder. Use the
s a
following image as a guide: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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',
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

'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:

bpws:getVariableData('n') > 0 and s a


bpws:getVariableData('inStock') = true() ) h a
o m
ฺc ideฺ
Note: Remember the Assign_initialize has already preset inStockatoilthe value
g m image G u
true() to ensure that you enter the while loop. Use the following
@ e n t as a guide:
o
ad Stud
r c
e this
ฺ m
in use
z m
a ฺ ja e to
( e rik ens
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k tra expression should resemble the following:
Eri Your
o n -XPath
n/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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
Note: The simplest way to change
j a zm
t o usExpression is to select the digit 1
the “From”
between the square brackets
k ฺ
a and replace
e it with the highlighted text
position()=$n. r i n s
o (e lice
d morebAssign
12) You requireaone
c le activity in the While sequence to decrement the value
of the e r a
r a value of one at the end of the loop. Use the following image as
neby
a
a
M variable
guide: n s f
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
a zm o us
Note: The “From” Expression
a ฺ j t
shoulderesemble the following example:
r i k n s
o (e lice – 1
bpws:getVariableData('n')
r c ad able
Mthee fer
14)
r i a ns to your BPEL process and POApplication workspace.
k -trachanges
Save
E on
Modify
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
17) In the ManageInventory.bpel Design window, expand and configure the ) h a
m
Pick_operation to have two onMessage branches and delete the onAlarmobranch.
c ideฺ
i l ฺ
ma t GonMessage
Hint: Click the Add OnMessage Branch icon ( ) to create an additional
branch. Use the following image as a guide: g u
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 249


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
r a following
If you require help to perform this task, performcthe S tusteps:
e thisicon.
ฺm ebranch
a) Double-click the first (left-most) onMessage
i n
b) In the OnMessage Branchja zm configure
window,
t o us the following settings:

e r ika ense
Partner Link: manageinventory_client (Click the Browse icon to select
the partner link)(
d o l e lic
e rcainputVariable
Operation:
Variable:
checkStock
e rab (Click the Browse icon to select the variable)
a M s f
ik -tran
Er19)
Click OK.
on the second (right-most) onMessage branch to be associated with the
nConfigure
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

'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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
22)nIn 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


Practice 9-2: Modify InternalStore with Pick and While Activities
(continued)

Use the following image as a guide:


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

s a
) h a
o m
c ideฺ
i l ฺ
ma thetstring
23) Configure the Assign_checkstock with a copy operation that stores
g G u literal
d o @ den
‘check’ in the operation variable. Use the image as a guide:

e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 252


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
25) Save the changes to your BPEL process. i n ฺm e th
ฺ j a zm to us
Modify While Loop with
e r ikatheenacquireStock
se Operation Activities
The While loop needs (the Assign_prodinstock
lic to be executed when the operation=check,
d
a ab
and different activities
o whenl eoperation=acquire. To make this change you add Switch
r c r loop, with a conditional expression on the operation variable and
a Meits <case>
activity, into
configure
the While
n s f eand <otherwise> branches with appropriate activities for each
r i k - t r a
E operation.
non

Oracle SOA Suite 11g: Build Composite Applications 253


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
27) Expand the Switch_operation to structure thee<case>rca branch S u <otherwise> branch
tand
as described by the following steps:
i n ฺm e this
a) Drag the Assign_prodinstock a m ointousthe <case> branch.
zactivity
ฺ j t
a addsthee following
e i k
b) In the <otherwise>rbranch, n activities in the sequence listed:
(
o Assign i c e
lactivity
i) Dragaadnew l e renamed to Assign_updstock.
r c b
raInvoke activity renamed to Invoke_updstock.
Mii) eDrag a fnew
e
i ka -tran s
r
E on
n

Oracle SOA Suite 11g: Build Composite Applications 254


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
( branchlicname to operation=check and set the conditional
28) Configure the <case>
o
expression to
c d
a abthatlethe operation variable is equal to the literal string
ensure
r
Me nassshown
'check',
a fer in the following image:
k
Eri on-tra
n

Note: The conditional expression should resemble the following text:

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

Oracle SOA Suite 11g: Build Composite Applications 255


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

required variables as Global Variables. Use the following image as a guide to the
Invoke settings:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
30) a Configure f
M nthesAssign_updstock with the following two copy operations:
r i k r a
E on-t
n

Oracle SOA Suite 11g: Build Composite Applications 256


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
Note:
e rcToasetethe
r b XPath expression for the nth product, perform the
acorrect
M f
followingssteps in the “From” section:
ka i)-trSelect
n
E on a the Type as Variable.
r i
n 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


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_OutputVariable. Copy the result of
this expression to the quantity in the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Invoke_updstock_updateInternalStoreView1_InputVariable. Use the following


image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
ca rab l e
e r
Return
a s fe
M thenacquireStock Response Message
k ra the final change you make to the ManageInventory BPEL Process is to
i this section
ErIn
create
o n
one
- tmore Switch activity to manage the different responses sent to the client using
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
n
33) Expand the Switch_response activity iand ฺmconfigure
e h <case> branch conditional
tthe
j a zmvariable
expression to check if the operation
t o uissequal to the literal string ‘check’. Use

e r i a ense
the following image as akguide:
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 261


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika enseactivity
36) Configure the callbackClient_fulfilled to invoke the manageinventory_client
o (
partner link with the acquireStockResponse
l i c callback operation and use

r c adas Input
outputVariable
a b levariable. Use the following image as a guide:
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 262


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
38) Close the ManageInventory.bpel
z m window u s and the InternalStore
composite.xml file. Save
a a o
ฺjchangesetot your BPEL process and POApplication
workspace. e r i k ns
(
o le li c e
a d
M erc ferab
r i ka -trans
E on
n

Oracle SOA Suite 11g: Build Composite Applications 263


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

a
Note: The difference in the OnlineStore, as compared to InternalStore assembly )mode, hasis
that the external reference is for the OnlineStoreService (another ADF-BCcserver
l ฺ om thateฺyou
deployed earlier in these practices). The OnlineStoreService queries and
m ai manages
G u iddata in
the ONLINE_STORE database table.
@ g nt
a d o t u de
To complete this task perform the following steps: e r c s S
m h i
1) Open a Windows Explorer window, and
m inฺcopyusthee t
D:\labs\files\OnlineStore
ฺ j a z folder
t o to the

e r ika ense folder.


D:\labs\mywork\POApplication
2) In the JDeveloper o ( ic the OnlineStore project in the POApplication
window,lopen
d
a usingathe l e
workspace
M e rcby
f e r b following steps:
i kaa) In a n s
the Application Navigator, with the POApplication selected click the
r
E on- t r
Application Menu and select Open Project.
nb) 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


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?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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?
Answers for step 4 s a
h a
a. Yes. The process contains a Pick activity, with two onMessage branches at the start
)
o m
of the process. One onMessage branch is for the checkStock operation and the other
c ideฺ
is for the acquireStock operation. i l ฺ
g ma t Gu
In addition, the process provides two “callback (invoke)” activities at the end of the
o @ den
process. Scroll to end of the process design, and if required expand the
d
rca is Stu
Switch_operation activity. One callback is called callbackClient activity, which is
e
i n ฺm e th
for the checkStockResponse operation and the other is called

j zm to us
callbackClient_fulfilled, which is for the acquireStockResponse operation.
a
Note: The callback activities are contained in the last Switch activity (called

e r ika ense
Switch_operation) of the ManageStock BPEL process. You may need to expand the
( lic
Switch_operation activity to view the callback activities.
o
d l e
e rca erab
b. The Assign_prodid activity copies the first prodId element from the XML array in
the inputVariable to the request message for the Invoke_checkstore activity.
a M nsf
k Note: The Assign_prodid copy operation must be modified to dynamically access
Eri on-tra
the product XML array using the [position()=$n] condition added to the
n 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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',
'/ns2:StoreRequest//ns2:product/ns2:qtyOrdered') < 0 s a
h a
This XPath expression eliminates the need to loop through all the productฺcqtyOrdered o m) ฺ
a l
iactivity toid
e
elements. This approach was chosen because when you add the FlowN
m tG u process
multiple products you need an array of elements to track which g productsnare in stock. It
o @ e
does not makes sense for multiple FlowN branches to update
r
variable as was done in the While loop of the InternalOrder c ad composite
S tud BPEL
a solitary (single) inStock

implementation, otherwise the results could ฺ


bem e thdepending
incorrect
is on the order of flow
m
branch processing and the outcomeszdetermined
i n s
by
e
the activities performed.
j a t o u

Therefore, you make useeof r iktheaarray
e n e
ofsproduct elements already present in the
inputVariable to tracko (the new lvalue
ic for the acquireStock update operation in addition to
d l e
rcato determine
using the values
e e rab if products are out of stock for a checkStock operation.
M f
r i ka -tranasFlowN Activity to Products Multiple Products
Implement
E In thisonsection, you modify the ManageStock BPEL process by creating a variable n of
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

the settings:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
(
6) In the ManageStock.bpel
o l ic Design window, drag a FlowN activity before the
d l e
e rca eraactivity.
Scope_stockprocess b Use the following image as a guide:

a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o
Alternatively, ( the lfollowing
enter ic expression into the N field:
a d l e
M erc ferab
count(bpws:getVariableData('inputVariable', 'payload',
k a n s
'/ns2:StoreRequest/ns2:product'))
Eri on-tra
nb) 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
r a
Note: The Scope_stockprocess
ikimage e expands when your drop it into the
sactivity
(
sequence above. e
The c e n
shows the scope in a collapsed state for readability.
o l i
c ad toayour
10) Save therchanges b leBPEL process.
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 269


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

element of the inputVariable. Use the following image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
12) In the ManageStock.bpel
e r ika eDesignn sewindow, double-click the Assign_newqty
activity and modify
o ( the copylicoperation by replacing the [1] string in, both the
c d
a aand
“From” Expression b lethe “To” XPath expression, with the [position()=$n]
r er
a MeUsenthesffollowing
string. image as a guide:
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 270


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 271


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
14) Close ManageStock.bpela
j and
t o us
zmcomposite.xml windows, and save all

changes.
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 272


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
Note: Monitor the “Deployment – Log” window to ensure deployment is successful. s a
h a
)project
3) To deploy the OnlineStore composite application, right-click the OnlineStore
o m
c ideฺ
node and select Deploy > OnlineStore > to soaserver. In the SOA Deployment i l ฺ
Configuration Dialog, click OK.
g ma t Gu
Note: Monitor the “Deployment – Log” window to ensure o @deployment
d e n is successful.
d tu that you have
Note: Now that the composite applications are deployed,
e rca ifisyouStrust
ฺm and
correctly and successfully created the InternalStore
inrest e h
tOnlineStore composite
applications, to save time you can skipm
z the of
u s
this practice and start with instructions
for the practice titled “Add a Flow
a a t o
ฺj to theeFulfillment BPEL Process” in this lesson.
i k s
Query the InternalStoreo (er land i c enOnlineStore Database Tables
In this sectionr c adperform
you a b e SQL queries to view the existing stock for three of the
ltwo
products
a Mthee database
s f ertables for the InternalStore and OnlineStore. The database tables
ik are
Erqueried - t r an INTERNAL_STORE and ONLINE_STORE, respectively.
called
n JDeveloper window, execute a query on the INTERNAL_STORE database
othe
4) nIn
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
Note: Ensure that the cursor is placed in or at the end ofg
ma t Gu
the SQLnstatement.
d) In the Select Connection window, select thec a do@ tude
soademo(POApplication)
connection, and click OK. e r i s S
m
inฺ use t h
a m
z to
ฺ j
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k raint_store_query.sql (SQL Worksheet) window, you can observe
Eri e)onIn-tthe
n 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
Note: Verify the following SQL statement is executed:
d o @ den
Select * from online_store rca S tu
where prod_id in ('SKU101',
e
ฺm 'SKU102',this 'SKU200');
i n e
j a zm select
c) In the Select Connection window,
t o uthes soademo(POApplication)

connection.
e r ika ense
( lic
d) In the onl_store_query.sql
o (SQL Worksheet) window, you can observe
a d
c rab
the query results l e
displayed in the Results tab below the pane containing the
e r
a M n fe
SELECTsstatement. Use the following image as a guide:
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
10) On the “InternalStore [1.0]” Test Web Servicerpage, ca under S tuRequest tab Input
the
Arguments section, select the XML viewฺm e
and replace
t is XML data with the contents
hthe
i n
m o us
of the file D:\labs\files\xml_in\prod-in-store.xml, e and click Test
Web Service. ฺj a z t
Note: You can find this r i k a
file in the s e
files > Application Sources > xml_in folder in the
( e c e n
o lenavigator
JDeveloper Application
d li window with the files application selected.
a
a) Onethe
M
rcResponse
f e rabtab, click the Launch Message Flow Trace link.
i s Trace page, click the ManageInventory BPEL component link.
kab) On-trtheanFlow
r
E onNote: You might need to refresh the page until you observe the following results
n 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o
ii) Optionally, if you are interested, expand other flow activity entriesm
c iexamine
to
the flow execution sequence, and verify that each time theailฺ d eฺ
m int G
InternalStoreService is invoked with each product Idgsupplied the
u
inputVariable. d o @ den
rctoathe Test
S tu Service page.
d) Close the Flow Trace Web page, and return
ฺ e
m e this Web
11) On the “InternalStore [1.0]” Test Web i n
m inService spage, click the Request tab again, and
modify the qtyOrdered element j a z
value t o
the
u
second product (prodId value SKU102)
a ฺ e
rik TesteWeb
to the value 10, and Click
( e ns Service. For example:
d o le li c
a
M erc ferab
r i ka -trans
E on
n

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

Oracle SOA Suite 11g: Build Composite Applications 277


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
i) What is the response in the status element of the callback? s a
Answer: It should be out-of-stock, as shown in the following image: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k Note:
a For a degree of simplicity in the application scenario, the BPEL process
Eri on-trreports an out-of-stock status if any one of the ordered products cannot be
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
D:\labs\files\xml_in\prod-in-store.xml file, and click Test Web s a
) h a
Service.
o m
c ideฺ
a) On the Response tab, click the Launch Message Flow Trace link. i
a Gul ฺ
Note: In the Flow Trace tree there should be six rows ofgthe mInternalStoreService
t
present. o @ e n
b) On the Instance of ManageInventory Audit r c
Trail
tuddown and expand
adpage,Sscroll
ฺ m
the <payload> for the callbackClient_fulfilled
e activity
this at the end of the flow.
i n e
c) What is the response in the j a zm element
status
t o usof the callbackClient_fulfilled?
a ฺ
Answer: It should be
e r ikfulfilled,
e n se as shown in the following image:
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

| s a
h a
Note: The product quantities should be less than 5 for each of the listed products.
)
There should be two SKU101 products available, three SKU102 products, and
o m
c ideฺ
four SKU200 products. i l ฺ
g ma t Gu
c) Close the int_store_query.sql window.
d o @ den
Test the OnlineStore checkStock Operation e rca is Stu
m e th
inฺhome
15) On the Oracle Enterprise Managerm
z SOA
u spage, expand the SOA folder in the
a o
Farm navigator, and click theฺj“OnlineStore
a t [1.0]” link.
i k
r page, s e
o (e[1.0]”
16) On the “OnlineStore
l i c enclick Test.
ad ab[1.0]”
17) On the “OnlineStore
r c le Test Web Service page, ensure that the Operation selected
Me nsffor
is checkStock,
a erexample:
k
Eri on-tra
n

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


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

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.
i) What is the response in the status element of the callback? s a
Answer: It should be in-stock, as shown in the following image: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k a
Eri onii)-trOptionally, if you are interested, expand and examine the flow created by the
FlowN activity. Verify that each branch of the FlowN processes a different
n product Id supplied from the inputVariable.
d) Close the Flow Trace Web page.

Oracle SOA Suite 11g: Build Composite Applications 281


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
a) On the Response tab, click the Launch Message Flow Trace link.lฺc o m ฺ
i i d e
b) On the Flow Trace page, click the ManageStock BPEL component
g ma tlink.G u
Note: The OnlineStoreService reference row appearso @ e
three times.
d n
d
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri c)onOn-trthea Instance of ManageStock Audit Trail page, scroll down and expand the
n
<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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

<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
operation. s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
20) On the “OnlineStore
o ( [1.0]”lTest
ic Web Service page, click the Request tab again and
d l e
e r a XML
replace allcthe
e r ain
b the XML View with the data fromfile,
D:\labs\files\xml_in\prod-in-store.xml
the
and click Test Web
a M s f
kService. n
Eri a)onOn-trthea Response tab, click the Launch Message Flow Trace link.
n Note: In the Flow Trace tree six rows of the OnlineStoreService present.

Oracle SOA Suite 11g: Build Composite Applications 283


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?
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

s a
) h a
c) Close the Flow Trace window. o m
c ideฺ
i l ฺ
a the G
21) In the JDeveloper window, execute the SQL statement to verify that
g m u
quantity
values for the products ordered from the ONLINE_STORE @database
e t
ntable have been
decreased. Use the following steps: d o d
e r ca s Stu
a) In the Application Navigator, in the files
i n ฺ t hi under the files >
m eapplication
Application Sources > sql folder,
z s onl_store_query.sql and
m andoright-click
u
select Open. Alternatively,
a ฺ j a t
double-click the file name.
e
rik ens window, click the Execute Statement icon
o e
b) In the onl_store_query.sql
( ic soademo connections. Verify that you obtain the
lthe
( ), and d
select anyl e
of
e rca results
following
e rabin the Results tab:
M f
r i ka -trans
E on
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
c) Close the onl_store_query.sql window.
g ma t Gu
23) In the Application Navigator, select POApplication d o
name@from the
d e n
application pull-
down menu.
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 285


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
rca eractivities
Note: The InternalStore
theefollowing
brevityM a and
b OnlineStore composite applications are asynchronous. For
are not illustrated in diagram within the Switch:
a s f
n activities that prepare requests for the invocation of the acquireStock
k• The-tra
Assign
Eri onoperations.
n• 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
c. Create Partner Link Observe that the WSDL URL is populated and the a
a s
Name and Partner Link Type. Make the following
h
changes to settings: m )
ฺ o
c ideฺ
Name: Replace ManageInventory with
l
i
InternalStore
g ma t Gu
d o @ den
Partner Role: Select
rca is Stu
ManageInventoryProvider
e
My Role: Select ManageInventoryRequester
ฺm e th
i n
Click OK.
s
d. Fulfillment.bpel jazm o uVerify that the InternalStore partner link icon has
ฺ t
Design
e r ika ensebeen added into the right-hand column.
a) o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 287


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
c) e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

d)

Oracle SOA Suite 11g: Build Composite Applications 288


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Resource Palette, select the File System option and
s a
h a
select the Resource Palette again to refresh the list of
)
SOA entries displayed. o m
c ideฺ
i l ฺ
c. Create Partner Link
g ma t Gu
Observe that the WSDL URL is populated and the
Name and Partner Link Type. Make the follow
o @ den
changes to settings:
d
rca is Stu
Name: Replace ManageStock with OnlineStore
e
i n ฺm e th
Partner Role: Select ManageStockProvider

ฺ j a zm to us
My Role: Select ManageStockRequester
Click OK.
d. Fulfillment.bpel e r ika ense Verify that the OnlineStore partner link icon has been
Design do
( lic added into the right-hand column.
l e
a) e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 289


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
c)
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

d)

4) Save the changes to your Fulfillment BPEL Process.

Oracle SOA Suite 11g: Build Composite Applications 290


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s a
) h a
Use the following image as a guide:
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
11) First, to configure the Invoke_internalstore
i n ฺmactivity,
e thdouble-click the
Invoke_internalstore activity and m o ituwith
zassociate s the InternalStore with the
ฺ j a
aEnsure that t
checkStock operation.
e r ikLocal e n seyouUseuse the Automatically Create Input
o (
Variable icon to create a
l i c Variable. the following Create Partner Link

r c ad able
image as a guide:

a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 292


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Invoke_internalstore_checkStock_InputVariable payload for


the target. Enter the name xsl/Transformation_internalstore for the
Mapper File and click the Create Mapping icon:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
b) In the Transformation_internalstore.xsl
c a ab window, expand the source
r
e andfedrag
column r the item element to the product element in the target column.
a M s
r i k -tran
Use the following image as a guide:
E on
n

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

Oracle SOA Suite 11g: Build Composite Applications 293


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e) Save the changes to your project, and close
e ca s Stu
rthe
Transformation_internalstore.xsl
i
ฺm e thwindow.
i n
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 294


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 295


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
15) Save the changes to the
e r ka nsBPEL
iFulfillment e Process.
o ( l ic e
d l e
a ab in the Flow Branch for the Online Store
ConfigurecActivities
e r erright branch of the Flow activity you create an asynchronous
In this M
a f
section, insthe
ik -trpattern
Erinvocation an using an Invoke with the OnlineStore checkStock operation, and a
nonthe
Receive
prepare
with the checkStockResponse operation. You also create a Transform activity to
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


Practice 9-5: Add a Flow to the Fulfillment BPEL Process
(continued)

Use the following image as a guide:


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

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
rca is SthetuInvoke_onlinestore
17) To configure the Invoke_onlinestore activity,edouble-click
n ฺm withe the
activity and associate it with the OnlineStore
i thcheckStock operation.
zm Create
Ensure that you use the Automatically s Variable icon to create a Local
uInput
ฺ j a t o
a CreatesPartner
Variable. Use the following
r i k n e Link image as a guide:
o (e lice
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Mapper File and click the Create Mapping icon:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
b) In the Transformation_onlinestore.xsl window, expand the source
column and drag theik
r a element
item seto the product element in the target column.
e
( Preferences e n
c) In the Auto o
d Map
l e lic window, accept the default settings and click OK.
therc
d) In e
a ab
Transformation_onlinestore.xsl window, expand the source
M f e r
i and
ka -tran s
target elements and verify your mapper file resembles the following image:
r
E on
n

Oracle SOA Suite 11g: Build Composite Applications 298


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

checkStockResponse, and click the Automatically Create Variable icon to


create Local Variable with the default name provided. Use the following image as a
guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 299


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
21) Save the changeso ( Fulfillment
to the e lic BPEL Process.
d l
e rca erab
M nthe
Configure
a s f Switch to Select the Store that Fulfills the Order
k tra you configure two <case> branches to check if the responses from each
i this section
ErIn n -
noare in-stock. The left-to-right visual order of the <case> branches are important,
store
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
h a
23) Configure the left-most Switch Case settings to check the response in the m)
Receive_internalstore_checkStockResponse_InputVariable by performing i l ฺ co theideฺ
following steps: g ma t Gu
a) Double-click the <case> title section on the left-most o @ e n
<case>dbranch.
d
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ewindow,n se
o (
b) In the Switch Case settings
l i c set Name to internalstore=in-
stock a
c d buildbanleExpression that compares the status element in the
and
r
e fera
Receive_internalstore_checkStockResponse_InputVariable with the string 'in-
a Mstock'.n sUse the following image as a guide:
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 301


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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


and build an Expression that compares the status element in the
Receive_onlinestore_checkStockResponse_InputVariable with the string 'in-
s a
stock'. Use the following image as a guide: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
For additional instructions,
r i k ause the sfollowing
e steps:
a) To create activities
n
(e in thelic<case
e internalstore=in-stock> branch perform the
following
o
adsteps:able
r c
e anfeAssignr activity into the left <case> branch and rename it to
a M
i) Drag s
k an
Eri on-trAssign_acquireinternal.
n 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
Note: For simplicity, activities that check the response in messages returned from the s a
) h
acquireStockResponse operation are not included. For now assume that the products are
a
successfully acquired and the order fulfilled. o m
c ideฺ
i
a Gul ฺ
28) To configure the Invoke_acquireinternal, set the Partner Linkg m
to InternalStore,
t Variable
Operation to acquireStock, and for Input automatically o @ createea nLocal
with the default name provided. Use the imagerasc aa dguide:Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 304


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

populated by the Transform_internalstore activity.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n m e th
ฺthe
b) In the second copy operation, assign
z s string 'completed' to the
mUseotheuliteral
a ฺ j a
shipStatus in the outputVariable. t image as a guide:
rik ens e
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 305


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic BPEL Process.
d l e
e rca erab
31) Save the changes to the Fulfillment

a M Activities
Configure n s f in the <case onlinestore=in-stock> Branch
r i k t r a
- you configure the Invoke_acquireonline to use the acquireStock operation
E In thisonsection,
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
( lic
33) To configure theoAssign_acquireonline, create two copy operations using the
d l e
r a erab
followingcsteps:
e
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 307


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

by the Transform_onlinestore activity.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
m the
zassign s
uliteral
j
b) In the second copy operation,
a ฺ a t o string 'completed' to the shipStatus
i k
in the outputVariable. Use the s e
image as a guide:
o (er licen
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 308


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( l ic
d l e
e rca ertoathe
35) Save the changes b Fulfillment BPEL Process.
a M Activities
Configure n s f <otherwise> Branch
r i k t r a
- you configure the Assign_waiting activity in the <otherwise> branch to
E In thisonsection,
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
a Design
37) In the Fulfillment BPELikProcess
r se window verify that the Switch_selectstore
e
( following
activity resembles the e n
d o l e lic image:
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 310


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g
b) In the Fulfillment.bpel Design window, select the ma onlinestore=in-
“<case t G u
stock>” branch. d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k c) In the Fulfillment.bpel Design window, at the bottom-left side of the
-tra click the Source tab.
Eri onwindow
n

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


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_...”
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
the “<switch name="Switch_selectstore">” element): s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d
ca rab l e
e r
a n s fe
In the Fulfillment.bpel
g) M Source window, after dragging the internal store
k -trathat the “<case
Eri onverify
<case> branch the Source window automatically expands the code and you can
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
s
outputVariable. In the <case> branch check if the shipStatus is ‘completed’ and execute
a
) h a
the Scope_shiporder activity.
o m
c ideand ฺ
i l
39) In the Fulfillment.bpel Diagram window, collapse the Scope_checkstockฺ
Scope_shiporder activities. g ma t Gu
oa@ d e n
40) In the Fulfillment.bpel Diagram window, a
c d
drag Switch
t u activity between the
r
Scope_checkstock and Scope_shiporder activities.
e Rename S
is the Switch to
Switch_orderstatus. ฺ m
in use t h
zm
a ฺ ja e to
( e rik ens
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
r c a S tu
e
ฺm e this
c) Drag the Scope_shiporder into the <case order completed?> branch. Use the
following image as a guide: i n
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 314


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
i k tra
Er43) n -
o changes to the Fulfillment BPEL Process.
nSave

Oracle SOA Suite 11g: Build Composite Applications 315


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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.
s a
3) In the SOA Deployment Configuration Dialog, select the “Overwrite any existing
) h a
composites with the same revision ID” option, and click OK.
o m
c ideฺ
l
Note: Monitor the “Deployment – Log” window to ensure deployment is successful.
i ฺ
4) In a Web browser window, login to the Oracle Enterprise Manager g ma page t G u
(URL
http://localhost:7001/em), as the user weblogic with o @ dwelcome1.
password e n
d
ca expand tu
5) On the Oracle Enterprise Manager SOA home e rpage, S
is the SOA folder in the
Farm navigator, and click the “POProcessing ฺ m
in u[1.0]” t h
zm se link.
Test an Order Fulfilled a
byฺ jathe Internal
e to Store
e ik ens
rpo-medium-ipod.xml
In this test you submit
o (
the l ic for processing and verify that the
order is fulfilled d l e
aby theaInternalStore,
b and verify that the stock quantity levels for the
products e rchas
order r
been decreased.
a M nsfe
k ra
Er6)i In the tJDeveloper
n -
internal and online
window, first display the current stock quantity levels for the
stores by performing the following steps:
no
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:
a) What is one indicator that can be used to quickly tell if the order was fulfilled?
s a
h a
b) Which store was selected to fulfill the order? Explain your answer. m)
Answers for Step 8. i l ฺ co ideฺ
mawith ta JMS
a. A quick indication that the order was fulfilled is to locate agrow G uAdapter
component being executed. This indicates that the ordero @was shipped,
d e n and therefore
d
a example: tu
e rcFor
it must have been fulfilled by one of the stores. S
i n ฺm e this
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 317


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k tra
Er9)i On n -
o the Flow Trace, verify your answers by clicking the Fulfillment BPEL
nComponent 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
cmessage: ฺ
In the Web browser window that is opened you can view the response i l ฺ i d e
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
b. The result return is in-stock.
m result
zThe s from the InternalStore is
ureturned
ฺ j a t o
determined by clicking
e r ikthea Receive_internalstore
e n se activity icon. In the Activity
( the l“View
Details window, click
o ic xml document” link:
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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

Oracle SOA Suite 11g: Build Composite Applications 319


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 320


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ikadisplay
e n sthee updated stock quantity levels for the internal
o (
10) In the JDeveloper window,
lic the following steps:
d
and online stores by e
performing
l
e rca erab
a) M
a n s f
In the ipod_query.sql window, click the Execute Statement icon ( ), and
k -trathat you obtain the following results in the Results tab:
Eri onverify
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
f) On the Web page that is opened the response from the online store is in-stock s a
for example: ) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
13) On the JDeveloper ipod_query.sql tabbed
a clickSthe
rcpage, tuExecute Statement
e thisthe product quantities by a
ฺmhas reduced
icon and confirm that the ONLINE column i n s e
ฺ j zm toanduSKU304
value of 5 for the two productsaSKU303 from 8 and 7 to the values 3
and 2, respectively. Useik
r a following
the seimage as a guide:
( e e n
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k aIf you examine the rows under the Fulfillment BPEL Component you can
Eri Answer:
see
o n - trthere
that is no instance for a JMS Adapter service. This indicates the order was
nnot 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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
b. The response received from the online store is out-of-stock, i l ฺ
aas expected.
g mand G u To
view the response, on the Audit Trail tabbed page scroll down
@ e n t
click the “View
o
ad Stud activity. For
XML Document” link that appears below the Receive_onlinestore
example: r c
e this

in usem
zm
a ฺ ja e to
( e rik ens
d o l e lic
e rca erab
a M nsf
k
Eri on-tra
n
The following XML response message is displayed in another Web page:

Oracle SOA Suite 11g: Build Composite Applications 325


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

example:

The following XML response message is displayed in another Web page: s a


) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
d. No. The quantities for the product with the ID c
r ofaSKU305 have
S tu not been changed.
Note: The po-large-ipod.xml order
ฺ e
mrequested
t haisquantity of 20 for the product
with ID of SKU305. Neither store i n
mhas enough e
squantity to fulfill the order.
a z o u
k a ฺj e t
i s
o (er licen
r c ad able
a Me nsfer
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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


verify that you see following results:

s a
) h a
o m
c F11,idtoeฺ
d) In the ipod_update.sql window, click the Commit icon orilpress ฺ
ma t Gu
commit the database changes performed by the UPDATEgstatements.
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e) In the ipod_query.sql
e r ika ewindow,
n se click the Execute Statement icon ( ), and
( soademo
select any ofothe licconnections. Verify that you obtain the following
d l e
e rcinatheeResults
results
r a b tab:
a M nsf
k
Eri on-tra
n

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


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


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

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:

s a
) h a
The changes to the assembly model include: c o m ฺ
i l ฺ i d e
• Create the CheckCCLimit BPEL Process component
• Create new wire between the ValidateCreditCard Mediator g manda CheckCCLimit
t G u
BPEL Process components. d o @ den
• Create a new wire between the CheckCCLimit rcaBPEL S tu and
Process
CreditCardDBService.
e
ฺm e this
i n
Note: When creating new wires from
j a zm
t o uscomponent you also need to create
the Mediator
new transformation files. In this ฺ case, youealso configure filters to ensure you direct the
appropriate cards to the e r ikatarget
correct e n s
service.
o ( l i c
r
You create the c ad able BPEL Process implementation to invoke the
CheckCCLimit
Me nsferto get the credit card status and its credit limit, and check if the
CreditCardDBService
a
ik total-trexceeds
Erorder a the credit limit. This is illustrated in the following image:
no n

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

Oracle SOA Suite 11g: Build Composite Applications 328


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
The ApproveCCOrder BPEL process zm s and sets the order status in the
ufault
handles the
outputVariable response messageฺ j a
a to indicate t o
r i k n s e the order is rejected.
o (e lice
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 329


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

• 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
start with the digits “9000” are sent to the BPEL process and all cards that begin
s a
with the digits “9000” are sent to the CreditCardDBService.
) h a
o m
Note: The implementation approach chosen enables us to retain existing functionality in
c ideฺ
l ฺ
the composite while extending the implementation with new functionality, through the
i
use of wires and appropriate filters. g ma t Gu
d o @ den
To complete this task perform the following steps: ca
r S tu
1) In the JDeveloper Application Navigator, ฺm e
ensure theth is
POApplication is the selected
i n e
application.
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M JDeveloper
2) In the
n s f Application Navigator, if needed expand the CreditCardValidation
k a folder and double-click the composite.xml to open the assembly
Eri >model
SOAtrContent
n - in the Composite Editor window.
no
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
Note: To ensure the Property Inspector is visible, select View >a
Property i eฺ
ilฺc Inspector.
d
g m t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 331


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
With the Messages section expanded and the caselected
rfault S tu
in the Port Types section,
e is
ฺm inethethMessages
the message name and its definition isnvisible section:
i
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
definition and child leaf node, which is named “error’: s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k acreditcheck.xsd and ValidateCreditCard.wsdl windows in
Eri JDeveloper.
4) Close
- the
t r
non
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


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”
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:
WSDL URL: s a
ValidateCreditCard.wsdl
) h a
Port Type: validateCC_ptt o m
c ideฺ
Click OK. i l
a Gu ฺ
a) g m t
o @ e n
r c ad Stud
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 334


Practice 10-1: Modify CreditCardValidation Composite Assembly
Model (continued)
b)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
c) e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 335


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.


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

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.
8) In the composite.xml window, create the following two wires: s a
) h a
a) Create a new wire between the ValidateCreditCard Mediator component o m
c ideฺ and the
CheckCCLimit BPEL component. i l ฺ
b) Create a new wire between the CheckCCLimit BPEL componentg ma and t G u
the
CreditCardDBService external reference. d o @ den
r c a S tu
9) In the composite.xml window, verifym e thisCreditCardValidation
that your final
ฺ image:
i
assembly model resembles the followingn e
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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

Note: Enter the expression on a single line. Use the following image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
13) In the ValidateCreditCard.mplan window, to create the filter expression for
theM s f
first routing rule section whose target is
r i kaCheckCCLimit/checkcclimit_client::validateCC
r a n perform the following steps:
E on-t
na) 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


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

s a
) h a
o m
c ideฺ
i l ฺ
c) Save the changes to the Mediator component file. g ma t Gu
d o @ den
14) In the ValidateCreditCard.mplan window,
r ca create S turequest message
the
transformation for the BPEL component by e
ฺmperforming thisthe following steps:
i n
m o us e
a) In the request section for thezCheckCCLimit/checkcclimit_client::validateCC
target, click the “Select a ฺ j a
an existing t
mapper file or create a new one.” icon ( )
r i k n s e
next to Transform
o (e Usingliccontaining
e the text “request: <<Transformation Map>>”

r c ad able
a Me nsfer
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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
Mapper window, map the source elements to its corresponding target element.
s a
Use the following image as a guide:
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
d) Save the changes to the XSLT map i n ฺmcloseetheth
and
ฺ j a zm to us
CreditCheckResponse_To_CreditCheckResponse.xsl XSLT
Mapper window. ika e
( e r
c e ns
a d o le li
16) In the ValidateCreditCard.mplan window, observe that the Mediator Editor
rc the Fault
has created
earise) bsection and already created a routing rule to return the fault (if it
rainitial
a M
should s f
to e
the caller. Create the fault message transformation for the
k ra n
Eri BPELn - tcomponent by performing the following steps:
na)o In the Faults section for the “*Initial Caller*::validateCCfault” target, click the
“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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 340


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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): a
Activity Type Activity Name Purpose h a s
m ) to
a. Assign Assign_ccinfo Copies the credit card
l ฺ onumber
c request e ฺ
i
CreditCardDBService
a Gu i d
variable.gm t
b. Invoke Invoke_ccservice o @
Invokes the e n
CreditCardDBService
d
c. Assign
d thetucredit
Assign_ccstatus rcaCopies S card status value
m e h
fromi sthe CreditCardDBService
m inฺ use response
t
variable.
d. Switch ฺj a z t
Switch_cclimito Checks if the card status is VALID
i k a s e
o (er licen and if the order total exceeds the
credit card limit returned with the
a d l e
M erc ferab CreditCardDBService response.

r i r nsactivities form the main process flow. In subsequent steps you configure
kaNote:-tThese
a
E the onsettings for each of the activities, and then add activities to throw the exception
nand propagate the exception message to the invoker of this BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 341


Practice 10-2: Create the CheckCCLimit BPEL Implementation
(continued)
Note: Your initial BPEL activity flow should resemble the following image:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
3) Save the changes to the CheckCCLimit BPEL process diagram.

Oracle SOA Suite 11g: Build Composite Applications 342


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,
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
5) Save the changes to your BPEL process.

Oracle SOA Suite 11g: Build Composite Applications 343


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Use the following image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
a m o us
zprocess.
7) Save the changes to your BPEL
a ฺ j e t
i k s
(er licen Activity
Configure the Assign_ccstatus
o
8) To configure r c adthe Assign_ccstatus
a b le activity, double-click the icon and create a single
M e f e r
i kacopy operation
a n s that copies the status element returned in the
r
E variablen - t r
Invoke_ccservice_CreditCardDBServiceSelect_OutputVariable into the status
no of the process outputVariable. Use the following image as a guide:

Oracle SOA Suite 11g: Build Composite Applications 344


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
11) To configure the <case> branch condition,
i n ฺmperform
e h following steps:
tthe
a
a) Double-click the <case>ฺbranch
j o us
zmtitletsection.
b) In the Switch Case
e r ika ewindow,
settings n se set Name to check status and
limit. do
( lic
l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 345


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k -traThe condition should resemble the following expression, showing where
Eri onNote:
n 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
)ah a
13) To configure the Throw_validateccfault activity, using the following image mas
guide: l ฺ o
c ideฺ
i
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Click OK.
a)

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
b)
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 348


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

s a
) h a
o m
c ideฺ
i l ฺ
d)
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k trachanges to your BPEL process.
i Save-the
Er14) n
no
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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
16) To configure the Catch branch to handle the validateCCfault, double-click the Catch
o m
branch icon use the following image as a guide to the settings:
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 351


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Invoke_ccservice_CreditCardDBServiceSelect_OutputVariable. Use the following


image as a guide:

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic resemble the following expression (noting the space
d
Note: The “From” valuel eshould
e rcofatheefirst
at the end rabstring literal parameter in the concat function):
M s f
r i kaconcat('Error:
-t r a n order total exceeds the credit limit of ',
E bpws:getVariableData('Invoke_ccservice_CreditCardDBServiceSele
o n
nct_OutputVariable','CreditcardsCollection',
'/ns4:CreditcardsCollection/ns4:Creditcards/ns4:creditLimit'))

Oracle SOA Suite 11g: Build Composite Applications 352


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
Note: if you require help to createzm s settings, perform the following
the Replyuactivity
ฺ j a t o
steps:
e r ika ense
a) In the Reply o ( forlicPartner Link click the Browse Partner Links icon ( ).
window,
c d
a able
b) In e r erLink Chooser window select checkcclimit_client and click OK.
a M the Partner
s f
n window, for Variable click the Browser Variable icon ( ).
k raReply
Eri c)onIn-tthe
nd) 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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

To complete the task of handling the validateCCfault, perform the following steps: s a
h a
)project
1) In the JDeveloper Application Navigator, if needed expand the POProcessing m
> SOA Content tree and double-click ApproveCCOrder.bpel tolฺopen o
c it inidthe
e ฺ
i
BPEL Editor.
g ma t Gu
Create and Configure a Catch Block on Scope_validatecc d o @ den
e
In this section create a Catch block on the Scope_validatecc
Stu
rca isscope.
i n ฺm e th
2) In the ApproveCCOrder.bpelm
j a z Designt o us create a Catch branch on the
window,

k ฺ
Scope_validatecc scope byaclicking the Add Catch Branch icon ( ) on the scope
eguide:
r i
sidebar. Use the following image n s
as a
o (e lice
r c ad able
a Me nsfer
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 354


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
If needed perform the following steps to create the Catch settings:
d o @ den
a) In the Catch window, in Faults QName, click rcathe BrowseS u icon ( ).
tFaults
b) In the Fault Chooser, expand the Partner
e
ฺm Links is
thValidateCCService
> > Imported
m i n s e
WSDL > ValidateCreditCard.wsdl
ฺ j a z to u entry, select validateCCfault and
click OK.
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

c) In the Catch window, for Fault Variable click the Auto-create Fault Variable icon
( ).

Oracle SOA Suite 11g: Build Composite Applications 355


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

e) In the Catch settings window, click OK.


s
4) In the ApproveCCOrder.bpel Design window, expand the Catch and add a a
) h a
single Assign activity into the Catch and rename it to Assign_rejected. Use the
following image as a guide: o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 356


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
r a
ikBPEL se
6) Save the changes to e
( your e n
process.
d o l e lic
Deploy the
e rcaPOProcessing
e rab Composite Application
7)ka M s f
Deploy thenmodified POProcessing composite application, by right-clicking the
r i
E on- t r a
POProcessing project name and selecting Deploy > POProcessing > to soaserver.
nOverwrite the existing version and ensure deployment is successful.

Oracle SOA Suite 11g: Build Composite Applications 357


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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:
1) In the JDeveloper window, to help with selecting credit cards and amounts for the s a
tests display the credit card data by performing the following steps: ) h a
a) In the Application Navigator, select the files application, expand o m
c the files >ฺ
i l ฺ i d e
ma t Gu
Application Sources > sql folder, and double-click creditcard_query.sql.
g
b) In the creditcard_query.sql window, click o @Execute
the d e n
Statement icon
d
( ). e rca is Stu
i
c) On the Select Connection dialog box,n ฺm
select e
h
thet“soademo (POApplication)”
connection, and click OK.jazm o u
s
ฺ t
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e r ca s Stu
b) On the Response tab, the reply statusฺm
i n e t hi the value VALID. This is
value displays
expected. For example:
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n
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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

Note: The CreditCardValidation composite process validateCC operation is a


synchronous interaction. Therefore, Oracle Enterprise Manager displays a
“Webservice invocation failed” window when a synchronous service is initiated a
a
from the Web based testing tool. To find out what the cause is it is easier to locate
h s
the instance id in the Dashboard or Instances tab on the “CreditCardValidation
m )
[1.0]” home page. l ฺ o
c ideฺ
i
a Gu
6) On the “CreditCardValidation [1.0]” Test Web Service page, g mreturn
to tto the
@ n
de menu (at the top
composite application home page click the SOA Composite
c a do >tuHome
of the page). For example:
e r i s S
m
inฺ use t h
a m
z to
ฺ j
e r ika ense
o ( l ic
d l e
cain theraInstance
7) On the “CreditCardValidation
b ID[1.0]” home page, under the Dashboard tab you can
click e
therlink column for the faulted instance.
a M nsfe
k
Eri on-tra
n

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


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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
(
a) Why is the CheckCCLimit
o l ic BPEL Component not showing a Faulted value in the
d l e
rca erab
State column?
e
b) M
a f tell that the validateCCfault business fault has been propagated
How cansyou
n
k -tra to the composite application?
Eri onexternally
n

Oracle SOA Suite 11g: Build Composite Applications 361


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

the ValidateCreditCard Mediator component receives the fault.

You can verify this information by clicking the CheckCCLimit BPEL link:

s a
)h a
m
co ideฺ
i l ฺ
In the “Instance of CheckCCLimit” Audit Trail page, scrollg maandtlocate
down G u the Throw
@ such
activity and observe that the fault is thrown and then caught,
o d e n the final Assign
that
a d
and Reply activities are successfully executed tocpropagate tufault message to the
the
e r S
invoker of the BPEL process:
i n ฺm e this
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 362


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
a
) hlocate
On the “Instance of ValidateCreditCard” Audit Trail page, you can scrollm to and
coerroridisedetected
the error when the 2-way operation “validateCC” is displayed. Afterlฺthe
i ฺ
the Mediator performs a transformation of the fault message data
m areceived
G ufrom the
BPEL process and it performs a step showing “Rethrowing gfault” after
@action t
n which the fully
qualified QName for the validateCCFault is shown. d o
This u d
is
ethe indicated that the
r c a S t
fault has been propagated externally.
ฺ m e this
m in use
ฺ z
ja e to
a
rik ens
o ( e lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.
d) On the Flow Trace page, examine the Trace tree verify that the processing
s a
h a
completed successfully and that the product has been fulfilled by the InternalStore
)
and shipped. Use the following Flow Trace as a guide: o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

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


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

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.

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri c)onOn-trthea Response tab, click the Launch Message Flow Trace link.
12)nOn 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


Practice 10-4: Test CreditCardValidation and POProcessing
Exceptions (continued)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
) h a
o m
c ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
ฺ j a zm to us
e r ika ense
13) On the Flow Traceo (page, examine
lic the Trace tree and answer the following questions:
a) Whatrc isa
d
the final l e
b status in outputVariable supplied to the callbackClient
e f e aorder
rApproveCCOrder
a M
activity insthe
n BPEL process? Explain your answer.
k -trathe order processed by the Fulfillment service? Explain your answer.
Eri b)onWas
nc) Did the fault message get received by the ApproveCCOrder BPEL process?

Oracle SOA Suite 11g: Build Composite Applications 366


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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

and expand the callbackClient to view the results:

s a
)h a
m
co ideฺ
i l ฺ
g ma t Gu
d o @ den
e rca is Stu
i n ฺm e th
zmhas tbeen s
uset
a
Note: The reason why theฺjstatus
a o to rejected is because the
ApproveCCOrder BPEL rik process e
nsstatus.
caught the fault condition. In the catch block the
( e
o le li
Assign_rejected activity c e
sets the
a d b
b.
rc eraBPEL
TheeFulfillment process was not invoked by the ApproveCCOrder BPEL Process,
a M s f
nit does not appear in the Trace tree due to the Invoke_validatecc activity
k because
-tra the validateCCfault. This caused the Catch block to execute and end the process
Eri onreceiving
n 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


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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2010, Oracle and/or its affiliatesฺ

s a
)h a
m
co ideฺ
i l ฺ
ma tandGcan
Note: However, that the fault message text is not saved anywhere,
g u be viewed in
o @ den
the Audit Trail pages for the relevant component instances.
d
e rca is Stu
i n ฺm e th
zm Detail
14) Close the Flow Trace and any Activity s
uwindow you have opened.
ฺ j a t o
e r ika ense
o ( lic
d l e
e rca erab
a M nsf
k
Eri on-tra
n

Oracle SOA Suite 11g: Build Composite Applications 368

Das könnte Ihnen auch gefallen