soasuite12c_tutorial.pdf
TRANSCRIPT
-
7/21/2019 SOASuite12c_Tutorial.pdf
1/391
Updated: 7.9.2014 16:50:46
Page 1 of 392
SOA Suite12c Tutorial
Oracle
-
7/21/2019 SOASuite12c_Tutorial.pdf
2/391
Chapter 1: Quick Start Install Page 2 of 392
SOA Suite 12c Tutorial
Table of Contents
SOA Suite 12c Tutorial Overview .................................................................................................................. 6
Chapter 1: Quick Start Install ....................................................................................................................... 7
SOA Suite 12c Documentation .................................................................................................................. 7
Chapter 2: Validate Payment ....................................................................................................................... 8
Overview ................................................................................................................................................... 8
Prerequisites ............................................................................................................................................. 9
Part 1: Build SOA Composite ..................................................................................................................... 9
High-Level Steps ...................................................................................................................................... 11
SOA Templates ........................................................................................................................................ 11
Steps in Detail ......................................................................................................................................... 14
Create a new composite application and project ............................................................................... 14
Create a database connection for adapter to retrieve payment information.................................... 20
Review the validatePayment BPEL process ........................................................................................ 24
Calculate payment status using an XSLT map (custom activity template) ......................................... 27
Add a composite sensor for payment status ...................................................................................... 37
Deploy the SOA composite ................................................................................................................. 42
Debug a SOA project in JDeveloper ........................................................................................................ 43
Test the SOA composite ...................................................................................................................... 53
Part 2: Register Composite on Service Bus ............................................................................................ 54
High-Level Steps ...................................................................................................................................... 54
Steps in Detail ......................................................................................................................................... 55
Create a new service bus application and project .............................................................................. 55
Create folders and import artifacts..................................................................................................... 59
Configure Business Service for validatePayment composite. ............................................................. 65
Tip and TrickHow to find composite deployment URI .................................................................... 69
Review Business Service Properties .................................................................................................... 70
Configure Proxy and Pipeline .............................................................................................................. 71
Deploy and Test .................................................................................................................................. 75
-
7/21/2019 SOASuite12c_Tutorial.pdf
3/391
Chapter 1: Quick Start Install Page 3 of 392
Chapter 3: Process Order ........................................................................................................................... 78
Overview ................................................................................................................................................. 78
Prerequisites ........................................................................................................................................... 79
Part 1: Build Process Order Composite ................................................................................................... 80
High-Level Steps ...................................................................................................................................... 80
Steps in Detail ......................................................................................................................................... 81
Import template .................................................................................................................................. 81
Create a new project ProcessOrder from a project template ............................................................ 82
Add the payment validation ............................................................................................................... 84
Update the order status in the Database ........................................................................................... 99
Use an inline BPEL subprocess for the order status update ............................................................. 100
Add an Order Number sensor to the Order Process composite ....................................................... 106
Update the order status to ReadyForShip if the payment has been authorized.......................... 109
Part 2: Register Process Order on Service Bus ..................................................................................... 117
High-Level Steps .................................................................................................................................... 117
Steps in Detail ....................................................................................................................................... 117
Open existing service bus application and import template resources ........................................... 117
Register ProcessOrder composite as a business service................................................................... 122
Create new pipeline with proxy using a pipeline template .............................................................. 125
Test end-to-end................................................................................................................................. 137
Chapter 4: Add New Order Channel ......................................................................................................... 138
Overview ............................................................................................................................................... 138
Prerequisites ......................................................................................................................................... 138
Part 1: Add file adapter proxy and wire to pipeline ............................................................................. 139
High-Level Steps .................................................................................................................................... 139
Steps in Detail ....................................................................................................................................... 139
Configure Proxy for File Adapter ....................................................................................................... 139
Wire to the existing Process Order Pipeline and Business Service. .................................................. 151
Test your service. .............................................................................................................................. 153
Part 2: Review Service Bus in Enterprise Manager .............................................................................. 154
High-Level Steps .................................................................................................................................... 154
Steps in Detail ....................................................................................................................................... 154
Bring up Enterprise Manager and navigate to Service Bus ............................................................... 154
-
7/21/2019 SOASuite12c_Tutorial.pdf
4/391
Chapter 1: Quick Start Install Page 4 of 392
Enable monitoring on all services in the Operations tab. ................................................................. 156
Review the various monitoring tabs ................................................................................................. 157
Review Message Reports .................................................................................................................. 159
Part 3: Service Bus Debugger ............................................................................................................... 163
High-Level Steps .................................................................................................................................... 163
Steps in Detail ....................................................................................................................................... 163
Part 4Advanced: Build the nXSD translation from scratch ............................................................... 167
High-Level Steps .................................................................................................................................... 167
Steps in Detail ....................................................................................................................................... 167
Bring up the Native Format Builder .................................................................................................. 167
Chapter 5: Pack and Ship Service .............................................................................................................. 191
Overview ............................................................................................................................................... 191
Prerequisites ......................................................................................................................................... 191
Introduction .......................................................................................................................................... 193
High-level steps ..................................................................................................................................... 194
Steps in Detail ....................................................................................................................................... 195
Create the Packing Service project ................................................................................................... 195
Define a REST interface for the Packing Service Project ....................................................................... 198
Create the Packing BPEL process .......................................................................................................... 209
Test the REST service in JDeveloper...................................................................................................... 223
Update the order status in the database .............................................................................................. 228
Add a composite sensor ........................................................................................................................ 235
Send an Email Notification .................................................................................................................... 238
Check email notification ................................................................................................................... 246
UMS Setup and Configuration .............................................................................................................. 248
Download and configure Apache James 2.3.2 .................................................................................. 248
Configure the email server ................................................................................................................ 248
Start the email server ........................................................................................................................ 248
Stop the email server (when needed)............................................................................................... 249
Target the UMS and Coherence adapter .......................................................................................... 249
Configure the UMS Adapter to use the Apache James server .......................................................... 250
Chapter 6: Fulfill Order ............................................................................................................................. 254
Overview ............................................................................................................................................... 254
-
7/21/2019 SOASuite12c_Tutorial.pdf
5/391
Chapter 1: Quick Start Install Page 5 of 392
Prerequisites ......................................................................................................................................... 254
Introduction .......................................................................................................................................... 256
High-Level Steps .................................................................................................................................... 257
Steps in Detail ....................................................................................................................................... 258
Create the FulfillOrder project from SOA project template ................................................................. 258
Get familiar with the FulfillOrder project ............................................................................................. 260
Determine the Shipping Method through Business Rules .................................................................... 262
Add a composite sensor to the fulfillOrder composite ......................................................................... 284
Call the pack and shipping service ........................................................................................................ 288
Add the coherence lookup for the Shipping Provider .......................................................................... 298
Appendix: Deploy, Test and Monitor Tutorial projects ............................................................................ 322
Introduction .......................................................................................................................................... 322
Start the Integrated WebLogic Server in JDeveloper ............................................................................ 323
Stop the Integrated WebLogic Server in JDeveloper ............................................................................ 324
Check the audit level on the SOA Server .............................................................................................. 325
Deploy Chapter Solutions ..................................................................................................................... 328
Deploy SOA Projects to the Application Server .................................................................................... 329
Test the SOA project with EM Fusion Middleware Control .................................................................. 334
Flow instances in EM Fusion Middleware Control ................................................................................ 340
Debug a SOA project in JDeveloper ...................................................................................................... 349
Test the application in JDeveloper with HTTPAnalyzer ........................................................................ 359
Define and run SOA Composite Test in JDeveloper .............................................................................. 364
Take a tour of Enterprise Manager Fusion Middleware Control .......................................................... 375
Run SOA test in EM FMWC ................................................................................................................... 377
Getting the service description (WSDL) of your project ....................................................................... 382
Getting the service WADL of your REST project ................................................................................... 383
Access the Database from JDeveloper .................................................................................................. 384
Create a Connection to Oracle WebLogic Server to deploy to a non-Integrated WebLogic Server ..... 388
-
7/21/2019 SOASuite12c_Tutorial.pdf
6/391
Chapter 1: Quick Start Install Page 6 of 392
SOA Suite 12c Tutorial Overview
The activities in this document aim to introduce you to key new features of SOA Suite 12c:
Quick Start install process Integrated Server
Everything in JDeveloperSOA and Service Bus
Templates
Debugger, Testing
REST enablement of services
New Adapters
More
-
7/21/2019 SOASuite12c_Tutorial.pdf
7/391
Chapter 1: Quick Start Install Page 7 of 392
Chapter 1: Quick Start Install
Please follow the new Developer Quick Start install guide available at
http://www.oracle.com/pls/topic/lookup?ctx=fmw121300&id=SOAQS to complete the installation.
The installer will:
Install all components necessary for development with the core of SOA Suite (BPEL, rules,
mediator, human work flow, service bus)
Launch JDeveloper after the installation, automatically registering the IDE plug-ins for SOA and
Service Bus.
Have e2e-1201-orderprocessing sample application ready for review, run and deploy.
Please note, while SOA Suite 12c greatly simplifies the initial developer install experience for SOA Suite,
all the flexibility and power of domain configuration that was available in 11g is preserved.
Your environment will look like the following within your developer desktop when you are donetypically in about 30 minutes:
SOA Suite 12c Documentation
SOA Suite 12c Documentation is available to view, and download (PDF, Mobi, ePub) from:
http://docs.oracle.com/middleware/1213/index.html
http://www.oracle.com/pls/topic/lookup?ctx=fmw121300&id=SOAQShttp://www.oracle.com/pls/topic/lookup?ctx=fmw121300&id=SOAQShttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://www.oracle.com/pls/topic/lookup?ctx=fmw121300&id=SOAQS -
7/21/2019 SOASuite12c_Tutorial.pdf
8/391
Oracle ConfidentialDo not distribute to third parties
Page 8 of 392
Chapter 2: Validate Payment: Build SOA Composites
Chapter 2: Validate Payment
Overview
Avitekhas embarked upon an IT modernization project to align with business goals of improvingcustomer satisfaction. A key area of improvement will be streamlining the order process to provide
better visibility tracking orders through credit approvals, fulfillment, shipment and delivery.
One key issue in the current system is that credit card payments are often denied for various,
sometimes minor reasons, such as expiration date, etc. Since the process to correct these issues varies
across Aviteks order entry systems, there is no consistent follow-up and resolution with customers.
Orders may end up lost or delayed in the system leading to customer dissatisfaction.
The business has indicated a new credit card fraud detection system must be put in place before years
end to thwart credit card abuses. A consistent fraud mechanism will require the credit validation
process to be consolidated across all order entry systems.
The first step will be to provide a consistent interface to all order entry applications for credit validation.Initially, the consolidated credit validation service will be hosted in-house to control quality; however,
once the interface is stabilized, this service will be outsourced to a 3 rdparty provider. In the future,
when Avitek decides to outsource credit validation to an external provider, this can be accomplished
without impacting existing applications.
In this chapter, you will build your first SOA Suite 12c project. At the end of this chapter, your solution
will look like the following from an architectural perspective.
-
7/21/2019 SOASuite12c_Tutorial.pdf
9/391
Oracle ConfidentialDo not distribute to third parties
Page 9 of 392
Chapter 2: Validate Payment: Build SOA Composites
Prerequisites
Developer (QuickStart) installation is complete. JDeveloper is up and running with The
integrated WLS server started. If you need to stop and re-start the server, please follow the
instructions in the Appendix of this document.
Tutorial resources have been downloaded and unzipped to a directory of your choice. When
referring to any resources in the following chapters (for example wsdlor sample input), we will
always refer directories relative to the unzipped location as ~/e2e-1201-orderprocessing. For
example ~/e2e-1201-orderprocessing/sample-input/input.xml.
Part 1: Build a SOA Composite
In this section, you will build your first Oracle SOA Suite 12c composite to validate a credit card
payment.
In this composite, credit card payments will be validated and the payment status will be returned. If thepayment is denied, the order will not be processed.
Once done, your project should resemble the following.
All available credit cards will be stored in the database, including payment type, card number, expiry
date, card name and daily limit.
The incoming order message includes the credit card information.
For example, the payment part of the order message would look like this:
1
1234123412341234
0316AMEX
Daniel
Day-Lewis
555 Beverly Lane
Hollywood
CA
12345
-
7/21/2019 SOASuite12c_Tutorial.pdf
10/391
Chapter 2: Validate Payment: Build SOA Composites Page 10 of 392
5127691108
The validation process includes three steps:
1. First, the payment information is retrieved from the database, using the credit card number
quoted in the order message as the key. If there is no data available with this credit card
number, payment is denied.
2. If data for the credit card number is available, the expiry date in the database record is
compared to the expiry date listed in the order message. If they are not the same, the payment
is also denied.
3. The last check compares if the total order amount is less than the daily limit on the credit card in
the database.
If all tests are successful, the payment is authorized. Otherwise its denied.
The implementation of this service uses a BPEL process to retrieve the credit card data from the
database and perform the tests outlined above. The service will return either Authorizedor Deniedasthe payment status.
-
7/21/2019 SOASuite12c_Tutorial.pdf
11/391
Chapter 2: Validate Payment: Build SOA Composites Page 11 of 392
High-Level Steps
Create a new composite application e2e-1201-composites and SOA project ValidatePayment.
Leverage the new SOA Project templateto create the ValidatePaymentcomposite. Review the various components of the composite.
Add a database connection to Java DB.
Import a custom activity templatewith an XSLT map to determine the payment status
(Authorizedor Denied), based on the daily limit and the total amount of order.
Add a composite sensor PaymentStatusfor the payment status
Deploy the project
UseDebuggerin JDeveloper.
Test the project
SOA Templates
In SOA Suite 12c, we have a number of new features to improve sharing of common code between
teams, departments or even from a partner to a customer. Part of that is the new SOA Templates
feature. As the name suggests, they will be used as starting points in the development of SOA
applications.
These templates will either be the foundation of a project or can be added to an existing project. From
that point on it will not be visible anymore that a template has been used.
All changes made after the import point will not be reflected in the original template.
The SOA templates come in three flavors:
Project templates: They include a complete project with all components and resources used and
will be used when creating a new project in your SOA application.
Component templates: A component with all references resources and components. For
example, a BPEL process that calls a business rule or adapter can be packaged as component
template. The component does not have to be complete and does not have to compile. A
component template can be added to an existing project.
Component templates will be visible in the composite palette if theyre available in the template
path, configured in JDev.
Custom activity templates:A scope in a BPEL process, which may include an invoke/receive
from/to a partnerlink, can be packaged as a custom BPEL activity. For example, an assign activity
and a call to an adapter. Those custom activities will be available in the BPEL palette.
To learn more, please seeIntroduction to Oracle SOA Suite Templates.
http://docs.oracle.com/middleware/1213/soasuite/develop-soa/soa-templates.htm#BABBBIHHhttp://docs.oracle.com/middleware/1213/soasuite/develop-soa/soa-templates.htm#BABBBIHHhttp://docs.oracle.com/middleware/1213/soasuite/develop-soa/soa-templates.htm#BABBBIHHhttp://docs.oracle.com/middleware/1213/soasuite/develop-soa/soa-templates.htm#BABBBIHH -
7/21/2019 SOASuite12c_Tutorial.pdf
12/391
Chapter 2: Validate Payment: Build SOA Composites Page 12 of 392
In this section, we will provide the ValidatePayment composite as aSOA Project template.
In order to leverage templates, please follow the steps below:
SOA templates that are located in the default directory (e.g.
$MW_HOME\jdeveloper\integration\templates ) will be recognized automatically. Additional
directories can be added.
As the templates used for the labs have been unpacked into the ~/e2e-1201-
orderprocessing/templates/folder, we will add this directory to the list of folders that are
scanned for templates.
In the main JDeveloper menu, please go toTools Preferences.
In the Preferences window, go toSOA Templates. (If you do not see SOAin the
preferences, then you could create a new application, or open an existing one. This will load up
SOA libraries, SOA preference will show up).
-
7/21/2019 SOASuite12c_Tutorial.pdf
13/391
Chapter 2: Validate Payment: Build SOA Composites Page 13 of 392
Click the +button, to add folder.
Navigate to ~/e2e-1201-orderprocessing/ templates.
Click Selectto accept your choice.
Click OKto close the Preferences window.
-
7/21/2019 SOASuite12c_Tutorial.pdf
14/391
Chapter 2: Validate Payment: Build SOA Composites Page 14 of 392
Steps in Detail
Create a new composite application and project
Create a new application. There are various ways and shortcuts to do this, and in this case choose File >
New
> Applicationfrom the menu.
From the Categoriestree, click on General > Applications.
Select SOA Applicationfrom the Itemsfield.
Click OK.
In the subsequent dialog for Create SOA Application, set the following fields, leaving the others
with their default values:
a. Application Name: e2e-1201-composites
b.
Directory of your choice.
-
7/21/2019 SOASuite12c_Tutorial.pdf
15/391
Chapter 2: Validate Payment: Build SOA Composites Page 15 of 392
Click Next.
When you create a new application, you are prompted to create a new project. Set the following
fields:
a. Project Name:ValidatePayment
b. Keep the default Directory
c. Project Features:SOA Suite
Click Next.
The next step allows you to pick either a Standard Composite, or a SOA Template. Choose
SOA Template.
-
7/21/2019 SOASuite12c_Tutorial.pdf
16/391
Chapter 2: Validate Payment: Build SOA Composites Page 16 of 392
Select ValidatePaymentTemplate. Click Finish.
A new project ValidatePayment is created with some predefined componentsas derived from
the template. You now have a canvas displaying three swim lanes: services, components, and
references.
-
7/21/2019 SOASuite12c_Tutorial.pdf
17/391
Chapter 2: Validate Payment: Build SOA Composites Page 17 of 392
On the left hand side, you will see the Application Navigator, which shows all resources
included in a SOA project.
This Navigator has been reorganized in SOA Suite 12c to make it easier to find all files related to
SOA, and also to provide the option to customize the folder structure.
You will see a SOAfolder under the project root. This is where all SOA related files and folders
are stored, such as BPEL processes, schema files, WSDL files.
The composite.xml, which defines the structure of the composite, is located directly under the
SOAfolder. In previous releases, this file was just shown as composite.xml. This became
confusing when several composite.xml files from different projects were open at the same time.
In SOA Suite 12c, we now display the project name in the navigator and in the composite tab
label. It is displayed asValidatePaymenthere.
-
7/21/2019 SOASuite12c_Tutorial.pdf
18/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
19/391
Chapter 2: Validate Payment: Build SOA Composites Page 19 of 392
The composite diagram looks like this.
The External References swim lane contains the getpaymentInformation database adapter.
This step will provide the payment information from the database, using the credit card number
as the key. Based on expiry date, daily limit, and total amount of order, we will then calculate
whether the payment is authorized or denied.
The database adapter will process your choices, and provides a service that implements the
operation specified. The WSDL file to represent that service is getPaymentInformation.wsdl .
You can see the .jca file of the getPaymentInformation database adapter, together with two
XML files under the Adapterssubfolder and the WSDL file of the getPaymentInformation
service under the WSDLssubfolder.
A schema file getPaymentInformation_table.xsd has also been created. This is used to set the
input and output variable for the DB adapter call.
In the center (components swim lane) is the validatePayment BPEL Process- it is the
component in charge of the orchestration in the SOA Suite. You will add a BPEL Process
component to orchestrate a request to the service you just created with the database adapter.
In SOA Suite 12c, BPEL process supports concrete wsdl. This BPEL process will make use of two
resource files: ValidatePayment-concrete.wsdl and CanonicalOrder.xsd.
SOA Suite 12c supports BPEL 1.1 and BPEL 2.0 and the default version is BPEL 2.0.
The Exposed Service validatepaymentprocess_client_ep is the external client web service that
will provide input to the BPEL process.
-
7/21/2019 SOASuite12c_Tutorial.pdf
20/391
Chapter 2: Validate Payment: Build SOA Composites Page 20 of 392
Create a database connection for adapter to retrieve payment information
Note: Make sure your integrated server is running before doing this step, otherwise Java DB will not be
available.
The first step will provide the payment information from the database, using the credit card numberas the key. Based on expiry date, daily limit, and total amount of order, we will then calculate
whether the payment is authorized or denied.
The database adapter getpaymentInformation will connect to the SOA database. In order to do
that, it needs a connection which contains all the details needed to connect to the database. The
template does not carry the connection informationit leverages the connection(s) configured for
the application.
-
7/21/2019 SOASuite12c_Tutorial.pdf
21/391
Chapter 2: Validate Payment: Build SOA Composites Page 21 of 392
In the Create Database Connectiondialog, enter the following details
Create Connection In: Application Resources
Connection Name:SOA
Connection Type: Java DB (Derby)
-
7/21/2019 SOASuite12c_Tutorial.pdf
22/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
23/391
Chapter 2: Validate Payment: Build SOA Composites Page 23 of 392
Now build your project:
o Click on Buildin the main menu
o Select Make ValidatePayment.jpr
You will see the build result in theMessagesLogwindow (at the bottom of JDeveloper)
If you get an error like the one below, then something is wrong in your composite and it
needs to be fixed.
If your log looks like this, everything is fine:
-
7/21/2019 SOASuite12c_Tutorial.pdf
24/391
Chapter 2: Validate Payment: Build SOA Composites Page 24 of 392
Review the validatePayment BPEL process
Double-click the BPEL process to open the BPEL designer.
Notice the getPaymentInformation partnerlink already in the Partner Linksswim lane. It is also
connected via the Invoke activity.
The input and output variables for the adapter call are also defined. They are leveraged when the
DB adapter is invoked.
We use Invokeactivities when communicating with services, like adapters and web services.
When defining an invoke activity, you can have the input (and output) variable created
automatically. You can review these invoke activity and the variables using the new Property
Inspector (see How To Edit BPEL Activities in the Property Inspectorinsoa-dev-guide.pdf).
https://stbeehive.oracle.com/content/dav/st/SOA12c-public/Public%20Documents/docs/SOA%20Beta/Developing%20SOA%20Applications%20with%20Oracle%20SOA%20Suite.pdfhttps://stbeehive.oracle.com/content/dav/st/SOA12c-public/Public%20Documents/docs/SOA%20Beta/Developing%20SOA%20Applications%20with%20Oracle%20SOA%20Suite.pdfhttps://stbeehive.oracle.com/content/dav/st/SOA12c-public/Public%20Documents/docs/SOA%20Beta/Developing%20SOA%20Applications%20with%20Oracle%20SOA%20Suite.pdfhttps://stbeehive.oracle.com/content/dav/st/SOA12c-public/Public%20Documents/docs/SOA%20Beta/Developing%20SOA%20Applications%20with%20Oracle%20SOA%20Suite.pdf -
7/21/2019 SOASuite12c_Tutorial.pdf
25/391
Chapter 2: Validate Payment: Build SOA Composites Page 25 of 392
If the Property Inspector window is not open, go to Window Properties.
If the window is open on the right hand side, you may want to drag and drop it into the middle
at the bottom. On the left hand side of the property inspector you will see the same tabs as you
would see when opening the activity for editing.
The variable designated for theinput will contain the data (the credit card number) that will be
sent to the service when it is invoked. It is automatically created with the correct type expected
by the service.
The name of the variable is fairly long as its a concatenation of the partner link name, the
operation and InputVariable.
Similarly inspect the Output Variableby changing to the Outputtab.
These variables will be used when interacting with the getPaymentInformation service. The
output variable will be populated when the service returns a result, but you need to populate
the input variable yourself.
-
7/21/2019 SOASuite12c_Tutorial.pdf
26/391
Chapter 2: Validate Payment: Build SOA Composites Page 26 of 392
In the BPEL process, just above the invoke activity, is the Assign activity setCreditCardNumber . You
use an Assign activity to assign data to a variable. In this case, the credit card number is assigned
that was passed into the BPEL process to the getPaymentInformation service.
The assign activity is one of the few activities where you cannot define everything in the property
inspector. We need to launch the Assign Editor.
It assigns the credit card number in the incoming payment information (in the process input
variable) to the input variable of the database adapter.
On the left hand side (source), expand the variable Variables > Process > Variables > inputVariable >
paymentInfo > ns3:PaymentInfo > ns3:CardNum
On the right hand side (target), expandVariables > Process > Variables >
getPaymentInformation_getPaymentInformationSelect_InputVariable >
getPaymentInformationSelect_inputParameters > ns4:ccnb
Note the mapping from ns3:CardNumon the left to ns4:ccnbon the right.
This creates a new copy rule, which can be seen at the bottom of the editor.
Click OKto return to the BPEL process.
We dont need an assign activity for the output variable as we will define an XSLT map to determine if
the payment is valid, based on the information returned by the database adapter.
Make sure to save everything before you continue.
-
7/21/2019 SOASuite12c_Tutorial.pdf
27/391
Chapter 2: Validate Payment: Build SOA Composites Page 27 of 392
Calculate payment status using an XSLT map (custom activity template)
We provide an XSLT transformation to determine if the payment is valid, based on the daily
limit (retrieved from the database) and the total order amount(authorization amount in the
order message, which has been calculated in the process order project by multiplying price andamount of every order item and adding them up).
The total amount of the order has to be smaller than the daily limit on the credit card.
In this module, the XSLT transformation is provided as a custom activity template.
In order to use the customer BPEL activity template, the directory should be included in the Tools
PreferencesSOATemplates. We already mapped the folder in a prior section when project
template was used.
In your BPEL process, expand the Custom Activity Templatessection in the BPEL activity palette.
If you dont see the template, close and reopen the BPEL process.
You should see the CalculatePaymentStatusScope template in the list.
Drag and drop the CalculatePaymentStatusScope template under the getPaymentInformation
invoke activity in the validatePaymentProcess BPEL process.
-
7/21/2019 SOASuite12c_Tutorial.pdf
28/391
Chapter 2: Validate Payment: Build SOA Composites Page 28 of 392
The template dialog shows you the Name and the Description of the template and all artifacts
that are included. You will also see a list of conflicts: The template includes theCanonicalOrder.xsd, getPaymentInformation_table.xsd, and getPaymentInformation.wsdl
which are already present in the composite:
-
7/21/2019 SOASuite12c_Tutorial.pdf
29/391
Chapter 2: Validate Payment: Build SOA Composites Page 29 of 392
You have the option to skipall conflict files, meaning you keep the ones in the composite, or
overwriteall with those in the template. You can also make this decision individually.
In this case we know that the files are identical and will skip all:
Select Skip All and click OK.
Adding the custom activity template creates a new scope, which includes an XSLT
transformation calculatePaymentStatus.xsl.
Select the transform activity calculatePaymentStatus, and check out the property inspector
window. When you click on the transform activity, it might give the following error message:
Click OK. We will resolve this error message few steps later.
You will see that the transformation expects two input variables: The output variable of the
database adapter, which includes the payment information stored in the database, and theinput variable of the BPEL process, which includes the total order amount.
The output is the statusfield in the process output message, which will either be set to Denied
or Authorized.
-
7/21/2019 SOASuite12c_Tutorial.pdf
30/391
Chapter 2: Validate Payment: Build SOA Composites Page 30 of 392
If you want to see the definition of the XSLT file, click the editbutton at the bottom:
This opens the mapper file. ClickExpand All Child Nodeson Sourceand Target and click on the little plus sign next to the
function in the middle.
-
7/21/2019 SOASuite12c_Tutorial.pdf
31/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
32/391
Chapter 2: Validate Payment: Build SOA Composites Page 32 of 392
Select the browse button next to the Source Variablefield.
Select the global variable
getPaymentInformation_getPaymentInformationSelect_OutputVariable in the Variable
Chooser.
Click OK.
The Source Partfor the variable will be automatically selected.
-
7/21/2019 SOASuite12c_Tutorial.pdf
33/391
Chapter 2: Validate Payment: Build SOA Composites Page 33 of 392
Click OK.
Repeat the same for the second source variable by replacing it with the process inputVariable.
To edit the target variable, click the browsebutton next to the Target Variablefield.
The Variable Chooserdialog will be displayed. Select the scope variable outputVariable. Thisvariable will include the payment validation status.
Click OK.
Now you can delete the scope variables:
-
7/21/2019 SOASuite12c_Tutorial.pdf
34/391
Chapter 2: Validate Payment: Build SOA Composites Page 34 of 392
Open the Variableswindow by clicking the Property Structureicon on top of the BPEL process
and choosing Variables.
Delete the three scope variables by choosing the variables one by one and clicking the red Xicon:
Confirm the delete action by clicking Yesin the Delete Variables window.
-
7/21/2019 SOASuite12c_Tutorial.pdf
35/391
Chapter 2: Validate Payment: Build SOA Composites Page 35 of 392
Repeat this for all three scope variables.
Close the variables window.
Save all changes by clicking the Save Allicon on top of JDeveloper.
Build your project by choosing BuildMake ValidatePayment.jprin the JDeveloper main menu.
-
7/21/2019 SOASuite12c_Tutorial.pdf
36/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
37/391
Chapter 2: Validate Payment: Build SOA Composites Page 37 of 392
Add a composite sensor for payment status
Composite sensors provide a method for implementing track able fields on messages. Composite
sensors enable you to perform the following tasks:
Monitor incoming and outgoing messages.
Locate particular instances by searching for specific sensor details in the EM console.
Publish JMS data computed from incoming and outgoing messages.
Track composite instances initiated through business event subscriptions.
You define composite sensors on service and reference binding components or on service components
that have business event subscriptions in Oracle JDeveloper. This functionality is similar to variable
sensors in BPEL processes. During runtime, composite sensor data is persisted in the database.
By adding a composite sensor for payment status, we provide the ability to search for all authorized or
denied payments.
Close the BPEL editor to return to the composite editor.
Right-click on the SOAP service and choose Configure Sensors.
Choose the validatepaymentprocess_client_epservice.
Click on the blue plus sign to create a new composite sensor.
-
7/21/2019 SOASuite12c_Tutorial.pdf
38/391
Chapter 2: Validate Payment: Build SOA Composites Page 38 of 392
Name it PaymentStatus.
Choose the operation validate.
Leave the Enterprise Manager check box selected.
Click on the edit icon to define an expression for the sensor.
-
7/21/2019 SOASuite12c_Tutorial.pdf
39/391
Chapter 2: Validate Payment: Build SOA Composites Page 39 of 392
Choose Variables.
Choose Payment Status - Status in the output variable.
-
7/21/2019 SOASuite12c_Tutorial.pdf
40/391
Chapter 2: Validate Payment: Build SOA Composites Page 40 of 392
Click OK.
-
7/21/2019 SOASuite12c_Tutorial.pdf
41/391
Chapter 2: Validate Payment: Build SOA Composites Page 41 of 392
We wont define a filterfor this sensor.
Click OK.
You now see the sensor in the list.
Click OKagain.You will see a new icon on the SOAP service.
-
7/21/2019 SOASuite12c_Tutorial.pdf
42/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
43/391
Chapter 2: Validate Payment: Build SOA Composites Page 43 of 392
Debug a SOA project in JDeveloper
In SOA Suite 12c, we have the ability to set breakpointsin the composite editor, BPEL process and
Service Bus pipeline.
Youre able to stopat breakpoints, lookat the data, step into, step outand so on. In a BPEL process,youre also able to change the value of a variable while debugging.
Set breakpoints in the composite by right clicking on an interface and create a Request or Reply
Breakpoint or both. For one-directional interfaces, you only get one option.
The breakpoints are little red icons with an arrow pointing in the direction of the flow.
In a BPEL process, right-click on an activity and choose Toggle Breakpoint. This will set a
breakpoint is there is none and remove if there is already a breakpoint.
-
7/21/2019 SOASuite12c_Tutorial.pdf
44/391
Chapter 2: Validate Payment: Build SOA Composites Page 44 of 392
These breakpoints are red dots only without arrow as the flow is always in one direction:
Set as many breakpoints as you want.
Important:
To make debugging easier for now, you should have a breakpoint at the beginning of every BPEL
process to make sure the debugger stops there.
Now start the debugger for your project:
Right-click on the project and choose Debug
-
7/21/2019 SOASuite12c_Tutorial.pdf
45/391
Chapter 2: Validate Payment: Build SOA Composites Page 45 of 392
You can debug local or remote. When the debugger is started, a window pops up asking which
serveryou want to use for debugging. It also asks for the debug port (default is 5004 for SOA,
but can be changed) and the timeoutfor the debugger when inactive.
Debugger properties are stored per project. If you previously imported a solution from a
different machine, the HOSTwill most likely have to be changed.
These values can also be stored in the JDeveloper properties and you can skip this dialog in the
future if you always want to use the same options.
Choose your host and leave the defaults.
Click OK.
If youve made changes to your project, it needs to be redeployed. This includes setting of
breakpoints.
You will be lead through the deploy wizard step by step if that is the case.
-
7/21/2019 SOASuite12c_Tutorial.pdf
46/391
Chapter 2: Validate Payment: Build SOA Composites Page 46 of 392
The debugger is ready when you see this message:
Every web service endpoint now shows a message that you can use the context menu to
initialize WS debugging:
Right-click on the WS interface and chooseInitiate WS Debugging
This opens HTTP Analyzer.
Fill in all fields or choose HTTP Contentat the bottom to be able to copy and paste an xml file
instead.
-
7/21/2019 SOASuite12c_Tutorial.pdf
47/391
Chapter 2: Validate Payment: Build SOA Composites Page 47 of 392
Use the sample file provided: PaymentInfoSample_Authorized_soap.xml .
Be aware that this sample message already includes the SOAP envelope needed for testing.
-
7/21/2019 SOASuite12c_Tutorial.pdf
48/391
Chapter 2: Validate Payment: Build SOA Composites Page 48 of 392
Hit Send Request.
If everything goes well, you should now see the debugger stop at your first breakpoint:
The active breakpoint turns blue and starts pulsing
Go to the Datatab at the bottom of JDeveloper and look at your variable values:
-
7/21/2019 SOASuite12c_Tutorial.pdf
49/391
Chapter 2: Validate Payment: Build SOA Composites Page 49 of 392
Step over (F8) to start your BPEL process. Step through the BPEL process one activity at a time, using F8, and see how the variable values
change.
If you step through an assign activity, you will see the debugger step through the copy rules that
are included in the assign
If you set a breakpoint at the database adapter, it will jump out of BPEL and back to the
composite
-
7/21/2019 SOASuite12c_Tutorial.pdf
50/391
Chapter 2: Validate Payment: Build SOA Composites Page 50 of 392
Note the values that come back from the adapter.
After the calculate payment activity, the payment status has been set:
See what happens when you modify a value:
-
7/21/2019 SOASuite12c_Tutorial.pdf
51/391
Chapter 2: Validate Payment: Build SOA Composites Page 51 of 392
On the left hand side, you also see the stack trace:
Finish the debugger by stepping to the end of your BPEL process.
Back in HTTP Analyzer, you can see the result:
NOTE:
Please make sure to terminatethe debugger before you continue with the implementation. As long as
the debugger is running, you will not be able to edit.
To stop the debugger, click the big red icon in the Tools section and choose your project.
-
7/21/2019 SOASuite12c_Tutorial.pdf
52/391
Chapter 2: Validate Payment: Build SOA Composites Page 52 of 392
Choose Terminate in the pop up window:
For more information on SOA Debugger, please see Debugging SOA Composite Applications with the
SOA Debuggerinsoa-dev-guide.pdf.
http://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.html -
7/21/2019 SOASuite12c_Tutorial.pdf
53/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
54/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
55/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 55 of 392
Steps in Detail
Create a new service bus application and project
Create a new Service Bus application. There are various ways and shortcuts to do this, and in this
case choose File > New
> Applicationfrom the menu.
From the Categoriestree, click on General > Applications.
Select Service Bus Application with Service Bus Project from the Itemsfield.
Click OK.
In the subsequent Create Service Bus Application With Service Bus Projectdialog, set the following
fields, leaving the others with their default values:
a. Application Name:e2e-1201-servicebus
b. Directory of your choice
-
7/21/2019 SOASuite12c_Tutorial.pdf
56/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 56 of 392
Click Next.
When you create a new application, you are prompted to create a new project. Set the following
fields on Step 2 of 2:
a. Project Name: ValidatePayment
b. Directory of your choice
-
7/21/2019 SOASuite12c_Tutorial.pdf
57/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 57 of 392
Click Finish.
Double-click the ValidatePayment iconin the Application Navigatoron the left-hand side, theServices Bus Overview editor will open on the right.
-
7/21/2019 SOASuite12c_Tutorial.pdf
58/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 58 of 392
The Overview Editor is a new view for Service Bus in SOA Suite 12c, and modeled from the SOA
Composite Editor.
This view allows you to construct Service Bus projects using a top-down, drag and drop approach. You
can create Proxy, Pipeline, and Business Services by dragging icons from the Component Palette on theright, to the lanes of the canvas.
Please take a few moments to browse the Application navigator on the left of the screen and the
Component palette on the right.
On the Component Palette, notice the Resourcescategory contains Pipelineand Split-Join icons. These
are the components for a Service Bus application. In this release, the Pipeline has been split from the
Proxy to allow it to be a re-usable component.
Other Palette categories, Technology, Adapters and Advanced,contain adapters and transports for
building Business Services (External References) and Proxy (Exposed Services).
If your Properties window is on the bottom right of the JDeveloper screen, please drag and position it to
the bottom center as shown in the above diagram. This will make editing properties of Pipeline actionseasier.
-
7/21/2019 SOASuite12c_Tutorial.pdf
59/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 59 of 392
Create folders and import artifacts.
In Service Bus applications, Foldersare leveraged to organize artifacts within a Project. For brand new
applications, we encourage you to create folders that align with the default folders in your Compositeapplication. Folders will not be automatically created in Service Bus applications so that backward
compatibility of Service Bus projects imported from previous releases is maintained.
For this project, we will keep the structure simple since there are only a few artifacts to manage. As
your projects grow in subsequent chapters, you will add folders for categorizing artifacts into Business
Service, Proxyand Templates.
From the ValidatePaymentproject icon, select New> From Gallery.
SelectFolder.
-
7/21/2019 SOASuite12c_Tutorial.pdf
60/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
61/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 61 of 392
Create WSDLsfolder in the same way. When complete your Application Navigator should resemble
the following.
Select the WSDLsfolder that you just created in the left-hand navigation pane. We will now import
artifacts to build our services.
There are many ways to share artifacts between Service Bus and Composite applications, e.g. source
control, MDS backed by source control, etc. For todays work, you will import the artifacts from the
file system.
-
7/21/2019 SOASuite12c_Tutorial.pdf
62/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
63/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 63 of 392
Import Service Bus Resources - Step 1 of 3, select Resources from URL.
Click Next.
Import Service Bus Resources - Step 2 of 3, next to Source URL,click the browse button .
Be sure you selected the WSDLs folder in your project, then from the WSDL chooser, navigate
to ~/e2e-1201-orderprocessing/resources/wsdl folder on your disk and selectValidatePayment-
concrete.wsdl
-
7/21/2019 SOASuite12c_Tutorial.pdf
64/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 64 of 392
NOTE: This WSDL assumes that you have unzipped the resources as instructed in prior module
(ValidatePayment SOA composite), and the Schemasfolder is at the same level as the wsdl folder
containing the CanonicalOrder.xsd. You will need this directory structure to successfully import the
WSDL.
Click OK.
ClickNext.
Import Service Bus Resources - Step 3 of 3, accept the defaults.
-
7/21/2019 SOASuite12c_Tutorial.pdf
65/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 65 of 392
Click Finish. Your left-hand navigation tree should resemble the following:
Configure Business Service for validatePayment composite.
In this section, you will configure a Business Service to represent your validatePayment composite.
There are different ways to create artifacts in Service Bus in JDeveloper:
right-click menu from the left-hand Application Navigator (traditional approach)
drag and drop icons from the Component Palette on to the overview canvas (new)
right click directly on the overview canvas to insert artifacts (new)
We will use the drag and drop Component Palette to build our first Service Bus project; however, feel
free to experiment with other mechanisms.
-
7/21/2019 SOASuite12c_Tutorial.pdf
66/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 66 of 392
Drag and drop the icon from the right Component Palette on to the External References Lane.
A wizard will walk you through the steps of configuring the Business Service. The title bar of the wizard
dialog shows the step number.
Create Business Service - Step 1 of 3
Service Name:ValidateBS
Location: Leave as default
Click Next.
-
7/21/2019 SOASuite12c_Tutorial.pdf
67/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 67 of 392
Create Business Service - Step 2 of 3:
Select Service Type: WSDL
Select the icon on the right of the WSDL choice.
When the WSDL chooser appears, first, confirm that Applicationicon on the top is selected and
expand Application node Application -> ValidatePayment -> WSDLs.
Select ValidatePayment-concrete.wsdl
Click OK.
-
7/21/2019 SOASuite12c_Tutorial.pdf
68/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
69/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 69 of 392
Click Finish. Your canvas should now resemble the following:
Tip and TrickHow to find composite deployment URI
NOTE: There are several ways to check your deployed endpoint of a Composite. One way is to visit
the EM console (http://localhost:7101/em)and navigate to your composite.
Click the Testicon on the top right of screen. This will bring up a Web Service test page that lists your
deployed endpoint.
If you need to update your endpoint URI, you can do this as you review the Business Service
properties below in the Transport tab.
http://localhost:7101/emhttp://localhost:7101/emhttp://localhost:7101/emhttp://localhost:7101/em -
7/21/2019 SOASuite12c_Tutorial.pdf
70/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 70 of 392
Review Business Service Properties
Double-click on your new Business Service in the overview and review the settings for your new business
service. There are settings for Performance (Result Caching), Policies for Security. We wont be settings
these right now but you might want to explore what is available.
General Properties
Transport
Transport Details
Performance
Security Policy
-
7/21/2019 SOASuite12c_Tutorial.pdf
71/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 71 of 392
Configure Proxy and Pipeline
Now we will create the Proxy and Pipeline to invoke the ValidateBSBusiness Service. The Proxy will be
the interface to the service from external consumers. The Pipeline contains actions that must be
performed before invoking the composite. Typical actions are data transform and validation, reportingwith error handling; however, for your first Pipeline we will keep it simple.
Locate the Pipelineicon under Resourceson the Componentpalette. Drag and drop the Pipeline
icon from the right onto the middle of the canvas, labeled the Pipelines/Split Joinslane.
The Pipeline wizard will walk you through the next steps. The title will show you what step you are on.
Create Pipeline Service - Step 1 of 2:
Service Name: ValidatePP
-
7/21/2019 SOASuite12c_Tutorial.pdf
72/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
73/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 73 of 392
Click OK.
Once back on Create Pipeline Service Step 2 of 2:
a. Ensure the Expose as Proxy Service checkbox is selected. This is the default.
b. Proxy Name: ValidatePS
-
7/21/2019 SOASuite12c_Tutorial.pdf
74/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 74 of 392
ClickFinish.
Your canvas should now look like the followingwe are almost done!
Now we will simply wire the Pipeline to invoke the Business Service.
Select ValidatePPand drag arrow to ValidateBS.
-
7/21/2019 SOASuite12c_Tutorial.pdf
75/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 75 of 392
The Routingaction is automatically configured for you in the Pipeline. Normally you would add
some actions to the Pipeline to validate, transform the payload or report for auditing. We will
practice this in subsequent chapters. For now lets go test your first Service Bus applicationend to
end!
Click the Save Allicon on top left of your screen.
Deploy and Test
We are ready to deploy and test end-to-end. Make sure your Integrated Server is running.
Bring Overview Editor back into focus. You can do this by double-click your project icon
in the Application Navigator or by selecting the ValidatePaymenttab on
top center.
This will bring up your overview and refresh your canvas.
Right-click on the ValidatePS in the Exposed Services Lane. Select Run.
-
7/21/2019 SOASuite12c_Tutorial.pdf
76/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 76 of 392
The Test Console will activate as one of your windows in JDeveloper on Windows. On Linux, this
may start a new browser window outside of JDeveloper. Make this window active by clicking on the
title bar.
By default, a sample payload will be generated for you; however, we will test with a specific file.
Click the Choose File button. This may show up as a Browsebutton on Linux.
Navigate to ~/e2e-orderprocessing/sample_input/and select PaymentInfoSample_Authorized.xml
Click Open.
-
7/21/2019 SOASuite12c_Tutorial.pdf
77/391
Oracle ConfidentialDo not distribute to third parties
Chapter 2: Validate Payment: Register Composite on Service Bus Page 77 of 392
On the Test Console, click on theExecutebutton.
On the next screen, scroll down and hopefully your payment has been authorized!
You can also debug the Service Application leveraging the Debugger as was done in chapter 2A.
You have just completed your first SOA Suite 12c application!
-
7/21/2019 SOASuite12c_Tutorial.pdf
78/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
79/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order Overview Page 79 of 392
Prerequisites
Chapter 2: Validate Paymentshould be complete or the chapter solutions deployed. If you did
not complete Chapter 2, please deploy the solutions. The Deploy Chapter Solutionssection inthe Appendix gives detailed instructions for deploying solutions.
Tutorial resources have been included and unzipped to a directory of your choice. When
referring to any resources in the following chapters, we will always refer to directories relative
to the unzipped location as ~/e2e-1201-orderprocessing. For example ~/e2e-1201-
orderprocessing/sample-input/input.xml.
When referring to resources in the following text, we will always assume the location you
unzipped e2e-1201-orderprocessingand has structure as follows:
o WSDLs
o Schemas
o sample input
o templates
-
7/21/2019 SOASuite12c_Tutorial.pdf
80/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 80 of 392
Part 1: Build Process Order Composite
You will now create another SOA application that will accept new purchase orders, approve them and
forward them to the fulfillment system. You will use a project template to implement the basic order
processing scenario, add a call to the payment validation service built in chapter 2 and update the order
status in the database based on the outcome of the payment validation.
The order status update will be converted to a BPEL subprocess to make it easily re-usable.
Once completed, your composite will look like this:
High-Level Steps
Import SOA template.
Before the order is processed, the credit card payment is validated using the validatePayment
service built in Chapter 2.
If the payment is denied, the order status is set to Deniedand the processing is stopped.
If the payment is authorized, the order status is set to Authorizedand the order is processed.
When the order processing is finished, the order status is set to ReadyForShip.
The Fulfill Order process to pick up orders that are ready to be fulfilled will use this status.
-
7/21/2019 SOASuite12c_Tutorial.pdf
81/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 81 of 392
Steps in Detail
Import template
We will start by importing a SOA project template with a number of components already predefined.
These components can:
Receive an order through a web service call.
Create order number, set order date to current date and set order status =New.
Calculate the total order amount.
Save the order in the database with status=New.
Return an acknowledgement to the client with the order number.
The template has been provided as part of the resources for the labs, and should be located in the
templates folder.
In the previous chapter, we added this location to the list of folders where JDeveloper looks for
templates. If you havent done that yet, please follow the steps:
In the main JDeveloper menu, selectTools - Preferences In the Preferences window, selectSOA - Templates
Click Add
Navigate to the templates folder
Click Selectto accept your choice
Click OK to close the Preferences window.
-
7/21/2019 SOASuite12c_Tutorial.pdf
82/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 82 of 392
Create a new project ProcessOrder from a project template
In chapter 2, you used project template to accelerate building the Validate Payment service, as well as a
custom activity template for the XSLT transformation.
In this section, you will create the ProcessOrdercomposite (order processing service) based on the
provided project template in the e2e-1201-composites application.
Open the e2e-1201-composites application:
Choose File > New> Projectfrom the menu.
Choose SOA Project
Click OK
Set the following fields:
o Project Name:ProcessOrder
o Directory:Keep the default directory
Click Next
In the next step, choose Start fromSOA Template.
If you cant seeProcessOrderTemplate in the list, click the + button to add the folder where your
template is located.
-
7/21/2019 SOASuite12c_Tutorial.pdf
83/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 83 of 392
Choose ProcessOrderTemplate.
Click Finish.
A new project with predefined components is created.
Double-click the components and services/references and discover what they do.
Deploy and test the project and make sure there are no errors, following the steps in the section
Test the SOA project with EM FMWC in the Appendix.
Use OrderSample_soap.xml (in the sample_input folder) for testing the web service interface.
Please note that this sample file includes the soap envelope needed for testing.
Check if new order records have been created in the database.
-
7/21/2019 SOASuite12c_Tutorial.pdf
84/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
85/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 85 of 392
Make sure you select the app server where you deployed the ValidatePaymentproject.
Select the ValidatePSproxy service
Click OK
The port is chosen automatically
Check the box to copy the WSDL file and its dependant artifacts into the project. By doing this,
we ensure that the designer does not throw an error when the Service Bus service is not
available because the server is down or the service is not deployed.
-
7/21/2019 SOASuite12c_Tutorial.pdf
86/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
87/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 87 of 392
Uncheck Maintain original directory structure for imported files and Rename duplicate
files
Click OK
Now we need to wire the validateAndProcessOrder BPEL process to the newly created SOAP
reference
-
7/21/2019 SOASuite12c_Tutorial.pdf
88/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 88 of 392
Open the validateAndProcessOrder BPEL process and add the call to validatePaymentService .
You will see that there is now a new partnerlink in the BPEL process for the payment validation.
But lets first have a look at what has already been defined in the process.
After assigning the order to a process variable, validateAndProcessOrdercalculates the total
order amount, which is used to validate the payment. Remember, this was an input to the
payment validation service.
The calculation is done through an XSLT map.
-
7/21/2019 SOASuite12c_Tutorial.pdf
89/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 89 of 392
An assignactivity then adds the total order amount to the order message.
The writeOrderScopeincludes all activities involved in writing the order to the database.
-
7/21/2019 SOASuite12c_Tutorial.pdf
90/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
91/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 91 of 392
Wire the invokeactivity to the validatePaymentService partnerlink
This opens the invokeactivity for editing.
You can choose to continue editing in this dialog or close the dialog and edit in the property
editor.
-
7/21/2019 SOASuite12c_Tutorial.pdf
92/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 92 of 392
Lets use this dialog for now to make you aware of both options. Youll be able to decide later
which option you prefer.
Change the name of the invoke activity to validatePayment.
Click the +sign next to Input to automatically create the input variable for the invoke activity
Click OK
-
7/21/2019 SOASuite12c_Tutorial.pdf
93/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 93 of 392
Create the output variable in the same way
Click OK
Click OK
The invokeactivity is now complete.
Check the property inspector.
-
7/21/2019 SOASuite12c_Tutorial.pdf
94/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 94 of 392
Before the web service can be invoked, the right values must be assigned to the input
variable for the web service call.
Add an Assignactivity before the just added Invoke activity
In the General tab of the property inspector, specify the name as
assignPaymentInformation
-
7/21/2019 SOASuite12c_Tutorial.pdf
95/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 95 of 392
Open the Copy Rulestab and launch the Assign Editor
Assign the payment information (Billing) from the order variable to the input variable of the
validatePayment service (validatePayment_validate_inputVariable ) by dragging a map
from left to right.
-
7/21/2019 SOASuite12c_Tutorial.pdf
96/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 96 of 392
This creates a new copy rule:
Click OK
If you see a warning attached to the assign, click the validate check box on top of the BPEL
editor. The warning should now go away.
We now assign the reply from the web service call - the payment status - to the order
message.
Add an assignactivity after the invoke activity
Call it setPaymentStatus
-
7/21/2019 SOASuite12c_Tutorial.pdf
97/391
-
7/21/2019 SOASuite12c_Tutorial.pdf
98/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 98 of 392
This is a good point to deploy and test the project again. Feel free to also debug the project, and the
BPEL processes to get a feel for what theyre doing.
Please follow the steps outlined in Test the SOA project with EM FMWC in the Appendixsection.
Use OrderSample_soap.xml as sample message.
When you now open the flow instance in EM FMWC and choose the Compositestab, you will see both
composites within one flow instance:
ProcessOrderis the initiating composite
ValidatePaymentis participating.
You will also see the service bus proxy service as part of the flow trace.Make sure there are no errors in the flow trace.
Change the sample message to cause the payment validation to be denied (increase the
order items to extend the daily limit of the credit card, the daily limit is $1000).
Also verify that the PaymentStatussensor is still set correctly.
-
7/21/2019 SOASuite12c_Tutorial.pdf
99/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 99 of 392
Update the order status in the Database
The database adapter, which updates the order status, has already been defined within the
ProcessOrder template and an invocation of the service has been added to the
validateAndProcessOrderBPEL process:
This invocation of the database adapter will now update the order status to Deniedor Authorized,
according to the return value of validatePayment.
-
7/21/2019 SOASuite12c_Tutorial.pdf
100/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 100 of 392
Use an inline BPEL subprocess for the order status update
The order status update will be used at least once more in the same BPEL process. For this, you have to
repeat the same assign and invoke activities that we already used.
This is an error prone process and every time a change is necessary, it has to be implemented in allthose places.
To avoid this, we introduced a new feature in SOA Suite 12c called a BPEL subprocess.
BPEL sub-processes come in two flavorsstandalone, and inline.
About the standalone subprocess:
This is a fragment of a BPEL process, which includes a number of activities that will be re-used
across a number of other BPEL processes.
The standalone subprocess doesnt have an interface and can only be called from another BPEL
process, but it can have partner links.
In the composite view, the wire to a subprocess is shown as dotted line to indicate that this is
not a wire between actual components.
We introduced a new call activity in BPEL to be able to invoke a subprocess.
In the first release of SOA Suite 12c, we only support subprocesses in the same composite
Standalone subprocesses are visible in the component palette.
About the inline subprocess:
For groups of activities that are re-used within just one BPEL process, you can use an inline
subprocess.
Its part of the parent BPEL process code and not visible in thecomposite view.
We also use a call activity for this.
You can either define parameters to be set or use the process parameters.
The inline subprocess is visible in the BPEL palette.
Activities must be in a scope in order to be converted into a subprocess
At run-time, the subprocess code is re-entrant and re-usableonly one copy is stored in
memory, even if it is called 20 times.
To learn more about BPEL subprocesses, please see chapterOracle SOA Suite Templates and Reusable
Subprocessesinsoa-dev-guide.pdf.
http://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.htmlhttp://docs.oracle.com/middleware/1213/index.html -
7/21/2019 SOASuite12c_Tutorial.pdf
101/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 101 of 392
The order status update scope will be converted into an inline BPEL subprocess as its only used within
the same BPEL process.
Collapse the scope updateOrderStatusScope.
Right-click on the scope.
ChooseConvert to a Subprocess.
-
7/21/2019 SOASuite12c_Tutorial.pdf
102/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 102 of 392
Name it updateOrderStatusSP (By default it uses the scope name)
Leave Replace Scope with Subprocess Call checked. This will automatically replace the current
scope with a Callactivity
Optionally set a label, comment and choose an image for your new subprocess.
Click OK
You will now see a new call activityin your process
You can also see the subprocess in the palette under Subprocesses
-
7/21/2019 SOASuite12c_Tutorial.pdf
103/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 103 of 392
You can see and edit the definition of the subprocess when switching from Main Processto the
subprocesson top of the BPEL editor
You can see all partner links that are available in the main process, in case you want to add
another invoke.
You can make changes to this subprocess, which will be reflected in every call.
-
7/21/2019 SOASuite12c_Tutorial.pdf
104/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 104 of 392
Before we test the process, lets change the name of the call activity.
Select the call activity and change the name in the property inspector to updateOrderStatus.
Deploy, test and debug the process again, the actual result should not change.
You will notice that you now see the call activity in your audit trail with the activities included in the
subprocess:
-
7/21/2019 SOASuite12c_Tutorial.pdf
105/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 105 of 392
Similarly, in the flow trace, we also show the call activity and all activities included in the subprocess
below it:
-
7/21/2019 SOASuite12c_Tutorial.pdf
106/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 106 of 392
Add an Order Number sensor to the Order Process composite
We already have a sensor for the payment status, now we will also define one for the order number.
At this point, composite sensors can only be set on services and references. The SOAP interface
receiveorder_client_ep returns the orderNumberin the order acknowledgement message. Thats
where we will define the sensor.
Go to the composite view of the ProcessOrdercomposite.
Right-click on the SOAP interface receiveorder_client_ep
Choose Configure Sensors
Choose receiveorder_client_ep
Click the + icon to create a new composite sensor
Name: OrderNumber
This sensor will be created from a variable
-
7/21/2019 SOASuite12c_Tutorial.pdf
107/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 107 of 392
Pick the OrderNumberin the outmessage
Click OK
-
7/21/2019 SOASuite12c_Tutorial.pdf
108/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 108 of 392
Optionally: use expressions and filters to define the sensor
Make sureEnterprise Manageris checked, so that you can see the sensor in the flowtrace
Click OK
Click OK
Note the sensor icon
Deploy and test the composite
Check to see if the sensor is set in the Flow Trace of the new instance together with the
payment status sensor.
-
7/21/2019 SOASuite12c_Tutorial.pdf
109/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 109 of 392
Update the order status to ReadyForShip if the payment has been authorized
If the payment is valid, the order status is set to ReadyForShip in the database. This status update will
trigger the order fulfillment process, which will be built in a latter chapter.
If the payment is not valid, processing ends here.
First we add an Ifstatement. The order will only continue if the payment was authorized. Otherwise
processing is stopped and an email is sent to the customer informing him of his unauthorized payment.
Ifin BPEL 2.0 is the equivalent of switchin BPEL 1.1.
Open the validateAndProcessOrderBPEL process if its not already open
Add an Ifunder the sub process call. (You find the If activity under BPEL ConstructsStructuredActivities)
-
7/21/2019 SOASuite12c_Tutorial.pdf
110/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 110 of 392
We will check if the payment has been Authorizedor Denied
Select the If construct and open the property inspector window, if its not already open.
Change the name to IfPaymentValid
Edit the condition by clicking the icon for the XPath Expression Builder
Expand the variable order and enter the status element into the Expression field by clicking
Insert Into Expression
-
7/21/2019 SOASuite12c_Tutorial.pdf
111/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 111 of 392
Add = Authorized
ClickOKto complete the expression
Back in the BPEL process, change the Iflabel to Authorizedby clicking on the label
-
7/21/2019 SOASuite12c_Tutorial.pdf
112/391
Oracle ConfidentialDo not distribute to third parties
Chapter 3: Process Order: Build Process Order Composite Page 112 of 392
Click OK
The elsebranch is not necessary, as the processing will just stop if the payment has been
denied. Delete the elsebranch:
Confirm the deletion
If the payment has been authorized, the processing of the order is complete and we update the
order status to ReadyForShip
In the Ifbranch, add an assignactivity to update order status to ReadyForShip
Name it assignReady