12c SOA Design Composites1
Short Description
12C student guide...
Description
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications Student Guide – Volume I D84361GC10 Edition 1.0 | November 2014 | D89147
Learn more from Oracle University at oracle.com/education/
Author
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Ron Pinkerton
Disclaimer
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Technical Contributors and Reviewers Simone Geib Jay Kasi David Mills Ted Witiuk Pete Laseau Tom Barrett
This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and print 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 your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Restricted Rights Notice
Editors Vijayalakshmi Narasimhan Smita Kommini Publishers
If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable:
s
an r t n
U.S. GOVERNMENT RIGHTS The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract.
no a s ฺ a h ) Giri Venugopal ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l K R A ON Michael Sebastian Pavithran Adka
Trademark Notice
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
K
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Contents
1
le
iii
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Introduction to Service-Oriented Architecture Agenda 1-2 Target Audience 1-3 Prerequisites 1-4 Course Objectives 1-5 Course Scope 1-6 Course Map 1-7 Where Can I Learn More? 1-8 Objectives 1-9 Agenda 1-10 Problem Statement 1-11 Definition of SOA 1-12 Building a Service Portfolio 1-13 Assembling Services as Composite Applications 1-14 Service Component Architecture 1-15 Elements of a Service Component Architecture 1-16 Why Standards Are Important in SOA 1-17 Benefits of SOA 1-18 Quiz 1-19 Agenda 1-20 Oracle SOA Suite 12c: Introduction 1-21 Elements of a SOA Composite Application 1-22 Oracle Mediator 1-24 Oracle BPEL Process Manager 1-25 Oracle Business Rules 1-26 Oracle Human Workflow 1-27 Oracle Adapters 1-28 JDeveloper 1-29 SOA Composer 1-31 Quiz 1-32 Agenda 1-33 WebLogic Application Server 1-34 Oracle Metadata Repository 1-35 Business Events and the Event Delivery Network 1-36 Oracle Web Service Manager Policy Manager 1-38
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
SOA Run Time 1-39 Quiz 1-40 Agenda 1-41 Production Environment: Example 1-42 SOA Quick Start Installation 1-43 Creating a Domain 1-45 Summary 1-46 Agenda 1-47 Practice 1 Overview 1-48 Course Environment 1-49 Launching the Quick Start Installer 1-50 First Look: JDeveloper 1-51 Starting the Integrated Server 1-52 Configuring a Domain 1-53
A
Getting Started with Composite Applications Objectives 2-2 Agenda 2-3 How Services Communicate 2-4 Synchronous and Asynchronous Interactions 2-5 Describing a Message with XSD 2-6 Web Services Description Language 2-7 Abstract WSDL 2-8 Concrete WSDL 2-9 Quiz 2-10 Agenda 2-11 Mediator Components: Introduction 2-12 Routing Data 2-13 Transforming Data 2-14 Filtering Data 2-15 Validating Data 2-16 Mediator as a Callable Service 2-17 Dynamic and Static Routing Rules 2-18 Additional Features of Mediators 2-19 Agenda 2-20 Adapters: Introduction 2-21 File Adapter 2-23 Quiz 2-24 Agenda 2-26 Examining the composite.xml Source 2-27 Creating a Mediator 2-28
iv
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
2
N KO
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Creating an Adapter 2-29 Summary 2-30 Practice 2 Overview 2-31 Application Navigator 2-32 Creating a SOA Application 2-33 Component Palette 2-35 Creating a WSDL 2-36 Creating a File Adapter 2-37 Configuring Mediator Routing Rules 2-38 Project Files 2-39 3
le
v
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Managing and Monitoring a Composite Application Objectives 3-2 Agenda 3-3 Managing SOA Applications: Overview 3-4 Deploying a Composite Application 3-5 Building the Service Archive 3-6 Deploying Multiple SOA Projects 3-7 Versioning Applications 3-8 Redeploying an Application 3-9 Deployment Options 3-10 Examining the Deployment Log 3-12 Application State 3-13 Configuration Plans: Overview 3-14 Modifying a Configuration Plan 3-15 Managing the Life Cycle of a Composite Application 3-16 Quiz 3-17 Agenda 3-18 Testing a Composite Application 3-19 Initiating a Test in JDeveloper 3-20 Viewing Responses in JDeveloper 3-21 Managing SOA Applications with JDeveloper 3-22 Enterprise Manager 3-23 Oracle Enterprise Manager: Overview 3-25 Testing a Composite Application 3-26 Response Tab 3-27 Flow Trace 3-28 Quiz 3-29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary 3-30 Practice 3-1 Overview 3-31 Practice 3-2 Overview 3-32 Practice 3-3 and 3-4 Overview 3-33 4
Working with Data Objectives 4-2 Agenda 4-3 Data Standards 4-4 Role of XSD Attributes 4-5 XSL Transformations 4-6 Using XPath Functions 4-7 Using the Mapper in JDeveloper 4-8 Auto Map 4-9 XPath Functions 4-10 Optional and Repeating Data 4-11 Testing Transformations 4-12 Quiz 4-13 Agenda 4-14 XQuery: Introduction 4-15 XQuery 4-16 XSLT Versus XQuery 4-17 Using XQuery Transformations 4-18 Agenda 4-19 Working with Native Format Data 4-20 Native Data Transformation 4-21 Invoking the Native Format Builder 4-22 Specifying File Name and Native Data Format 4-23 Specifying a Sample File 4-24 Defining a Schema for a Native Format 4-25 Summary 4-26 Practice 4 Overview 4-27 Practice 4 Overview: 4-28
le
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
an r t n
A
N KO
5
Using JMS and JDBC Adapters Objectives 5-2 Agenda 5-3 Binding Components 5-4 JCA Adapters 5-5 Oracle JCA Adapters 5-6 Monitoring Adapters 5-7
vi
s
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz 5-8 Agenda 5-9 JMS Specification: Definition 5-10 JMS Message 5-11 JMS Messaging 5-12 JMS Resources 5-13 Adapters and the WebLogic Application Server 5-14 Connection Management 5-15 Oracle JMS Adapter 5-16 Configuring JMS Resources with WebLogic Administration Console 5-18 Defining a Message Destination 5-19 Defining a Connection Factory 5-20 Defining a Connection Pool 5-21 Associating the JMS Connection Pool to a Connection Factory 5-22 JMS Adapter as Producer 5-23 JMS Adapter as Consumer 5-25 Quiz 5-26 Agenda 5-27 Database Adapter: Introduction 5-28 Configuring a Database Adapter 5-29 Configuring a Database Adapter Service Connection 5-30 Configuring a Select Statement: Operation Type 5-31 Configuring a Select Statement: Importing Tables 5-32 Configuring a Select Statement: Filtering Attributes 5-33 Configuring a Select Statement: Defining Selection Criteria 5-34 Configuring a Select Statement: Editing the Expression 5-35 Configuring a Select Statement: Advanced Options 5-36 Database Adapter Runtime Connections 5-38 Transactionality 5-39 Quiz 5-40 Summary 5-41 Practice 5-1 to 5-4 Overview 5-42 Practice 5-5 to 5-7 Overview 5-43 Optional Challenge Practice 5-8 Overview 5-44 Optional Challenge Practice 5-9 Overview 5-45
le
an r t n
s
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
6
Introduction to BPEL Objectives 6-2 Agenda 6-3 Business Processes and BPEL 6-4 Parts of a BPEL Process 6-5
vii
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
BPEL, WSDL, and XSD 6-6 Partners, Partner Links, and Roles 6-7 Variables in BPEL 6-8 Interacting with Partners 6-9 Synchronous Process Concepts 6-11 Asynchronous Process Concepts 6-12 Assigning Values to Variables 6-13 Ordering Execution with a Sequence Activity 6-14 Structuring a Process with a Scope Activity 6-15 Global and Local Variables 6-16 Manipulating Data in Variables 6-17 Transformation 6-18 Quiz 6-19 Agenda 6-20 BPEL Design Editor 6-21 Creating a BPEL Process 6-23 Mapping Values to Variables 6-24 Using Expression Builder 6-25 Testing a BPEL Process 6-26 Examining the BPEL Process Audit Trail 6-27 Examining the BPEL Process Visual Flow 6-28 Quiz 6-29 Summary 6-30 Practice 6 Overview 6-31
le
NA7 O K
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
an r t n
More BPEL Activities Objectives 7-2 Agenda 7-3 Conditional Branching with the If Activity 7-4 Processing with the Flow Activity 7-5 Using the nonBlockingInvoke Property 7-6 Parallel and Sequential Looping with the forEach Activity 7-7 Suspending a Process with the Wait Activity 7-9 Waiting for a Message with the Pick Activity 7-10 Looping with the While Activity 7-11 Indexing XML Arrays Dynamically 7-12 Quiz 7-13 Basic BPEL 2.0 Activities 7-14
viii
s
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Structured and Extension BPEL 2.0 Activities 7-16 Summary 7-18 Practice 7 Overview 7-19 Before You Begin 7-22 8
le
ix
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Handling Faults in Composite Applications Objectives 8-2 Agenda 8-3 Faults: Overview 8-4 Fault-Handling Challenges 8-5 Fault-Handling Options 8-6 Agenda 8-7 Managing Faults in a Mediator 8-8 Quiz 8-9 Agenda 8-10 Faults in BPEL Processes 8-11 Faults in Synchronous BPEL 8-12 Synchronous Service Faults 8-13 Review: Scope Activity 8-14 Fault Handlers 8-15 Returning Faults from a Synchronous Process 8-17 Returning Faults from an Asynchronous Process 8-18 Catching BPEL Runtime Faults 8-20 Faults That Cannot Be Handled 8-21 Throwing Faults 8-22 Quiz 8-24 Agenda 8-26 Review: Transactionality 8-27 Compensation 8-28 Compensation Handlers 8-29 Invoking Compensation 8-30 Quiz 8-31 Agenda 8-32 Fault Management Framework: Overview 8-33 Fault Management Framework and BPEL 8-34 Fault Management Framework and Mediator 8-35 Defining a Fault Policy Document 8-36 Specifying a Default Action 8-37 Defining Fault Bindings 8-38 Quiz 8-39 Agenda 8-40
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Recovering Faults with Enterprise Manager Fusion Middleware Control 8-41 Accessing a Recoverable Fault 8-42 Recovering a Fault Condition 8-43 Summary 8-45 Practice 8-1 to 8-4 Overview 8-46 Practice 8-5 Overview 8-49 9
le
x
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Implementing Human Workflow and Notifications Objectives 9-2 Agenda 9-3 Human Tasks: Introduction 9-4 Human Tasks: Overview 9-5 Human Task Service Component 9-6 Human Tasks in a Composite Application 9-7 Adding a Human Task to a Composite Application 9-8 Configuring the Human Task 9-9 Configuring the Task Outcomes 9-10 Adding Human Task Parameters 9-11 Assigning Task Participants 9-12 Configuring Task Participants 9-13 Configuring the Stages of a Task 9-15 Configuring Expiration and Escalation Settings 9-16 Configuring Notification Settings 9-17 Adding a Human Task to a BPEL Process 9-18 Quiz 9-20 Agenda 9-21 Task Display Forms 9-22 Generating a Task Display Form 9-23 Deploying Task Display Forms 9-24 Accessing the Worklist Application 9-25 Viewing and Acting on Task Information 9-26 Quiz 9-27 Agenda 9-28 Working with Notification Services 9-29 Oracle User Messaging Service (UMS) 9-30 Configuring UMS Notification Properties 9-31 Configuring the User Messaging Email Driver 9-32 Viewing and Testing Email Notifications 9-33 Sending Email Notification from BPEL 9-34 Sending a Notification to a User’s Preferred Channel 9-35 Quiz 9-36
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary 9-37 Practice 9 Overview 9-38 10 Sharing Functionality in Oracle SOA Suite Objectives 10-2 Agenda 10-3 Design-Time Metadata Services (MDS) Repository 10-4 Quiz 10-6 Agenda 10-7 Templates: Overview 10-8 Creating and Using Templates 10-10 Using Project Templates 10-11 Using Service Component Templates 10-12 Using BPEL Scope Activity Templates 10-14 Quiz 10-15 Agenda 10-16 BPEL Subprocesses: Introduction 10-17 Stand-Alone Subprocess 10-19 Calling a Stand-Alone Subprocess 10-20 Inline Subprocess 10-21 Comparing Stand-Alone and Inline Subprocesses 10-22 Creating an Inline Subprocess 10-23 Calling an Inline Subprocess 10-24 Creating a Stand-Alone Subprocess 10-25 Calling a Stand-Alone Subprocess from BPEL 10-27 Differences Between Templates and Subprocesses 10-28 Quiz 10-29 Summary 10-30 Practice 10 Overview 10-31
le
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
11 Using the REST Adapter Objectives 11-2 Agenda 11-3 REST: Overview 11-4 REST Queries 11-5 Comparing REST and SOAP: Two Ways to Access Web Services 11-6 Example Use Cases for REST and SOAP 11-7 Agenda 11-8 Supported Features in Oracle SOA Suite 11-9 REST Adapter 11-10 Creating a REST Binding 11-11
xi
s
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Adding an Operation Binding 11-12 The Finished Binding Component 11-13 Testing the Component 11-14 Examining the Results 11-15 Quiz 11-16 Summary 11-17 Practice 11 Overview 11-18 Practice 11-1 to 11-4: Overview 11-19 12 Developing Business Rules Objectives 12-2 Agenda 12-3 Business Rules: Introduction 12-4 Business Rules Component 12-5 Business Rules Use Cases 12-6 Declarative Rules 12-8 Facts 12-9 Decision Tables 12-10 Value Sets 12-11 Globals 12-12 Rulesets 12-13 Rules Dictionary 12-14 Oracle Business Rules RL Language 12-15 Oracle Business Rules SDK 12-16 Oracle Business Rules Components 12-17 Editing Business Rules at Run Time 12-18 Quiz 12-19 Agenda 12-20 Business Rules Component: Overview 12-21 Creating a Business Rules Service Component 12-22 Adding a Business Rule to a BPEL Process 12-23 Configuring a Business Rule in a BPEL Process 12-24 Examining Business Rules Component Files 12-25 Editing the Rules Dictionary 12-26 Defining Globals 12-27 Defining Value Sets 12-28 Defining a Ruleset 12-29 Defining a Decision Table 12-30 Decision Functions 12-31 Quiz 12-32 Summary 12-33
xii
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 12-1 to 12-3 Overview 12-34 Practice 12-4 to 12-6 Overview 12-35 13 Designing and Managing Business Events Objectives 13-2 Agenda 13-3 Problem Statement 13-4 Event Delivery Network 13-5 Aligning SOA and EDA Through EDN 13-6 Events: Introduction 13-7 XSD 13-8 Event Definition Language 13-9 Event Publication 13-10 Event Subscription 13-11 Event Publication and Subscription 13-12 Quiz 13-13 Agenda 13-14 Creating an Event Definition 13-15 Configuring a Mediator to Publish Events 13-16 Configuring a Mediator to Subscribe to Events 13-17 Setting Event Delivery Consistency 13-18 Publishing Events in BPEL Components 13-19 Subscribing to Events in BPEL Components 13-20 Managing Events from Enterprise Manager 13-21 Viewing Event Subscriptions 13-22 Quiz 13-23 Summary 13-24 Practice 13 Overview 13-25 14 Testing and Debugging Composite Applications Objectives 14-2 Agenda 14-3 Testing SOA Composite Applications 14-4 Introducing the Composite Test Framework 14-5 Emulations and Assertions 14-6 Test Suites: Overview 14-7 Test Cases: Overview 14-8 Contents of a Test Case 14-9 Creating a Test Suite 14-10 Creating the First Test Case 14-11 Test Case Editor 14-12
xiii
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Test Case File 14-13 Creating Emulations 14-14 Emulating Events in a Test Case 14-15 Creating Assertions 14-16 Quiz 14-18 Agenda 14-19 Selecting the Test Cases to Run 14-20 Running the Test Cases 14-22 Examining Results of a Test Run 14-23 Quiz 14-25 Agenda 14-26 Troubleshooting Guidelines 14-27 Debugging SOA Composite Applications with the SOA Debugger 14-29 Starting the Debugger 14-30 Setting Breakpoints in Services 14-31 Setting Breakpoints in BPEL 14-32 Initiating Debugging 14-33 Examining Values 14-34 Frames 14-35 Stepping Through the Application 14-36 Ending a Debug Session 14-37 Summary 14-38 Practice 14-1 to 14-3 Overview 14-39 Practice 14-4 Overview 14-40
le
an r t n
s
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
NA15 Securing Composite Applications and Invoking Secured Services O K Objectives 15-2 Agenda 15-3 Web Service Security: Introduction 15-4 Securing Endpoints: Examples 15-7 Quiz 15-8 Agenda 15-9 Oracle Web Services Manager 15-10 OWSM Policy Framework 15-11 Components of Oracle Web Services Manager Architecture 15-12 Policies: Introduction 15-13 Policy Assertions 15-14 Types of Security Tokens 15-15 Security Assertion Markup Language (SAML) 15-17 Security Policies: Introduction 15-18 Quiz 15-19
xiv
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda 15-20 Securing SOA and Identity Propagation 15-21 Attaching a Policy to an Inbound Request 15-22 Attaching a Policy to an Inbound Request by Using Oracle JDeveloper 12c 15-23 Attaching a Policy to an Outbound Request 15-24 Attaching a Policy to an Outbound Request by Using Oracle JDeveloper 12c 15-25 Managing SOA Composite Application Policies 15-26 Summary 15-28 Practice 15 Overview 15-29 A Request-Response Patterns Request-Response Patterns A-2 One-Way Message Interaction A-3 Synchronous Interaction A-5 Asynchronous Interaction A-7 One Request, Multiple Responses A-8 One Request, a Mandatory Response, and an Optional Response A-9 Asynchronous Interaction with Timeout Pattern A-11 Asynchronous Interaction with a Notification Timer Pattern A-12 One Request, One of Two Possible Responses A-13 Multiple Requests, Multiple Responses A-15 Multiple Requests, First Response A-16 BPEL Deployment Descriptor Properties A-17
le
an r t n
s
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
xv
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
an r t n s
N KO A no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Introduction to Service-Oriented Architecture
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Target Audience
This course places strong emphasis on hands-on practices. It is written for a developer who has technical background, but does not have any experience with Oracle SOA Suite. The course provides an overview of SOA features and functionality. The goal of the course is to provide you with an understanding of Oracle ble SOA Suite, and help you to arrive at a level of comfort by using it to a r e create and configure composite applications. nsf
a
tr n no
a s a h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l targeted at application architects, business analysts, IT managers, K is primarily This course R and SOA project managers. In addition, technical personnel who are interested in using the NA O K SOA platform, SOA administrators, and developers will find this course useful for explaining basic concepts and introducing the Oracle SOA product suite. However, it does not teach how to develop production-level composite applications or how to administer SOA deployments.
Oracle SOA Suite 12c: Build Composite Applications 1 - 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Prerequisites This course assumes that: • You have completed the Oracle University course titled XML Fundamentals or have equivalent knowledge of XML. This helps in understanding principles related to XML documents, XPath, XML Schema, and XML Namespace. • Your technical background includes an understanding of web service concepts such as Web Services Description ble a r Language (WSDL), SOAP, and Universal Description, sfe n Discovery and Integration (UDDI) -tra
on n a s a h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J Kwho have lsome knowledge of the concepts listed in the slide will benefit from most Students R Acourse’s content. ofN the O K
Oracle SOA Suite 12c: Build Composite Applications 1 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Course Objectives After completing this course, you should be able to: • Orchestrate business process flows by using BPEL • Work with Mediator components with routing rules, filters, and transformations • Implement a Business Rule component with IF/THEN rules and Decision Tables • Test, debug, and troubleshoot a SOA composite application • Initiate SOA composite applications by using the Event ble a r fe Delivery Network s n tra • Apply security policies to service endpoints to secure n no interactions a s ฺ a h • Implement Human Workflow with Human Task ) ide m u o components ฺc nt G m b • Describe SOA conceptsin and ฺi related de technology u t • Create a SOA composite by using JDeveloper in@ application is S
kja se th r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Course Scope SOA Suite Installation • • • • • • • • •
Oracle JDeveloper Oracle Enterprise Manager Service Infrastructure Oracle Mediator Oracle Adapters Oracle Business Rules Oracle BPEL Process Manager Human Workflow Business Events and Events Delivery Network Oracle Metadata Repository Oracle WSM Policy Manager Oracle User Messaging Service
• • • • • • •
Spring Context Oracle Business Activity Monitoring Oracle B2B Oracle Service Bus Oracle Enterprise Scheduler Managed File Transfer Oracle Event Processing
A
N KO
s
an r t n
no a s ฺ a h ) Thisicourse de m u o G these ฺc ntexplores m b topics. nฺi Stude i @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK • • •
le
Oracle SOA Suite 12c: Build Composite Applications 1 - 6
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Course Map Introduction to SOA The Basics
Focus on BPEL Tools and Techniques
Getting Started
Working with Data Introduction to BPEL Human Tasks
Managing and Monitoring
JMS and JDBC Adapters
More BPEL Activities Sharing Functionality
Fault Handling in BPEL The REST Adapter
s
an r t n
no a s ฺ Business Rules Events a h ) ide m features u o ฺc nt G m Testing and b work smarter, nฺi Stude Security i Debugging not harder in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R NA concepts
KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 7
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Where Can I Learn More? Topic
Website
Education and Training
http://education.oracle.com
Product Documentation
http://docs.oracle.com
Product Downloads
http://www.oracle.com/technology/software
Product Articles
http://www.oracle.com/technetwork/articles
Product Support
http://www.oracle.com/support
Product Forums
http://forums.oracle.com
Product Tutorials
http://www.oracle.com/oll
Sample Code
http://www.samplecode.oracle.com/
le
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
s
Oracle SOA Suite 12c: Build Composite Applications 1 - 8
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Describe Service-Oriented Architecture (SOA) • Explain services and key standards • Describe Service Component Architecture (SCA) • Describe the functionality of Oracle SOA Suite 12c service components and adapters le • Describe how WebLogic Application Server is used by erab sf n Oracle SOA Suite a r
-t n o an s ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l is intended to present some important vocabulary and concepts K This introductory lesson R related NA to Service-Oriented Architecture. It is also intended to present a high-level overview of O K the components and features of Oracle SOA Suite 12c, and to relate those components and features to SOA.
Oracle SOA Suite 12c: Build Composite Applications 1 - 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Problem Statement
Field Service Scheduling
Order Processing
Account Management
Customer Status
Customer Status
Shipping Charges
Product Availability
Product Availability
Order Status
Verify Customer Credit
Verify Customer Credit
le
b a r e f
Order Status
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b Marketing CRM Financenฺi Warehouse Other Biz Trading de u i t System System System Mgmt Unit Partner @ is S n i kja se th r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J cein many ways, some of which are proprietary approaches that have i l K Integration can be done ARsilo (stand-alone) systems to be integrated, typically in a point-to-point manner. enabled N KOHowever, the point-to-point approach tends to be brittle, and difficult to maintain over time. Functionality is often duplicated across applications. Changes to a single application interface have the potential to impact large numbers of systems, each of which may need modification—a time-consuming and expensive proposition. Vendor-specific integration technologies such as Tuxedo have enabled systems to standardize the way integration is done within their own implementation, but because Tuxedo does not provide native support for web services, it keeps the technology confined to the organization that embraced it. The computing industry worked to create a standardized protocol and software integration method called Common Object Request Broker Architecture (CORBA) that enabled systems to integrate by using a standard (non-XML-based) interface definition language for generating code templates that could be distributed. Although it is possible to apply a SOA approach with CORBA, its lack of widespread adoption and accessibility, in addition to its remote procedure call mechanisms, make it costly to implement and less friendly to use across an intranet or the Internet.
Oracle SOA Suite 12c: Build Composite Applications 1 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Definition of SOA
An IT strategy that organizes the discrete functions contained in enterprise applications into interoperable, standards-based services to be combined and reused quickly to meet business requirements
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce attempts to overcome many of the shortcomings of earlier i l K Service-oriented architecture AR technologies by embracing the concept of a service. A service is a discrete, integration N KOdecoupled unit of business functionality that is exposed and available to (ideally) all applications in the enterprise. Services are the building blocks for a SOA-enabled application. They have functionalitydescribed standard interface and message structure definitions. Multiple services are assembled and reused to more quickly create applications that can better support changing business processes. The SOA approach to software systems enables a consumer of a service to be decoupled from the service provider. With SOA, services are accessed by using standard protocols (the glue), which enable interoperability from decoupled functions.
Oracle SOA Suite 12c: Build Composite Applications 1 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Building a Service Portfolio
Field Service Scheduling
Order Processing
Account Management
Service Portfolio
Customer Status
Verify Customer Credit
Product Availability
Order Status
Shipping Charges
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o G ฺc Marketing CRM Finance Warehousent Other Biz Trading m b e i ฺ d System System System Mgmt Unit Partner in Stu @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K When embarking onl a SOA approach to systems integration, integrators begin by examining R business NA process requirements to identify functionality to be used as a “service” unit to help O K complete a business process. A service portfolio is identified from a set of services that are required for implementing one or more business processes within a business domain. A service portfolio can be realized by a combination of new and reused functionality. Existing functionality can be wrapped as services by using the adapter technology. New services can be created with SOA-enabled technologies, including web services, SCA composite applications, BPEL, and a service bus. When a collection of services has been identified to serve a business process, it is recommended to store information about these services, their interfaces, and their message structures in a common location such as an enterprise repository. This facilitates sharing and reusability from design through production. Coupled with a service registry, an enterprise repository can migrate runtime service information into the development, test, and production operational environments. Coupling an enterprise repository and a service registry enables an organization to implement strong SOA governance strategies for services throughout a service’s life cycle, from the design-time environment to the runtime environment.
Oracle SOA Suite 12c: Build Composite Applications 1 - 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Assembling Services as Composite Applications
Field Service Scheduling
Customer Status
Verify Customer Credit
Order Processing
Product Availability
Account Management
Order Status
Shipping Charges
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o G ฺc Marketing CRM Finance Warehousent Other Biz Trading m b e i ฺ d System System System Mgmt Unit Partner in Stu @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J lservice portfolio is created, the necessary services are assembled to K When a satisfactory R form NAa composite application to address a specific business requirement. Services are reused O K as appropriate in multiple composite applications. As a result, development time and redundant functionality are dramatically reduced.
Oracle SOA Suite 12c: Build Composite Applications 1 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Service Component Architecture Service Component Architecture (SCA) is a set of specifications that describe a model for building applications by using a Service-Oriented Architecture. • Services are assembled to form a composite application that creates a solution that addresses a specific business requirement. • Composite applications may contain new services ble a r (specifically for the application) and business functionssfe an r from existing systems and applications (reused in-the t on n composite application). a s a h deฺ of services • SCA provides a model for both the composition ) ui om t Gincluding and the creation of service components, reuse of c ฺ m n b existing application functions. ude inฺi
t S @ n s jai e thi k r a © 2014,uOracle s and/or its affiliates. All rights reserved. n Copyright o k e to ( AIN icens J l Architecture (SCA) specification provides a programming model for K Component The Service R building NA applications and systems based on a SOA approach. SCA is based on the concept O K that a business function is provided as a series of services. These composite applications
may contain new services (specifically for the application) and business functions from existing systems and applications (reused in the composite application). SCA provides a model for both the composition of services and the creation of service components, including reuse of existing application functions. When assembled together into a composite application, they are managed, maintained, and deployed together. This streamlines and simplifies management of cooperating service components compared to earlier technologies that managed SOA applications as a set of individual services. Because its functionality can be exposed as a service through service entry points, the SOA composite application is itself a coarse-grained service. For more information about the SCA initiative, visit: http://www.oasis-opencsa.org/sca.
Oracle SOA Suite 12c: Build Composite Applications 1 - 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Elements of a Service Component Architecture
Composite Application
Assembly Model Assembly Specifications
BPEL
Java
Others
Client and Implementation Specifications Implementation Language Specifications
le
b a r e f
s
an r t n
o nJDBC a Others s a ฺ ) h ide m Policy Framework o t GuBindings c ฺ m Access n Method Specifications b Infrastructure Service e i ฺ d in Stu Specifications @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l specifications. SCA isR aK collection of NA model specifications define a standard set of XML elements that are used to Assembly O K Security
Transactions
Reliable messaging
SOAP
JMS
define the structure and configuration of an SCA composite application.
Client & implementation (C&I) specifications define an implementation language, such as: • BPEL: The WS-BPEL Client and Implementation (BPEL C&I) model specifies how WSBPEL processes can be used as SCA components. • Java, C++, PHP: This specifies language-specific APIs and annotations, which enable the creation of service components and service clients that are built in these languages. Note: Oracle SOA Suite 12c implements BPEL and other components such as Mediator. At this time, it does not implement C++ or PHP. The spring framework can be used to integrate components that use Java interfaces into SOA composite applications. Policy framework specifications capture and express nonfunctional requirements, such as security of a service definition. The policy framework impacts the life cycle of components and compositions. It supports specification of constraints, capabilities, and quality of service (QoS) from component design through concrete deployment. Binding specifications define how services and references are accessed by using different transport types. There is a binding specification available for each different access method.
Oracle SOA Suite 12c: Build Composite Applications 1 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Why Standards Are Important in SOA Specifications forming a collection of standards
Service Component Architecture (SCA)
Assembly Model
Service Data Objects (SDO)
Data Access
Orchestration: Business Process Execution Language (WS-BPEL) Management WS-Policy WS-Security
WS-Reliable Messaging
WS-Security
Universal Description, Discovery, and Integration (UDDI)
Business processes Quality of service
le
b a r e f
s
an r t n
Discovery
no Description a s ฺ a SOAP, REST h ) ide Message m u o c JSON G XML, XSD, XQUERY, ฺXSLT, t m n b ฺi tuSMTP de HTTP(S),in IIOP, JMS, Transport @ is S n i kja se th r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cfunctions i l K Services are business that form the foundation for using a SOA approach to building R A applications. SOA applications aggregate functionality of related services to automate a N KObusiness process. In order to reuse services (a fundamental goal of SOA), service Web Services Description Language (WSDL)
functionality must be described by using standard interface and message structures. SOA-based approaches have, naturally, embraced many of the message standards illustrated in the graphic in the slide, including XML, XSD, and SOAP. These document structures are easily exchanged by using standard Internet protocols such as HTTP. This results in easier interoperability across intranet and Internet networks. Discovery and description standards such as WSDL and UDDI contribute to the reusability of services and help achieve independence of hardware, operating systems, and implementation languages. As their names suggest, the WS-Security and WS-Reliable Messaging standards describe standards for secure and reliable message delivery among service-based applications. BPEL provides XML grammar for describing a business process as a series of activities. The Service Component Architecture (SCA) and Service Data Objects (SDO) specifications are works in progress, guided by the OASIS organization. This work may lead to a new collection of standards with a SOA-enabled approach in mind.
Oracle SOA Suite 12c: Build Composite Applications 1 - 17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Benefits of SOA •
Reusability – Existing functionality within an application is reused across business organizations and processes.
•
Interoperability – Communication between services is not dependent on the platform. Services are loosely coupled to the application.
•
Scalability
le
b a r e – Applications are flexible to changing business requirements. sf n a tr • Cost efficiency n no is a – Costs are reduced and delivery of new functionality s ฺ a h accelerated because existing resources are reused and e ) d i m u integration of business resources based. G ฺco is nstandards t m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R NA
KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz Service Component Architecture (SCA) is a competing standard to Service-Oriented Architecture (SOA). a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARb N KOFalse. The Service Component Architecture (SCA) specification is complementary to SOA. It provides a programming model for building applications and systems based on a SOA approach.
Oracle SOA Suite 12c: Build Composite Applications 1 - 19
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle SOA Suite 12c: Introduction Oracle SOA Suite 12c provides a comprehensive suite of components for developing, securing, and monitoring SOA, including: • Service components, which are the building blocks that are used to construct a SOA composite application • Service engines, which implement service components at run time ble a r • Adapters, which provide connectivity to functionality nsfe tra outside the composite application n no a • Service infrastructure, which provides the internal s ฺ a h message transport infrastructure capabilities ) idefor m u o connecting service components data flow tG mฺcandnenabling
nฺib Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e K JSuite isliaccomplete OracleR SOA set of service infrastructure components that enable services A toN be created, managed, and orchestrated into SOA composites by using Business Process KOExecution Language (BPEL) and SCA. Together, these components provide task services, decision (rule-based) services, and adapter services. The unified architecture provides a comprehensive, standards-based platform for deploying and managing composite business applications with content and human workflow steps.
Oracle SOA Suite 12c: Build Composite Applications 1 - 21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Elements of a SOA Composite Application
1
2
3
4
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A K J islianceassembly of services, service components, and references that are A SOAR composite NA and deployed together in a single application. Wiring between the service, service Odesigned
K component, and reference enables message communication. The composite processes the information described in the messages. The graphic in the slide provides an example of a composite that includes an (inbound) exposed service, a variety of service components interacting, and several external references.
1. Services provide the composite client with an entry point to the SOA composite application. The service advertises its capabilities (also known as operations) to external applications with a Web Services Description Language (WSDL) file. The binding of the service describes the protocols that can communicate with the application. Examples include SOAP/HTTP or a JCA adapter. 2. Service components are the building blocks of a SOA composite application. Oracle SOA Suite 12c includes the following components: - The BPEL Process component enables design and execution of a business process that integrates a series of business activities and services into an end-to-end process flow. - The Business Rules component provides the means of making business decisions based on defined rules. Oracle SOA Suite 12c: Build Composite Applications 1 - 22
The Human Task component allows you to model a workflow that describes tasks for users or groups to perform as part of an end-to-end business process flow. - The Mediator component is used for validation, transformation, and routing of message data between components. 3. References enable messages to be sent from the SOA composite application to services that are external to the composite. 4. Wires enable you to graphically define the flow of messages within a single SOA composite application among services, service components, and references.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
-
Note: The wire is not an actual call, but an ability to call. (For example, the routing rules in Mediator or the invoke/receive activities in BPEL are actual calls, but they can only go alongside previously defined wires.)
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 23
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Mediator Oracle Mediator routes data from client applications to and from other service components, and from service components to external partners.
Validate
Filter
le
Transform
b a r e f
s
an r t n
no a s ฺ a h ) ide m u Route o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A licedata from client applications to and from other service components, K J routes OracleR Mediator and from service components to external partners. Using Oracle Mediator, you create routing NA O K services and rules for them. A routing service is the key component for moving a message It provides validation, filtering, routing, and transformation capabilities.
through the composite application—from its entry point to its exit point. The rules determine how a message instance processed by the routing service gets to its next destination. Using the rules, Oracle Mediator can perform the following actions: • Route: Determines the service component (BPEL process, business rule, human task, or Mediator) to which to send the messages • Validate: Provides support for validating the incoming message payload by using a schematron or an XSD file • Filter: If specified in the rules, applies a filter expression that specifies that the contents (payload) of a message be analyzed before any service is invoked • Transform: If specified in the rules, transforms document data from one XML schema to another, thus enabling data interchange among applications by using different schemas At run time, Oracle Mediator evaluates routing rules, performs transformations, applies optional time delays, and invokes another service. In addition, it can subscribe to and publish business events. A routing service can handle returned responses, callbacks, faults, and timeouts. Oracle SOA Suite 12c: Build Composite Applications 1 - 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle BPEL Process Manager
Business Process
le
Client
b a r e f
s
an r t n
noExternal a s ฺ Service a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e licManager K JProcess OracleR BPEL provides the standard for assembling a set of discrete A services N into an end-to-end process flow, thus radically reducing the cost and complexity of KOprocess integration initiatives. Oracle BPEL Process Manager enables you to orchestrate synchronous and asynchronous services into end-to-end BPEL process flows. You integrate BPEL processes with external services (known as partner links). You also integrate technology adapters and services, such as human tasks, transformations, notifications, and business rules within the process. Note: Business processes that are based on Business Process Modeling Notation (BPMN) can be built by using Oracle BPM (OBPM) Suite. The OBPM Suite is layered on top of the SOA Suite, and shares a unified run time.
Oracle SOA Suite 12c: Build Composite Applications 1 - 25
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Business Rules Oracle Business Rules enable dynamic decisions at run time. Policies, computations, and reasoning are automated. Business logic is separated from underlying application code. Oracle Business Rules implements conditions as IF-THEN structures or as Decision tables. decision Tables
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A liceenable dynamic decisions at run time, allowing you to automate K J Rules OracleR Business policies, NA constraints, computations, and reasoning while separating rule logic from underlying O K application code. Oracle Business Rules implements conditions as IF-THEN structures or as Rules Rules
decision tables. These conditions can be edited by a business analyst to update policies and computational values with little or no assistance from a programmer. Examples for using business rules include: • Dynamic processing: Rules can determine intelligent routing paths within a business process based on service-level agreements or other guidelines. • Data validation and constraint checks: Rules can validate input documents or apply additional constraints on requests. • Human task routing: Rules can be used to perform policy-based task assignments to dispatch tasks to specific roles or users, or for balancing tasks among users to control the task assignment load.
Oracle SOA Suite 12c: Build Composite Applications 1 - 26
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Human Workflow Worklist Application
create complete
assign
act
complete
le
b a r e f
s n a r Assignee n-t Task Service no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce processes require human interactions for approvals, exception i l K Many end-to-end business AR or other activities that are required to advance the business process. The management, N KOhuman workflow component provides the following features: • • • • •
Human interactions with processes, including assignment and routing of tasks to the correct users or groups Deadlines, escalations, notifications, and other features that are required for ensuring timely performance of a task (human task activity) Presentation of tasks to end users through a variety of mechanisms, including a worklist application Organization, filtering, prioritization, and other features that are required for end users to productively perform their tasks Reports, reassignments, load balancing, and other features that are required by supervisors and business owners to manage the performance of tasks
Oracle SOA Suite 12c: Build Composite Applications 1 - 27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Adapters
Adapters can be inbound or outbound.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce interface that exposes external application functionality in a form i l K Adapters provide a service R A that can be used by the SOA composite application components. An adapter converts N KOrequests and responses into a form that is suitable for other (external) systems. Oracle SOA Suite 12c is shipped with a variety of adapters that are commonly used to access functionality that is not normally available in a service-oriented context, such as: • File and FTP adapters for reading, writing, and transferring files • Database Adapter for interacting with relational database data • JMS Adapter for communicating asynchronously with other applications through message-oriented middleware (MOM) services, including Oracle Advanced Queuing and IBM MQ Because JCA adapters implement interfaces by using the Java Connector Architecture (JCA) API standards, custom adapters can be developed to expose existing functionality that is not usually available in a SOA application context. Adapters are an integration technology that extends the reach of the SOA composite application.
Oracle SOA Suite 12c: Build Composite Applications 1 - 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JDeveloper In addition to many other editing capabilities, JDeveloper supports a number of tools for SOA applications.
Composite Editor
BPEL Editor
Mediator Editor
le
b a r e f
s
an r t n
noTask Editor Human
a s a h deฺ ) om t Gui c ฺ m eBusiness n Rule Editor b i ฺ d in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l the development component of Oracle SOA Suite. It forms a K OracleR JDeveloper is comprehensive integrated service environment (ISE) for creating and deploying composite NA O K applications and managing the composite. Oracle JDeveloper enables developers to model, create, discover, assemble, orchestrate, test, deploy, and maintain composite applications based on services. The SOA Composite Editor enables you to create, edit, and deploy services, and also to assemble them in a composite application, all from a single location. These components are integrated into one application, and they communicate with the outside world through binding components such as web services and JCA adapters. The SOA Composite Editor enables you to use either of two approaches for designing SOA composite applications: • The top-down approach of building a composite application puts interfaces first and implementation next. For example, you first add BPEL processes, human tasks, business rules, and the Oracle Mediator routing services components to an application, and later define the specific content of these service components.
Oracle SOA Suite 12c: Build Composite Applications 1 - 29
The bottom-up approach takes existing implementations of service components and wraps them with web service interfaces for assembly into a composite application. For example, you first create and define the specific content of BPEL processes, human tasks, business rules, and the Oracle Mediator routing services components, and later create a SOA composite application to which you add these service components.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
•
Oracle JDeveloper provides the following additional editors to design service components: • Oracle BPEL Designer: You use Oracle JDeveloper to create a BPEL process service component, and then you use BPEL Designer to design the component. BPEL Designer is displayed when you double-click a BPEL process in the SOA Composite Editor. • Oracle Mediator Editor: You use Oracle JDeveloper to create a Mediator service component, and then you use Mediator Editor to design the component. Mediator Editor is displayed when you double-click a Mediator component in the SOA Composite Editor. • Human Task Editor: You use Oracle JDeveloper to create a human task service component, and then you use Human Task Editor to design the component. Human Task Editor is displayed when you double-click a human task in the SOA Composite Editor. • Business Rules Designer: You use Oracle JDeveloper to create a business rules service component, and then you use Business Rules Designer to design the component. Business Rules Designer is displayed when you double-click a business rule in the SOA Composite Editor.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 30
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
SOA Composer
le
b a r e f
s
an r t n
SOA Composer provides web-based access to various parameters at run time, allowing them to be edited without redeploying the project that uses them.
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A liceis an EAR file that is installed as part of the Oracle SOA Suite K JComposer OracleR SOA installation. NA It provides access to various configuration options at run time, allowing those O K options to be updated without needing to redeploy the project that uses them. Options typically accessed include domain value maps and business rules.
Oracle SOA Suite 12c: Build Composite Applications 1 - 31
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz One capability of Oracle Mediator is to route data within a composite application. a. True b. False
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARa N KOTrue. Oracle Mediator routes data from client applications to and from other service components, and from service components to external partners.
Oracle SOA Suite 12c: Build Composite Applications 1 - 32
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 33
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
WebLogic Application Server
Domain
Administration Server
le
Managed Servers
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce applications are Java Enterprise applications, they must run in a i l K Because SOA composite R Acontainer. Java WebLogic Server (WLS) provides the Java EE environment for these N KOcomponents to run. WLS is written in Java and executes on the standard JVM. The Oracle SOA Suite 12c platform comprises one Oracle WebLogic Administration server and one or more Oracle WebLogic Managed servers. Managed servers host application components and resources. The Administration server provides a central point for managing logical groups of resources that are organized into domains. Domains consist of one or more Managed server instances that are managed through a single Administration server. Note: There are no WLS programming interfaces that refer to domains. All domain-related information is stored in configuration files. Only an administrator is aware of domains. WLS domains can separate development, test, and production applications; administration and operational responsibilities; or organizational and business divisions.
Oracle SOA Suite 12c: Build Composite Applications 1 - 34
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Metadata Repository
Administration Server
Domain
Managed Servers
le
b a r e f
s
an r t n
no a XSD, WSDL s ฺ a h Metadata ) ide m u Services o G ฺc nRepository t m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceSuite 12c platform comprises one Oracle WebLogic Administration i l K The typical Oracle SOA AR server and one or more Oracle WebLogic Managed servers. The example in the slide shows N KOa typical installation. It includes a domain named soa_domain, which includes an Administration server and two Managed servers. The Oracle SOA Suite 12c runtime environment requires an Oracle database to maintain the SOA application configuration and runtime information. This database is known as the Oracle Metadata Services Repository, or MDS (for MetaData Services). MDS is used to manage deployed services and composite applications and this management happens transparently for the application developers and Oracle SOA Suite 12c administrators. MDS can also be used as a central location for storing and referencing shared service artifacts, such as business events, rule sets for Oracle Business Rules, XSLT files for Oracle Mediator, XSD and WSDL documents for Oracle BPEL Process Manager, and other service documents, which can be deployed in a sharable archive format known as the Metadata archive (.mar files).
Oracle SOA Suite 12c: Build Composite Applications 1 - 35
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Business Events and the Event Delivery Network Publish
Subscribe Event Delivery Network
le
describes
b a r e f
s
an r t n
no a EDL s ฺ a Metadata h ) ide m Service u o G ฺcRepository t m n b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cway i l K A business event is a for one application to notify another application of a significant R A to the business. When a business event is published, another application (or N Ooccurrence
K service component) can subscribe to it and initiate whatever processing is implied by that event. For example, when product stock levels are updated in an inventory database, an event can serve as a trigger or signal for another process to fulfill orders that have been on hold until products become available. A business event definition includes a unique name and a structure to contain information about the event. Developers declaratively define business events and specify conditions that dictate when the event is raised. As data is changed, these conditions are evaluated and all events whose raise conditions are met are fired. The Mediator component can publish or subscribe to events. Business events are typically asynchronous fire-and-forget (one-way) notifications of a business occurrence. The publisher does not rely on any service component receiving the business event to complete. It does not need to know where subscribers are and what they do with the data. Note: If the author of the event depends on the receiver of the event, messaging typically must be accomplished through service invocation rather than through a business event. Unlike direct service invocation, the business event separates the client from the server.
Oracle SOA Suite 12c: Build Composite Applications 1 - 36
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Events are defined by using the Event Definition Language (EDL) to specify the name and structure of an event. Definitions for business events are stored in the Oracle Metadata Services Repository (MDS), and published in the Event Delivery Network (EDN). The Event Delivery Network is designed to handle asynchronous messaging arising from a business or system event. EDN is not messaging infrastructure. It provides declarative publish-subscribe implementations. Subscribers can listen for events by XML namespace, by event name, or by applying content-based XPath filters. The Event Delivery Network (EDN) provides an application with a way to publish events so that a composite application with a Mediator component can subscribe to events that trigger execution of the composite application. The enforcement points are implemented in such a way that all request and response messages flow through a security pipeline (or filters) that can apply security policies to internal and external message exchanges. Note: Events will be covered in more detail in the lesson titled “Designing and Managing Business Events.”
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 37
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle Web Service Manager Policy Manager
Security Interceptor Framework
Request MTOM
Security
Addressing
Management
Response
Reliable Messaging
Web Service or SOA Component
le
b a r e f
s
Oracle WSM Policy Manager
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ce (WSM) Policy Manager provides the infrastructure for enforcing K JServiceliManager OracleR Web global NA security and auditing policies in the service infrastructure. By securing various O K endpoints and setting and propagating identity, it secures applications. Oracle WSM Policy Manager provides a standard mechanism for signing messages, performing encryption, performing authentication, and providing role-based access control. You can also change a policy without having to change the endpoints or clients for these endpoints, thus providing greater flexibility and security monitoring for your enterprise. In addition, Oracle WSM Policy Manager collects monitoring statistics with information about the quality, uptime, and security threats and displays them in a web dashboard. As a result, Oracle WSM Policy Manager provides better control and visibility over web services.
Oracle SOA Suite 12c: Build Composite Applications 1 - 38
SOA Run Time
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
SOA Infrastructure BPEL
Mediator
Business Human Rules Workflow
Service Engines
Event Delivery Network Enforcement Points
Normalized Message
Web Service Policy Manager
le
Binding Components
b a r e f
s
an r t n
o nJDBC a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceis a Java EE–compliant application running in Oracle WebLogic i l K The SOA infrastructure ARThe application manages composites and their life cycles, service engines, and Server. N KObinding components. Service engines execute the business logic for service components. File
Other
HTTP SOAP
JMS
Binding components execute the logic for adapters. The SOA infrastructure uses a normalized message structure while it provides the internal message routing infrastructure capabilities for connecting components and enabling data flow. Note: A normalized message is a Java Map object where the key(s) is the part name of the message and the value is a Document object representing the XML content. The SOA infrastructure: • Receives messages from the service providers or external partners through SOAP binding components, adapters, or the delivery API in the form of XML • Routes messages based on composite definition to the appropriate service engine If response messages are returned from the service engine, they are sent to their targets.
Oracle SOA Suite 12c: Build Composite Applications 1 - 39
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz Business events are a means for service components to exchange data synchronously. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARb N KOFalse. Business events are typically asynchronous fire-and-forget (one-way) notifications of a
business occurrence. The publisher does not rely on any service component receiving the business event to complete. It does not need to know where subscribers are and what they do with the data.
Oracle SOA Suite 12c: Build Composite Applications 1 - 40
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 41
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Production Environment: Example
Load Balancer
Load Balancer
SOA Suite
SOA Suite
•
WebLogic Server
•
WebLogic Server
•
WLS Node Manager
•
WLS Node Manager
•
Domain (soadomain)
•
Domain (soadomain) Admin Server
Cluster
Managed Server (soa_server1)
Managed Server (soa_server2)
le
b a r e f
s
an r t n
no a s 1.7.0_xx JDK 1.7.0_xx JDK a ฺ h e ) d i OL6U3 x86_64 u x86_64 om tOL6U3 c G ฺ m host:ensoahost2.example.com b i host: soahost1.example.com ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J Kshows an lexample of a multi-host production topology. It includes two hosts. The slide R A N • Each is running a version of Linux that is certified to work with 12c. O K Enterprise DB 11.2.X.X
• •
• • • •
Each has a JDK that is certified to work with 12c. Each has a WebLogic Server, SOA Suite, WebLogic Server Node managers, and a domain named soadomain. One host has an Oracle database whose version is certified to work with 12c. The other host has the Admin Server running in its domain. Both have Managed servers, and those Managed servers are clustered. Each has a stand-alone instance of Oracle HTTP Server as a load balancer.
Oracle SOA Suite 12c: Build Composite Applications 1 - 42
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
SOA Quick Start Installation Integrated WebLogic Server Domain (DefaultDomain) SOA Suite 12c JavaDB
soa_quickstart_generic.jar
JDK 1.7.0_40 OL6U3 x86_64
About 30 minutes to HelloWorld!
host: soa12c.example.com
•
Load Balancer
Load Balancer
SOA Suite
SOA Suite
WebLogic Server
•
le
b a r e f
s
an r t n
WebLogic Server
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce differs from a full installation in setup speed and limited uses. i l K A Quick Start installation R A N OThe Quick Start installer creates a new Oracle home that contains all the software required for Cluster
•
WLS Node Manager
•
WLS Node Manager
•
Domain (soadomain)
•
Domain (soadomain) Admin Server
Managed Server (soa_server1)
Managed Server (soa_server1)
Enterprise DB 11.2.X.X JDK 1.7.0_xx
JDK 1.7.0_xx
OL6U3 x86_64
OL6U3 x86_64
host: soahost1.example.com
host: soahost2.example.com
K a development or an evaluation environment on a single host.
After spending about 30 minutes running the installation wizard and completing related tasks, you can start developing and testing your SOA applications by running Oracle JDeveloper from the Oracle home. However, Quick Start installations are limited to one Administration server with no option to add Managed servers. You also cannot upgrade your Quick Start distribution to a production environment. Note: If you know that you want a production environment with additional Managed servers or clusters, you should not use Quick Start. Instead, see “Planning the Oracle SOA Suite and Business Process Management Installation” in Installing and Configuring Oracle SOA Suite and Business Process Management to install a full-scale development environment that can be scaled to a production environment.
Oracle SOA Suite 12c: Build Composite Applications 1 - 43
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
By default, the Oracle SOA Suite Quick Start installation contains Oracle JDeveloper and an Integrated WebLogic Server. JDeveloper is pre-configured with some JDeveloper IDE extensions so that you can create various kinds of applications immediately. These pre-installed IDE extensions include the following: • Oracle BPEL Process Manager • Oracle Human Workflow • Oracle Business Rules • Oracle Mediator • Oracle Service Bus • Oracle Enterprise Scheduler • SOA Spring Component Design Time • Oracle Event Processing Design Time
ble a r The Integrated WebLogic Server is pre-configured with Java DB and the runtime software fe for s n all the components listed in the preceding paragraph except Oracle Enterprise and -traScheduler n Oracle Event Processing. This means that you can run any JDevelopero application that does n Integrated WebLogic not use Oracle Enterprise Scheduler or Oracle Event Processing on a the s Server without any additional configuration. ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u ko e to ( AIN icens J l K R A ON
K
Oracle SOA Suite 12c: Build Composite Applications 1 - 44
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Creating a Domain
Default • • •
• Includes SOA Suite runtime components • Works with a preconfigured Java DB Launches Integrated WLS from JDeveloper. Integrated WLS is shut down every time you end a JDeveloper session.
Stand-Alone Includes SOA Suite runtime components Works with a preconfigured Java DB
Compact • •
Is configured by the user Works with an Oracle database that you must install, and then configure with RCU
le
b a r e f
s n a r -iftyou want to • Can be used • Is best for demos or • Is best for developers, n o n components that add SOA evaluation especially those who want aincompatible s are to use the OSB Design a eฺ such as with Time Console instead of ) h JavaDB, id Scheduler, MFT, JDeveloper om t GuEnterprise c ฺ m en B2B, Healthcare, or BAM b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l a Quick Start distribution, you need to configure a domain to test Khave installed After you R applications during development. JDeveloper is bundled with an integrated application server NA O K called the Integrated WebLogic Server. The integrated application server is a Java EE runtime for services that are optimized for the iterative code development cycle. Launching the Integrated WebLogic Server from JDeveloper generates a domain, which is designated as the default domain. However, you also have the option of launching a JDeveloper-independent version of the WebLogic server to configure a stand-alone domain. The three possible domain types are described and compared in the table in the slide.
Oracle SOA Suite 12c: Build Composite Applications 1 - 45
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary In this lesson, you should have learned how to: • Describe Service-Oriented Architecture (SOA) • Explain services and key standards • Describe Service Component Architecture (SCA) • Describe the functionality of Oracle SOA Suite 12c service components and adapters le • Describe how WebLogic Application Server is used by erab sf n Oracle SOA Suite a r
t
n o an s ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 46
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Course Overview Introduction to Service-Oriented Architecture Oracle SOA Suite 12c Design Time: Overview Oracle SOA Suite 12c Run Time: Overview Installing Oracle SOA Suite 12c Practice Overview
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 1 - 47
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 1 Overview This practice covers the following topics: • Performing the SOA Quick Start installation • Configuring memory settings for improved performance • Starting the integrated server and configuring a domain
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A iceguided through the Developer “Quick Start” installation process and K J you lare In this R practice, should be able to use Oracle SOA Suite in about 30 minutes. The installer does the NA Oyou
K following: • •
Installs all the components that are necessary for development with the core of Oracle SOA Suite (BPEL, Business Rules, Mediator, and Human Work Flow) Launches JDeveloper after the installation, automatically registering the IDE plug-ins for Oracle SOA Suite
The SOA Suite 12c Developer installation contains: • JDeveloper • WebLogic Server • SOA Suite runtime components • BPEL, Human Workflow, Rules, Mediator • Service Bus (not used in this course) • JDeveloper IDE plug-ins for the preceding components All software is installed in a single middleware home directory that you specify.
Oracle SOA Suite 12c: Build Composite Applications 1 - 48
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Course Environment
Integrated WebLogic Server Domain (DefaultDomain)
Enterprise Manager
SOA Suite 12c
le
b a r e f
JavaDB JDK 1.7.0_40
s
an r t n
o FMW n Console a s host: soa12c.example.com ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l K Your environment consists of a server configured with Linux and Java already installed. In this R A and Nsubsequent practices, you first install Oracle SOA Suite. You then use JDeveloper, KOOracle Enterprise Manager, and Fusion Middleware Console to develop, deploy, monitor, and OL6U3 x86_64
manage a number of example applications.
Oracle SOA Suite 12c: Build Composite Applications 1 - 49
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Launching the Quick Start Installer Set the environment variable JAVA_HOME to point to the location of your JDK.
# startInstall.sh
Optionally, set ORACLE_HOME.
export JAVA_HOME=/usr/bin export ORACLE_HOME=/u01/app/fmw12c/Oracle_Home cd /home/oracle/labs/software $JAVA_HOME/java -jar soa_quickstart_generic.jar
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ce Start installer, set the environment variable JAVA_HOME to point K J theliQuick BeforeR launching Alocation of your JDK. You can also set ORACLE_HOME. Although this step is not toN the O K necessary, it will simplify the process of navigating to the various directories when you are Run the appropriate .jar file.
running the installation and configuration commands. Navigate to the directory that includes the installation files. These files may include several .jar files, but you will only need to run the one named soa_quickstart_generic.jar.
Oracle SOA Suite 12c: Build Composite Applications 1 - 50
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
First Look: JDeveloper
Application Navigator
Component and Resource Palettes Design Canvas (various editors)
le
b a r e f
s
an r t n
K
no a as eฺ Structure Messages and Output ) h Property om t Guid Inspector c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K amountl of work in this course is completed by using JDeveloper. Some important A significant R NA of the interface are highlighted in the slide. Oelements •
•
•
•
• •
In the upper-left region of the editor is the Application Navigator, which provides access to your applications and projects, as well as the individual files that comprise those projects. The large pane in the center is the Design Canvas. It displays different editors, depending on the kind of files that are currently open for editing. Tabs across the top provide access to the individual files that are currently open for editing. To the right of the Design Canvas is the Component palette, which provides collections of icons to support the editing functions of whatever editor is currently active in the Design Canvas. The Structure pane can be found in the lower-left region of the interface. It provides a hierarchical view of the component or file that is currently being edited in the Design Canvas. Properties for the actively edited file can be viewed and edited in the Property Inspector pane, which is found in the lower-right region of the window. The lower-center section of the window is reserved for messages and output resulting from various actions, such as deploying an application. You use each of these panes in this course. Oracle SOA Suite 12c: Build Composite Applications 1 - 51
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Starting the Integrated Server
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cwith i l K JDeveloper is bundled an integrated application server called the Integrated WebLogic R A Server. N The integrated application server is a Java EE runtime for services that are optimized KOfor the iterative code development cycle. Launch the Integrated WebLogic Server by selecting Run from top menu bar. Select Start Server Instance from the drop-down menu, as shown in the slide.
Oracle SOA Suite 12c: Build Composite Applications 1 - 52
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Domain
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J claunch i l K The first time that you the server instance, you are prompted to enter a password for R A your N default domain, as seen in the screenshot in the slide. The Administrator ID, Listen KOAddress, Listen Port, and SSL Listen Port fields should already have values. Review them and make any appropriate changes. Launching the integrated server will take several minutes. You can track the server’s launch in the Messages window pane at the bottom of the JDeveloper screen. When the following messages appear in the log, the Integrated WebLogic Server has launched successfully. • • • SOA Platform is running and accepting requests
Oracle SOA Suite 12c: Build Composite Applications 1 - 53
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
an r t n s
N KO A no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Getting Started with Composite Applications
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Describe how services use WSDL files to communicate • Use Mediator components and File adapters to perform basic receiving, routing, and writing of messages • Name and describe the contents of some of the files that are created as part of a composite application
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 2 - 2
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • •
How Services Use WSDL Files to Communicate Mediator Components File Adapters Composite Application Files
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 2 - 3
How Services Communicate
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Service Operation
le
b a r e f
s n a r Fault n-t Input Output no a s ฺ a h ) ide m u o ฺc nt G m Calling Application b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e K J welicdefine For ourR purposes, a service as software, which is available over the Internet or a A N and which exposes functionality as one or more operations, or actions, to other Onetwork
K applications.
The service and calling application exchange messages. Although there are several different interaction patterns, in a common scenario, the calling application invokes the service and, as part of that invocation, provides input data. The service then either completes its unit of work and returns data or if it is unable to complete the requested operation, it may instead return information about the failure. In order for the calling application to exchange messages with the service, a means must be defined for the application to provide the required information in an acceptable format, and for the application to interpret the output (or fault) message provided by the service. Although not a strict requirement, XML is commonly used for these input, output, and fault messages, and XML Schema Definition (XSD) is used to describe the structure of these XML messages.
Oracle SOA Suite 12c: Build Composite Applications 2 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Synchronous and Asynchronous Interactions Synchronous request/response • Real-time response or error feedback • Client in waiting mode Asynchronous request/callback • Client free after request submission • Separate service invocation for response
Request Reply/Fault
Request Callback
le
b a r e f
s
an r t n
o
Asynchronous request only a n One-Way s a • Also known as “fire and forget” m) h ideฺ o t Gu c ฺ • Client free after request submission m en b i ฺ in S tud • No response message only) @(ACK
in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l in the previous slide included input, output, and (possibly) a fault K described The interaction R message. NA Mediators support both synchronous (request-reply) and asynchronous (both oneO K way and callback response) interactions. In a synchronous interaction, the client requests a service, and then waits for a response to the request. While the client waits, the communication channel between the parties is left open until the response occurs. This may be undesirable if large numbers of channels are left open for long periods of time. It may not be needed if the client does not need an immediate response. In these cases, an asynchronous response may be more appropriate. In an asynchronous interaction, the client invokes the service but does not wait for a response before continuing. Asynchronous operations open a communication channel between the parties, make the request, and close the channel before the response occurs. The response may come at a later time via a callback operation, or not at all for one-way interactions.
Oracle SOA Suite 12c: Build Composite Applications 2 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Describing a Message with XSD namespace occurrence data type ble s n tra n no a s aattributes
h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K for XMLl schema definition and, as its name suggests, an XSD is used to XSD stands R describe NA (or define) the structure (or schema) of an XML message. In fact, an XSD uses an O K XML format to provide that description.
XML documents are described in terms of their component pieces, or elements. An XML schema definition is used to define those elements. It can be used to define their sequence, their attributes, their relationship (parent/child), a permissible number of occurrences, data types, and default or fixed values, if any. Built-in data types (a list of commonly used examples would include integer, double, Boolean, date, and string, among others), simplify the description of permissible document content and data formats in XML schemas. XSD also supports complex types, which describe elements that are made up of other elements. Like other XML documents, the example in the slide includes a namespace definition. Namespace definitions are used in XML to allow programs to disambiguate among document elements that may have the same name but are drawn from different sources and thus have different meanings. Subsequent elements in the document begin with their namespace prefix.
Oracle SOA Suite 12c: Build Composite Applications 2 - 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Web Services Description Language types message portType operation
Abstract WSDL (what the service does)
input output
binding
A WSDL file typically has two parts. parts
le
b a r e f
s
an r t n
no a service s ฺ Concrete WSDL a h (how/where e ) toidaccess) port m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceof messages to be exchanged between a calling application and a i l K Describing the structure ARis important, but is not enough to enable the applications to converse. For this, a Web service N KOService Description Language or WSDL document is used. This (XML) description includes the format of input, output, and fault messages, and the data types they use. It also includes the names of operations that the service provides, and how and where to find the service. The information in a single WSDL document is organized into two parts: the abstract definition (what a web service does) and the concrete definition (how and where to access the service). Abstract definitions include types, message, operation, and portType. • Types define the data types used in messages. These types are often drawn from the XML Schema Language. • Messages describe the parts of the input, output, and fault messages that are exchanged with the calling program. • Operations provide a name for the action performed on messages. • PortTypes group messages with operations.
Oracle SOA Suite 12c: Build Composite Applications 2 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Abstract WSDL ReceiveData RouteData/RouteData ...
1
2
le
b a r e f
3
s n a r n-t 4
no a s ฺ a h ) 5 ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceis automatically created when you create a SOA project. This file i l K A composite.xml file AR the entire composite assembly of services, service components, references, and describes N O
K wires. The example in the slide is formatted to make it easier to read, and shows the following key elements: 1. The element encapsulates the entire composite assembly information. 2. The element represents the service that is exposed by the composite. - The element names the portType of the service. (Note that “interface.wsdl” does not refer to a file name in this case.) - The element includes port information to expose the service to external clients. 3. The element represents a Mediator, and includes a link to the source implementation file. (Additional elements would be included for each additional component in the application.) 4. The elements describe connections to the external services that are referenced by the components in the composite application. 5. The element defines how data will flow among components. (Additional wires would be present to connect additional components and external references.)
Oracle SOA Suite 12c: Build Composite Applications 2 - 27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Creating a Mediator
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce to a composite application, several project files are created or i l K When a Mediator is added AR modified: N KO• A .componentType file describes the services and references for each component. composite.xml
•
•
• •
This file tracks the wiring that is created between components, and ensures that the wires work as designed. An .mplan file contains the Mediator metadata. This includes implementation details such as routing rules, links to transformations, filters, validations, and references to target services. A .wsdl (Web Services Description Language) file specifies how other services call an Oracle Mediator. A .wsdl file defines the input and output messages and operations of an Oracle Mediator. The .wsdl file is not created in every circumstance, but is created if you specify an interface definition for the component by selecting the Asynchronous Interface, Synchronous Interface, the One-Way Interface, or the “Interface Definition from WSDL” templates. A element is added to the composite.xml file. An element is added to the composite.xml file for the component WSDL interface.
Oracle SOA Suite 12c: Build Composite Applications 2 - 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Creating an Adapter
le
composite.xml
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce to a composite application, several project files are created or i l K When an adapter is added AR modified: N KO• A .componentType file describes the services and references for each component. . . .
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K XML documents are described in terms of their component pieces, or elements. An XML R A schema N definition is used to define these elements. It can be used to define their order and KOnumber, their attributes, their relationship (parent/child), their data types, and their default or
fixed values, if any. Built-in data types (a list of commonly used examples would include int, double, boolean, date, and string, among others), simplify the description of permissible document content and data formats in XML schemas. XSD also supports complex types, which describe elements that contain other elements and/or attributes. Like other XML documents, XSD documents include namespace definitions, which are used in XML to allow programs to disambiguate among document elements that may have the same name but are drawn from different sources and thus have different meanings. Subsequent elements in the document begin with their namespace prefix. The example in the slide shows a snippet of an XSD, which describes a complex type and its component elements, each of which is of a built-in data type. Note also the minOccurs attribute, which indicates that this element is required, and must occur at least one time in any valid message. The upper code box in the slide shows a piece of an XML document that is described by the XSD sample.
Oracle SOA Suite 12c: Build Composite Applications 4 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
XSL Transformations Source item
Target
productId
prodId
productName
prodName
price
price
qty
quantity
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce an XSLT transformation references two documents—one describing i l K In Oracle SOA Suite 12c, AR message, the other describing the outbound message. It then includes a set of the inbound N O
K instructions that result in the creation of the outbound document.
In the example in the slide, the element is used to extract the value of an XML element and add it to the output stream of the transformation. The select attribute contains an XPath expression that references the path to the desired source node. This expression instructs the XSLT processor to take the contents found at the productId location in the source message, and to place those contents in the prodId node in the outbound message. Similar instructions map the productName node to the prodName node.
Oracle SOA Suite 12c: Build Composite Applications 4 - 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using XPath Functions Source item
Target
productId
productName “widget”
price
prodId
prodName “WIDGET”
le
b a r e f
price
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice is used to reference and navigate through the hierarchical structure K Jseen, XPath As youR have A OofNan XML document. XPath also includes a library of functions that enable evaluation and
K manipulation of data found at the referenced location in the document.
In the example in the slide, the value found in the productName node is converted to uppercase before being assigned to the prodName node in the destination document. XPath functions can be nested as well. If you want to copy only the first three characters of the uppercase value to the destination, you could pass the result of the upper-case function to the substring function in an expression such as .
Oracle SOA Suite 12c: Build Composite Applications 4 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using the Mapper in JDeveloper
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce enables you to visually create transformation rules that can be i l K The XSLT Mapper window ARto message structures that are processed in Mediator routing rules. Transformation applied N KOrules are created by dragging source elements to their respective target elements. A large number of built-in functions exist that you can use to enrich and alter source values before they are copied to their target elements. The XSL source editor can be used for XSL constructs and mappings that cannot be visually represented by the visual designer.
Oracle SOA Suite 12c: Build Composite Applications 4 - 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Auto Map
These control how Auto Map matches node names.
le
b a r e f
s
an r t n
no a s ฺ a h These control how ) ide m u o Auto Map treats ฺc nt G m optional data. b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J cestarts the Auto Map tool. With it, the XSLT Mapper automatically tries i l K Mapping non-leaf nodes R Aall toN link relevant nodes under the selected source and target. The Auto Map tool is KOinvaluable when there are a large number of elements to be mapped in complex structures. The behavior of the Auto Map tool can be tuned by altering the settings in Oracle JDeveloper preferences or by right-clicking the XSLT Mapper and selecting Auto Map Preferences. The automatic mapping algorithm depends on existing maps between source and target nodes. When maps exist between source and target nodes before executing automatic mapping, these existing maps are used to define valid synonyms that are used by the algorithm.
Oracle SOA Suite 12c: Build Composite Applications 4 - 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
XPath Functions
Functions appear as icons.
le
b a r e f
s
an r t n
no a s Component The a ฺ dragh e ) d Palette offers i u om t Gand-drop c access to the ฺ m n b nฺi Stude XPath function library. i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A licethe means to evaluate and manipulate data in an XSL transformation. K J provide XPath R functions Categories NA of functions include type conversion, date, logical, mathematical, string, and O K others. Text literals can also be added in a similar manner. The functions are accessed from the Component Palette, and added to mappings by dragging and dropping the appropriate function onto the center of the canvas, or directly onto an existing mapping. Functions are displayed as icons. Nested functions are displayed with the innermost function to the left, and the subsequent outer functions to the right. Execution of the functions is also performed left to right.
Oracle SOA Suite 12c: Build Composite Applications 4 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Optional and Repeating Data
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceelement provides the means to perform looping in XSLT. The fori l K The R is often used to ensure that all instances of a repeating element Aelement each N KO(maxOccurs=UNBOUNDED) within a source document are copied to the target document.
The element can be used to define a conditional test of some content within the source document, or to test some condition during the execution of the transformation. One way the if element is often used is to verify that an optional element (minOccurs=0) is present before attempting to copy content to a destination node. Both the for-each and if elements can be defined manually and/or created by the Auto Map tool.
Oracle SOA Suite 12c: Build Composite Applications 4 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Testing Transformations
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cenables i l K The XSL Map Tester you to test the transformation mapping logic that you designed R A with N the XSLT Mapper. As shown in the image in the slide, the Tester generates sample data, KOexecutes the XSLT transformation, and displays the output. Source and destination panels display sample data before and after transformation.
Note: The test settings that you specify are stored and do not need to be entered again the next time that you test. However, test settings must be entered again if you close and re-open Oracle JDeveloper.
Oracle SOA Suite 12c: Build Composite Applications 4 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz The Mediator can apply XSLT mappings to message structures that are processed in routing rules. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARa N KOTrue. The XSLT Mapper window enables you to visually create transformation rules that can be applied to message structures that are processed in Mediator routing rules.
Oracle SOA Suite 12c: Build Composite Applications 4 - 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • •
XSLT Transformations in Mediator XQuery Transformations in Mediator Adapters and Native Format Data
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
XQuery: Introduction According to the W3C standards body that oversees the development of the XQuery standard: •
XQuery is a standardized language for combining documents, databases, web pages, and almost anything else.
•
XQuery is replacing proprietary middleware languages and web application development languages. XQuery is simpler to ble a r work with and easier to maintain than many other alternatives. sfe
n
tra n o
an s a eฺ XQuery is designed to work with the hXML ) data model and be a comprehensive uid om t Gquery c ฺ language for data thatbism expressed n in XML. e i ฺ d in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J XQuery isKdesignedlto query XML data from both XML files and relational databases. Just as R SQL NAis the query language for structured data that is expressed as relational tables, XQuery O K is designed to work with the XML data model and be a comprehensive query language for data that is expressed in XML. You can use a single XQuery on multiple and heterogeneous data sources to transform the query result into new XML data.
Oracle SOA Suite 12c: Build Composite Applications 4 - 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
XQuery
• •
XQuery is built on XPath expressions. Applications of XQuery include querying, generation, and transformation of XML.
le
b a r e f
XQuery provides a s n mechanism for extracting a r -t n information from o n relationaladatabases, s files, eฺ services. ) haand web
om t Guid c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l expressions. It is used to query, generate, and transform XML XQuery isKbuilt on XPath R content. NA O K • XML querying: XML can map a large number of different data models. XQuery thus • •
provides a mechanism for extracting information from relational databases, files, and web services simultaneously. XML generation: XQuery enables you to construct XML data by using the result of a query. XML transformation: XQuery can construct XML as a result of evaluating a query expression, in many cases more expressively and efficiently than XSL Transformations (XSLT). XQuery enables you to scan a hierarchy of elements. You can use it to apply transformations at each level of the hierarchy by defining a recursive function.
Oracle SOA Suite 12c: Build Composite Applications 4 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
XSLT Versus XQuery •
Similarities: – XPath – Data model – Functions and operators
•
Differences: – Syntax — —
– Performance — —
le
XQuery is similar to SQL. XSLT stylesheets use XML syntax.
b a r e f
s
an r t n
o
XSLT loads the entire input document in memory. an s ฺ by the hato bedused XQuery loads only the objects that need e ) i m Gu current statement. ฺco
m ent b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l are languages designed to query and manipulate XML documents. K and XQuery Both XSLT R Their NAfeatures and capabilities have lots of overlap. The slide lists the similarities and O K differences between them.
Oracle SOA Suite 12c: Build Composite Applications 4 - 17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using XQuery Transformations
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce Mediator can be either XSLT or XQuery, as you choose. The i l K Transformations in Oracle AReditor uses the same look-and-feel as the XSLT editor. XQuery N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • •
XSLT Transformations in Mediator XQuery Transformations in Mediator Adapters and Native Format Data
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 19
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Working with Native Format Data Mediator transformations can process both XML and native format data within transformations.
Adapter
Mediator
Adapter
le
b a r e f
s
an r t n
no a File, FTP, and JMS adapters can as eฺ convert data from native format to) h m Guid XML, and from XML to native format. o c ฺ This allows the data values to be t m en b accessed by XSLฺitransformations in Stud within the application. @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l File, FTP, and JMS adapters accept native messages in XML or nonK OracleR Mediator, and XML NAformat and publish them as XML messages. They can also accept XML messages and O K convert them back to native EIS format. This translation from native data format to XML and Exposed Services
Components
External References
back is performed by using a definition file (non-XML schema definition), which itself is defined in the XML schema format. The Native Format Builder wizard enables you to sample native data and create the native XSD (NXSD) grammar for translation of native data.
Oracle SOA Suite 12c: Build Composite Applications 4 - 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Native Data Transformation 2,100,credit,two_day,initial,VISTA,1234-1234-1234-1234 SKU301|Music Player 1Gb|45|3 SKU305|Music Player 160Gb|250|20
Header Information
Transformation
2 100 *** SKU301 Music Player 1Gb 45 3 ***
Order Detail
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce shows incoming delimited data passed into the adapter, and that i l K The example in the slide R Apassed data out of the adapter in XML format, which is suitable for processing in Oracle SOA N KOSuite 12c. An outbound adapter can be configured to perform the opposite transformation, passing XML data out in a delimited (or other) format.
Oracle SOA Suite 12c: Build Composite Applications 4 - 21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Invoking the Native Format Builder
Invoke the Native Format Builder from either the Adapter Wizard or via the Mediator Translate to Native option.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce is accessible from the configuration wizard for any adapter that i l K The Native Format Builder AR native format translation, or via the Translate to Native option in the Mediator supports N KOconfiguration dialog box.
Oracle SOA Suite 12c: Build Composite Applications 4 - 22
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Specifying File Name and Native Data Format
Specify the name of the file to create, and the type of native data to process.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J cename of the file (.xsd) that will describe the native format, and by i l K Begin by specifying the AR the type of data it will represent. selecting N KO The Native Format Builder wizard supports file formats such as delimited, fixed-length, complex type, data type description (DTD), and COBOL Copybook. •
The Delimited option enables you to create native schemas for records, where fields are separated by a value such as a comma or number sign (#).
•
The Fixed Length (Positional) option enables you to create native schemas for records where all fields are of fixed length.
•
The Complex Type option enables you to create native schema for records where the fields may themselves be records having multiple delimiter types.
•
The DTD option enables you to generate native schema from the user-supplied DTD, which contains information about the structure of an XML document.
•
The COBOL Copybook option enables you to generate native schema from the usersupplied COBOL Copybook definition.
Oracle SOA Suite 12c: Build Composite Applications 4 - 23
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Specifying a Sample File
le
b a r e f
s n a r t specify Specify a sample file n-and how it should n beointerpreted. a s a h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l K Format Builder The Native reads a sample native file to initiate the definition process. On the R A screen N shown in the slide, specify the sample file and provide additional instructions on how KOto interpret the contents of that file.
Oracle SOA Suite 12c: Build Composite Applications 4 - 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Defining a Schema for a Native Format
Icons provide access to tools to define XML schema elements and complex types.
le
s
an r t n
A sample native format file is displayed.
b a r e f
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce file, the wizard provides features to allow you to fully define the i l K After reading the sample AR XML schema file. resultant N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 25
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary In this lesson, you should have learned how to: • Describe the role of XML, XSD, XPath, and XSLT in the way Oracle SOA Suite 12c handles data • Use the XSLT Mapper to create XSL transformations in a Mediator • Test XSL transformations ble • Configure adapters and Mediator transformations to a r e convert external, native format data to XML data thatan issf tr useable within Oracle SOA Suite 12c n o
an s ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 26
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 4 Overview This practice covers the following topics: • Defining Native Format Data • Using the XSLT Mapper
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 4 - 27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 4 Overview: The Mediator will perform an XSL transformation of data. The inbound File adapter will convert the delimited data to XML format.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ice deploy, and run a composite application that receives delimited K J you lcreate, In this R practice, NAfrom a File adapter. This data is transformed to XML format and passed to a Mediator. Odata The outbound File adapter will write the data to the file system.
K The Mediator then transforms the data to the XML format that is desired by the receiving
application. In this practice, this application is an outbound File adapter that writes the data from the composite application to the file system.
Oracle SOA Suite 12c: Build Composite Applications 4 - 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Optional Challenge: Creating a Fixed-Length Output File In this unstructured practice, you add an additional File adapter as an external reference that writes purchase order information to a fixed-length format file. This section of the practice builds on the work that you have already done. The new adapter should write different data to the same format. For example, running the application three times should produce files with content similar to the following:
le
b a r e f
s
an r t n
2 100 credit two-day initial MCRD 1234-1234-1234-1234 2 100 credit two-day initial VISTA 1234-1234-1234-1234 2 100 credit international initial VISTA 1234-1234-1234-1234
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice you add an additional File adapter as an external reference that KJ In this R unstructured practice, NApurchase order header information to a fixed-length format file. This section of the Owrites
K practice builds on the work that you have already done.
Note: This data sample has blank spaces added between fields for visual clarity on this page. The fixed-length data in your implementation is not likely to include spaces between fields (although spaces within fields may be common). For the purpose of this exercise, you may configure your adapter to preserve these extra spaces or not, as you see fit. A sample file to assist in the definition of the native format is available at d:\labs\files\data\po_header.txt. Some additional basic guidance is available in the Tasks section of this practice, but the specifics are up to you. After you have modified the application, redeploy it. Copy the file d:\labs\files\data\purchaseOrder.dat to d:\labs\input\po_3.txt. Repeat this step three or more times. For at least one execution of this step, open and modify the file po_3.txt. Replace the word two_day with the word international. Verify that each iteration of the test provides appropriate output.
Oracle SOA Suite 12c: Build Composite Applications 4 - 29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
an r t n s
N KO A no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using JMS and JDBC Adapters
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Discuss the adapter architecture • Identify the types of technology adapters • Configure and use the JMS adapter • Configure and use a Database adapter • Describe the configuration of runtime connections for adapters
le
an r t n
s
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 2
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • •
Oracle JCA Adapters JMS Specification and JMS Adapter Database Adapter
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Binding Components Services provide the outside world with an entry point to a SOA composite application.
References enable messages to be sent from the SOA composite application to external services in the outside world.
le
b a r e f
s
an r t n
no a s ฺ a h ) Services and references ide m u o are two kinds of binding ฺc nt G m components. b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ce a connection between a SOA composite and the external liestablish KJ BindingRcomponents world. NAThere are two types of binding components: O K •
Services provide the outside world with an entry point to the SOA composite application. The WSDL file of the service advertises its capabilities to external applications. These capabilities are used for contacting the SOA composite application components. The binding connectivity of the service describes the protocols that can communicate with the service, for example, SOAP/HTTP or a JCA adapter.
•
References enable messages to be sent from the SOA composite application to the external services in the outside world.
Note: Binding components are displayed in the JDeveloper Component Palette as service adapters. Several types of binding components are provided by Oracle SOA Suite, including Web service (SOAP over HTTP), ADF-BC service, HTTP binding, and JCA adapters. The remainder of this lesson explores JCA adapters in more detail.
Oracle SOA Suite 12c: Build Composite Applications 5 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JCA Adapters
WebLogic Application Server
Client
resource adapter
resource adapter
External System
le
Binding components for JCA The binding components for adapters provide a WSDL JCA adapters provide a WSDL interface to a resource adapter that is deployed to the runtime deployed to the runtime environment. The adapter itself is transparent to the application.
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K JCA stands for JEE Connector Architecture. It is part of the JEE specification. JCA describes R A the Nconcept of resource adapters, or simply adapters. Adapters enable SOA Suite KOcomponents to interact with systems outside the composite application, including those outside the application server. This simplifies the integration of diverse systems. An adapter exposes an API through which a service component accesses an external system. The interface for this API is described by a WSDL document. This WSDL is the only view that the component has of the external system. The adapter itself is transparent to the service component. Oracle JCA adapters enable communication with various back-end systems. This includes exchange of requests and (possibly) responses with back-end systems. Adapters also support the real-time event notification service. This service provides notification about the events associated with successful back-end transactions for creating, deleting, and updating back-end data. (More on the event notification service later.) In many cases, adapters can offer advantages over web services. They are for tighter coupling and they bring value-adds such as connection pooling, for example. Adapters typically perform better than web services.
Oracle SOA Suite 12c: Build Composite Applications 5 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle JCA Adapters SOA Infrastructure BPEL
Mediator
Business Human Rules Workflow
Event Delivery Network Enforcement Points
Technology
Web Service Policy Manager
Message
Packaged Application
Legacy
• • • • •
• • • • •
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A cecategorized broadly into three groups: K J canlibe OracleR adapters A N • Technology adapters can be used to integrate SOA applications with transport O K • • • • •
Files; FTP JMS; AQ; MQ Database Sockets SOAP; REST
PeopleSoft SAP R/3 Siebel J.D. Edwards Oracle Apps
Tuxedo CICS VSAM IMS/TM IMS/DB
protocols, data stores, and messaging middleware.
•
Application adapters connect various packaged applications, such as SAP and Siebel, and databases.
•
Legacy adapters integrate mainframe and legacy applications. There are CICS and Tuxedo adapters as well. (CICS and Tuxedo are not applications but command interfaces to legacy applications.)
Oracle SOA Suite 12c: Build Composite Applications 5 - 6
Monitoring Adapters
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
SOA Infrastructure BPEL
Mediator
Business Human Rules Workflow
Event Delivery Network Enforcement Points
File
Message
Other
SOAP; REST
JMS
Web Service Policy Manager
le
b a r e f
JDBC
s
an r t n
• Adapter Preprocessing – Preparing Interaction Spec • Adapter Processing – Setting up Callable Statement – Invoking Database – Parsing Result • Adapter Post-Processing
no a s ฺ a Enterprise h ) Manager ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J licsuch K adapters OracleR JCA as File, JMS, and Database gather and publish statistics for every A message N they process, either inbound or outbound. The statistics are broken down into KOcategories and individual tasks. The following is an example of how statistics are broken down in an outbound (reference) process: • Adapter Preprocessing - Preparing Interaction Spec • Adapter Processing - Setting up Callable Statement - Invoking Database - Parsing Result • Adapter Post-processing Adapter statistics can be viewed in the Oracle Enterprise Manager console.
Oracle SOA Suite 12c: Build Composite Applications 5 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz Statistics about message processing are gathered by adapters, and are viewable in the Oracle Enterprise Manager console. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARa N KOTrue. Adapters gather and publish statistics for every message they process, either inbound or outbound. Adapter statistics can be viewed in the Oracle Enterprise Manager console.
Oracle SOA Suite 12c: Build Composite Applications 5 - 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • •
Oracle JCA Adapters JMS Specification and JMS Adapter Database Adapter
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Specification: Definition
The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java Platform, Enterprise Edition (JEE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce (JMS) describes reliable asynchronous communication between i l K The Java Message Service AR the components in a distributed computing environment. It uses a client/server model, N KOwhereby a JMS server routes and delivers messages to JMS clients.
Oracle SOA Suite 12c: Build Composite Applications 5 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Message Standard Message Header Fields used to describe and deliver messages
Message Header • JMSCorrelationID • JMSCorrelationIDAsBytes • JMSDeliveryMode • JMSDestination • JMSExpiration • JMSMessageID • JMSPriority • JMSRedelivered • JMSReplyTo • JMSTimeStamp • JMSType
(Optional) Properties Name-value pairs defined by an application
le
b a r e f
s
an r t n
no a s ฺ a h User-Defined Properties) ide m u o ฺc nt G Payload Message Body m b Message contents nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cmandates i l K The JMS specification that messages consist of three sections: a standard R A message N header, which contains fields that are used to describe and deliver messages; an KOoptional properties element, which contains application-defined properties (as name-value pairs); and the message body, which holds the contents (payload) of the message. The payload can be a text message, byte message, map message, stream message, or object message. The properties element is JMS provider–specific and varies from one JMS provider to another.
Oracle SOA Suite 12c: Build Composite Applications 5 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Messaging Point-to-point Each message is delivered to only one consumer.
N
2
1
queue
1 2 N
consumer consumer consumer
le
Publish/subscribe Each message may be delivered to multiple subscribers.
b a r e f
s
1
an r t n
oconsumer n a s a h d1eฺ consumer ) N 2 1 om t Gui c ฺ m en 1 b i ฺ topic consumer n Stud i @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l of messaging: point-to-point and publish/subscribe. K two types JMS supports R A N • In point-to-point messaging, messages are stored in a queue until they are consumed. O K •
One or more producers write to the queue and one or more consumers extract messages from the queue. A queue may have many receivers, but only one receiver receives each message. The JMS consumer sends an acknowledgment after consumption of a message; this results in purging of the message from the queue. In publish/subscribe messaging, producers publish messages to a topic, and the consumer subscribes to a particular topic. Many publishers can publish to the same topic, and many consumers can subscribe to the same topic. All the messages published to the topic by the producers are received by all the consumers that are subscribed to the topic. By default, subscribers receive messages only when the subscribers are active. However, the JMS API supports durable subscriptions that ensure that consumers receive messages that were published even when the subscribers are not up and running. These messages are persisted by the JMS provider and are either sent to the consumer when it becomes active again or purged from storage if the message expires. The JMS producer can be set either to persistent or non-persistent mode. The messages are not persisted in the latter case and can be used only for nondurable subscriptions.
Oracle SOA Suite 12c: Build Composite Applications 5 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Resources
WebLogic Server Lookup connection factory.
JNDI JMS Server
JMS Client
le
Obtain connection from connection factory.
b a r e f
s
an r t n
no a s ฺ a h to a JMS destination. ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J liccan BeforeR anKapplication publish a JMS message, it must have a connection to a message A destination. That connection is provided by a connection factory, which is an administered N KOobject that is configured with predefined parameters, such as a default priority to use for Publish message
messages when a priority is not explicitly defined on the message. The JMS client looks up a connection factory by using the Java Naming and Directory Interface (JNDI), which is a Java API for a directory service that allows Java software clients to discover and look up data and objects via a name. After the JMS client is provided a connection, the message can be created and published to the appropriate message destination (a topic or queue). Note: Although the generic image in the slide shows the JMS client outside the WebLogic Server, this client could be an application deployed within the same application server. In Oracle SOA Suite 12c, the JMS adapter is such an application.
Oracle SOA Suite 12c: Build Composite Applications 5 - 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Adapters and the WebLogic Application Server
WebLogic Application Server Managers
Adapter
• Transaction • Security • Connection
System
External System
Contracts
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cServer i l K The Oracle WebLogic architecture includes the following set of system-level contracts: R A N KO• Connection management: Enables application components to connect to a back-end The application server provides management for connections, transactions, and security for JCA adapters and other deployed applications.
•
•
application and leverage any connection pooling support of the Oracle WebLogic Server container. This leads to a scalable and efficient environment that can support a large number of components that require access to a back-end application. Transaction management: Enables an application server to use a transaction manager to manage transactions across multiple resource managers. Most adapters support only local transactions (single-phase commit) and not XA transactions (two-phase commit). The Oracle adapters that support XA transactions include MQ Series, JMS, AQ, and Database. Security management: Provides a comprehensive, flexible security infrastructure that is designed to address the security challenges of making applications available on the web. WebLogic security (via OWSM) can be used stand-alone to secure WebLogic Server applications or as part of an enterprise-wide security management system that represents a best-in-breed security management solution.
Oracle SOA Suite 12c: Build Composite Applications 5 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Connection Management
WebLogic Server JMS Server Application 1 Application 2 Application 3
le
b a r e f
s
an r t n
no a Deployed Connection s Message a ฺ h Applications Pool Destination e ) d i om t Gu c ฺ m running n within the Note: The diagram shows the JMS Server b e i ฺ d innot beSthe tu case. WebLogic Server, but that need @ n s jai e thi k r a © 2014,uOracle s and/or its affiliates. All rights reserved. n Copyright o k e to ( AIN icens J Kthe subjectl of system contracts is generally outside the scope of this class, it is Whereas R worth NAnoting that one of the services specified by these contracts is connection management, O K or the creation and management of connections to back-end systems. An important concept in connection management is connection pooling. Rather than opening connections on an asneeded basis, connections with data and services are established, configured, cached, and reused automatically by the application server. Connection pooling enhances application performance and scalability, particularly when many connections are required simultaneously to a given database or other back-end system. Note: Configuration of these connection resources is done within the Oracle adapter by using Fusion Middleware Control. This configuration must be done before the adapters can be fully configured within a composite application.
Oracle SOA Suite 12c: Build Composite Applications 5 - 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Oracle JMS Adapter WebLogic Server
Oracle JMS Adapter
WebLogic JMS Server
le
b a r e f
s n a r Supported JMS servers Supported features include: n-t include: • Active MQ no • JMS topics and queues a • Apache • Byte, text, and map message types s a • AQ JMS • JMS headers and properties h deฺ ) • IBM WebSphere • JMS message selector uiJMS MQSeries om • tTIBCO c G ฺ • Durable JMS subscriber m en b • Persistent and non-persistent publication i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l a messaging model that separates service consumers from service Kadapter uses The JMS R providers. NA This messaging model is defined by using Web Services Description Language O K (WSDL), which describes the operations exposed by the adapter.
In an outbound message flow, the JMS adapter acts as a service provider. The adapter receives a normalized message from the SOA infrastructure, converts that message to a JMS message, and then sends the message to a JMS destination. In an inbound message flow, the JMS adapter acts as a message consumer. The adapter converts the JMS message that it receives from a topic or queue to a normalized message, and then sends the normalized message as part of the message exchange to another component as a service request. The JMS adapter supports JMS topics and queues. It supports byte, text, and map JMS message types. The Adapter Configuration wizard provides the Native Format Builder wizard for consuming native data payloads at run time. The adapter supports the JMS message selector for performing filtering while subscribing to JMS topics and queues. (This parameter is based on the SQL 92 language for filtering messages based on the fields present in the JMS header and properties section.)
Oracle SOA Suite 12c: Build Composite Applications 5 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
The WebLogic Application Server includes a JMS-compliant message server that provides interim storage for messages in message destinations, which may take the form of topics and/or queues. The message server acknowledges the JMS client that produces the message and ensures successful delivery to the JMS client that consumes the message. Messages remain live until picked up and committed by all eligible consumers, or until their expiration time is met. The Time-to-Live configuration parameter of the JMS adapter defines this window of opportunity for consumers to receive a message. The time-out may be turned off completely (default), or set to a specific number of milliseconds. Messages are deleted from storage when they have been received by all subscribers, or after their Time-to-Live has elapsed. After being picked up or expiring, messages are automatically cleaned up (deleted) by the Message Server and are no longer accessible.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 17
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring JMS Resources with WebLogic Administration Console JMS configurations are stored as modules that are defined by an XML file.
JMS modules may contain several types of objects, including connection factories and message destinations.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceconfigured in the runtime environment, before the deployment of a i l K JMS resources must be AR application, which includes a JMS adapter that references these resources. composite N KO Using the WebLogic Administration web-based console, log in as the administrator (with username weblogic, and the password that was specified when WebLogic Server was installed) and configure the following JMS resources: • A JMS destination, such as a queue or topic • A JMS connection factory • A JMS adapter connection pool that is associated with the JMS connection factory
Note: The JMS adapter connection pool JNDI name is needed to configure the JMS resources on the design-time JMS Adapter Configuration wizard pages when you add a JMS adapter to a composite application.
Oracle SOA Suite 12c: Build Composite Applications 5 - 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Defining a Message Destination To create a message destination: 1. Select the resource type 2. Supply the name and JNDI name 3. Specify the subdeployment
1 2
3
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K To configure a JMS destination, log in to the WebLogic Server Administration console as the R A user. On the Domain Structure navigation bar, expand Services > Messaging N Oadministrative
K and select JMS Modules. On the JMS Modules page, click the SOAJMSModule link. On the “Settings for SOAJMSModule” Configuration tab page in the Summary of Resources table, click New. 1. Select the desired resource option (for example, Topic), and click Next. 2. Enter a configuration name (such as demoTopic) and the JNDI name (such as jms/demoTopic) and click Next. 3. Select SOASubDeployment for the Subdeployment type. Select the SOAJMSServer option in the JMS Servers table. (The SOAJMSServer is automatically created during installation of SOA Suite.) Click Finish. Note: The response page indicates that the configured resource was created successfully. The new resource appears as an entry in the Summary of Resources table on the “Settings for SOAJMSModule” page.
Oracle SOA Suite 12c: Build Composite Applications 5 - 19
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Defining a Connection Factory
1
2
To create a connection factory: 1. Select the resource type 2. Supply the name, JNDI name, and other parameters 3. Specify the target server
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce factory with a JNDI resource name, perform the following i l K To create the JMS connection AR steps: N O 3
K
1. On the “Create a New JMS System Module Resource” page, select the Connection Factory resource type option. Click Next. 2. Enter the following Connection Factory Properties: - Name (such as demoCFactory) as a configuration name - JNDI (such as jms/demoCFactory) for the JNDI resource name string Click Next. 3. Under Targets, verify that you have the correct Servers check box selected and click Finish.
The Summary of Resources table contains the newly created resource.
Oracle SOA Suite 12c: Build Composite Applications 5 - 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Defining a Connection Pool Connection pools are defined in association with both an adapter and a connection factory.
The JNDI name that is assigned is used in the configuration of the adapter in composite applications.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice and message destinations, connection pools are defined in K J factories Unlike R connection association NA with an adapter. Resource adapters are applications that are deployed to the O K WebLogic Server. Their deployment configuration includes runtime connection parameters, including the back-end application connection information, the JNDI name to be used, and other configuration information, including connection pooling parameters. The Resource adapter deployment information can be edited in Fusion Middleware Control by selecting Deployments. A table of deployments is listed, which provides access to the JMS adapter. Click the adapter to access its settings. In the resulting display, click the Configuration > Outbound Connection Pools tab to create or edit a connection pool.
Oracle SOA Suite 12c: Build Composite Applications 5 - 21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Associating the JMS Connection Pool to a Connection Factory Associate the connection factory with the new JNDI name.
le
b a r e f
s
an r t n
K
no a s ฺ a h ) ide m u o ฺc nt G m Redeploy the JMS adapter b nฺi Stude to activate these changes. i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K To associate a JMS connection pool to the appropriate connection factory name, navigate to R A OtheNJmsAdapter > Configuration > Outbound Connection Pools tab, and then do the following: 1. Expand the factory entry oracle.tip.adapter.jms.IJmsConnectionFactory under the Outbound Connection Pool Configuration table. Locate and click the JNDI name link for the connection pool that you previously created. 2. On the Settings page, change the ConnectionFactoryLocation property value to the JNDI name value that you specified for the connection factory. 3. After saving the property value changes, update the deployment for the JMS adapter. Click Deployments. 4. Select the check box next to JmsAdapter and click Update. 5. Verify that the correct deployment plan is selected, click Next, and click Finish.
Oracle SOA Suite 12c: Build Composite Applications 5 - 22
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Adapter as Producer
Exposed Services
Entry Point
Components
External References
Mediator
JMS Adapter (producer)
le
Message Destination Message Type Delivery Mode Priority ) m Time toco Live
b a r e f
s
an r t n
no a has deฺ ui G ent
ฺ m b nฺi Stud i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K Message Destination R A N KO• The name of the message destination is part of the configuration of a publishing JMS adapter. This destination must already be configured in the target application server.
Message Type • The message type parameter indicates which JMS Message type is to be produced. Supported values are bytes, text, and map. Delivery Mode • When a durable topic subscriber is unavailable, messages are not lost. The Message Server retains the messages until they are retrieved or they expire. When a topic subscriber is nondurable, the client sees messages on a topic only when that subscriber is active. If the subscriber is inactive, and messages are published, the messages are lost. By default, topic subscribers are durable. If message throughput supersedes reliability, set the Durability property to nondurable.
Oracle SOA Suite 12c: Build Composite Applications 5 - 23
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Message Priority • By default, all messages are published with equal priority, and are delivered to consumers in the order in which they are received. However, message content or other business concerns may dictate that a given message or type of message is of greater (or lesser) relative importance than other messages that are published to the message server. In this case, the priority of the message can be set to a value greater or less than that of other messages published. By changing the priority of the message, the order in which it is received by the consumer can be changed. (Default value is 4. The valid values are 0 through 9, where 0 is the lowest priority and 9 is the highest.) Time to Live • Time to Live indicates how long the message is retained by the Message Server. If it has not been received by all eligible consumers by this time, the message is automatically purged by the message server.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
JMS Adapter as Consumer
Exposed Services
Components
External References
JMS Adapter (consumer)
le
b a r e f
s
an r t n
Destination Name no a s ฺ Message BodyaType h ) Messagem Selector ide
o t Gu c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K Name l Destination R A N • The destination name specifies the name of the message destination. O K Message Body Type •
The Message Body Type parameter indicates which JMS Message type is to be produced. Supported values are byte, text, and map.
Message Selector •
A message selector allows a consumer to receive a subset of available messages by filtering message property values. The selector is defined as a property of a message consumer. The syntax and functionality of a message selector are similar to a SQL WHERE clause. For example, the message selector JMSType LIKE 'invoice*' AND JMSRedelivered = 'false' ensures that the consumer receives only messages where the JMSType message property is set to invoice AND the JMSRedelivered message property is set to false.
•
Message selectors can be used effectively, but their overuse can impact the performance of the Message Server. In this case, it may be more desirable to publish messages to multiple destinations and configure selected subscribers accordingly.
Oracle SOA Suite 12c: Build Composite Applications 5 - 25
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz The JMS adapter can interact only with a JMS Server that resides within WebLogic Server. a. True b. False
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARb N KOFalse. Applications that exchange data via JMS do not have to reside within WebLogic Server.
Oracle SOA Suite 12c: Build Composite Applications 5 - 26
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • •
Oracle JCA Adapters JMS Specification and JMS Adapter Database Adapter
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Database Adapter: Introduction WSDL documents expose database operations. Exposed Services
DB Adapter
WSDL documents expose database operations. Components
External References
DB Adapter
le
b a r e f
s
an r t n
no a s a poll call eฺ h ) Update m uid o c G ฺ Delete m ent b i ฺ Merge in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l illustrates that a Database adapter exposes database operations that K in the slide The graphic R can be implemented and used by the components in a composite application. The Database NA O K adapter provides a WSDL interface to define the operations and message structure in an XML Select Insert
format, enabling it to be used as a service by the composite application components. The Database adapter configuration is defined in the Adapter Configuration wizard, which enables you to specify one of the following types of operations: • Data manipulation operations (insert, update, merge, and delete) • Query operations (select) • Custom SQL statements • Calls to stored procedures, in which the adapter honors any logic in the stored procedure and acts as a call relay interface Note: Query and DML operations are managed and executed by the TopLink Java framework that performs the SQL database operations. For all operations (including calling stored procedures), the conversion of data between XML input to and output from the native format that is used in the database is performed by the Database adapter.
Oracle SOA Suite 12c: Build Composite Applications 5 - 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Database Adapter Drag the Database adapter to the composite.xml canvas.
Supply a name for the service.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J cea Database adapter, complete the following steps in JDeveloper: i l K To create and configure R A N O1. In the Composite Editor, drag a Database adapter into the External References (or the Adapter wizard opens.
K
Exposed Services) column. The example shows the Database adapter being dragged into the External References column. The Adapter Configuration wizard is displayed. On the Welcome page, click Next to proceed with the remaining steps to configure the adapter. 2. Specify the name of the service.
Note: Recall that the adapter itself is transparent to the composite application. This service appears as one more web service invocation to the application. Subsequent slides cover the remaining steps to configure a Database adapter by using a query operation (SELECT statement).
Oracle SOA Suite 12c: Build Composite Applications 5 - 29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Database Adapter Service Connection Specify a database connection or create a new one.
design time
le
b a r e f
s
an r t n
run time
no a s ฺ a h ) This ide m Specify the JNDI name of the connection. u o c G ฺ t name must match the connection pool factory m Database n adapter. b e i name configured for the runtime ฺ d in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l K Connection On theR Service page, click the Browse icon to select an existing database A created in the JDeveloper IDE, or click the Add icon to create a new IDE or N Oconnection
K application connection. The details for the connection selected or created are displayed in the Connection field. Note: When you select a database connection, the JNDI Name field is populated with the connection name prefixed with eis/DB/. In the example in the slide, the SOA database connection creates the JNDI name eis/DB/SOA. The JNDI name must match the JNDI connection factory resource configured for the Database adapter that is deployed in the WebLogic Server runtime environment. The JNDI name already exists. In the SOA Quick Start installation, it is automatically provided. In an enterprise installation, the administrator will have provided it.
Oracle SOA Suite 12c: Build Composite Applications 5 - 30
Configuring a Select Statement: Operation Type Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Specify what you want the adapter to do.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce wizard then offers a choice of operation types. Subsequent wizard i l K The Adapter Configuration AR pages vary depending on the choice of operation type. The choice of operation types include: N KO • •
•
•
Call a Stored Procedure or Function enables you to execute a database stored procedure or function. Perform an Operation on a Table enables you to select any or all of the following options: Insert or Update (Merge), Insert Only, Update Only, Delete, Select, and Query by Example. Poll for New or Changed Records in a Table enables reading and publishing new or changed records, and is useful to an inbound Database adapter that is implemented as an exposed service in a composite application. Execute Pure SQL is used for creating a custom SQL string.
Note: The Do Synchronous Post to BPEL (Allows In-Order Delivery) option can be selected when the Poll for New or Changed Records in a Table operation type is selected. These changes are delivered in order as asynchronous events to a BPEL process component.
Oracle SOA Suite 12c: Build Composite Applications 5 - 31
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Select Statement: Importing Tables Because we specified an operation on a table, we now query the database for a list of tables.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G From the list of displayed tables, we specify m b which tables to use. nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cslide, i l K In the example in the you explore the configuration for a Select operation. R A N KO1. Click Import Tables to open the Import Tables window.
2. In the Import Tables window, select the schema. Enter Name Filters if desired, and click Query. - The Available column is populated with a list of tables. 3. Select a table from the Available list and click the single right arrow icon to move it to the Selected column. When you have finished selecting the tables, click OK. 4. You are returned to the Select Table page with the selected tables listed. On the Select Table page, verify the addition of the selected table, and click Next.
Oracle SOA Suite 12c: Build Composite Applications 5 - 32
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Select Statement: Filtering Attributes For each selected table, we specify which attributes (columns) to reference.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A licepage, you can deselect the attributes that you do not wish to query. K J Filtering On theR Attribute NAMake sure that appropriate attributes are chosen for insert operations, unless you are ONote:
K sure that the database provides default values for the attributes that you omit.
Oracle SOA Suite 12c: Build Composite Applications 5 - 33
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Select Statement: Defining Selection Criteria We create any parameters to be used in the filter (WHERE clause) of the SELECT statement.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o c statement G ฺSELECT t The stem of the m n b de is automatically nฺi Sgenerated. u i t in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J querylicparameters K You can create and conditions for a SELECT operation. The example in the R A slide N creates a parameter called ccNum, which is added to the query and used in a condition KOto retrieve credit card data with a specified ID. The actual value for the ccNum parameter is supplied at run time. The steps to define and use the parameter are as follows: 1. On the Define Selection Criteria page, next to the Parameters field, click Add. 2. In the Parameter Name window, enter a parameter name and click OK. 3. On the Define Selection Criteria page, with the parameter name defined and populated, next to the SQL field, click Edit to define the query criteria (conditions).
Oracle SOA Suite 12c: Build Composite Applications 5 - 34
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Select Statement: Editing the Expression The Expression Builder assists in the creation of the filter expression.
le
b a r e f
s
an r t n
no a The completed expression is s ฺ a h added to the SELECT statement. ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce window, click Add to form the first expression. i l K In the Expression Builder R A N OIn this example, with the expression selected, configure the first argument as cardNumber in
K the Query Key column, the Operation (EQUAL by default), the second argument as Parameter, and select the ccNum parameter. Click OK to add the condition to the query. Note: The Expression Builder allows you to create multiple conditions separated by logical operators (AND and OR).
Oracle SOA Suite 12c: Build Composite Applications 5 - 35
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Configuring a Select Statement: Advanced Options These properties are specific to the Database adapter.
le
Specify a query timeout.
s
an r t n
These properties are common to all JCA adapters.
b a r e f
K
no a s ฺ a h ) Configure the ide m u o number of retries ฺc nt G before flagging m b an error. nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice page, you can configure database-specific values in the following K J Options On theR Advanced NA Osections: • •
•
•
JDBC Options: Sets a query timeout. A value of zero means it waits indefinitely. Max Rows determines the maximums number of rows fetched per round trip. Auto-Retries: Attempts the specified number of retries before flagging an error. Interval is the number of seconds between retries. The Backoff Factor determines a delay to increase the wait time between retries. A value of 2 doubles the interval after each retry. The Max Interval is the longest wait time between retries. Native Sequencing (Oracle only): This is used for INSERT operations, and specifies that the primary key is assigned from the selected sequence, which can be searched for or created. Interaction Options: Get ActiveUnitOfWork forces all operations invoked in the same global transaction to use the same connection. This guarantees that subsequent operations can see the changes from earlier operations. Emulated two-phase commits use the same connection. MERGE and INSERT operations are committed when the global transaction completes. Therefore, it also alters when WRITE operations occur. Detect Omissions allows the MERGE and INSERT operations to ignore empty or missing XML elements. If Detect Omissions is not selected, missing or empty elements are stored as NULL values. Oracle SOA Suite 12c: Build Composite Applications 5 - 36
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
The JCA Endpoint Properties pane provides access to properties that are common to all JCA adapters. These properties configure the retry behavior of the adapter if its configured endpoint is not available.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 37
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Database Adapter Runtime Connections
WebLogic Server Application 1 Application 2
le
Application 3
b a r e f
s
an r t n
no a s ฺ a Deployed h e ) idDatabase Connection Applications m u o ฺc nt G Pool (with Database m b adapters) nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cthe i l K Like the JMS adapter, database connection defined in the Database adapter at design R A time N specifies a JNDI name in the form of eis/DB/connection-name, which is used to KOlocate a connection for the target database at run time. The runtime server environment must be configured with the same JNDI resource name and associated with a JDBC connection for the target database server. After making configuration changes to the Database adapter resources, the Database adapter configuration must be updated to be available for applications. Note: There is no need to restart the WebLogic Server instance after redeployment. Configuration of the Database adapter should be completed and redeployed when there are no application instances running in the runtime environment. All adapter runtime configuration settings that depend on the adapter runtime services should be made and deployed before deploying applications. This concept applies to any of the adapter configurations available in the runtime environment that do not conform to the WebLogic Server production redeployment feature requirements.
Oracle SOA Suite 12c: Build Composite Applications 5 - 38
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Transactionality The Database adapter and JMS adapter are both transactional (as are the AQ adapter and Java web services). • In general, a transaction is started by a service when it is invoked by a client, and ends when the service operation completes. If the invoked service completes successfully, the transaction started is committed; otherwise errors roll back the transaction. ble a r • Transactional boundaries depend on the context, fe s n a configuration, and environment of the services that trare n no implemented and invoked. a s ฺ a h • Transaction semantics are different for services e that are ) d i m u o t Gthat are invoked invoked synchronously than forฺcservices m n b e i asynchronously. ฺ d u in
t S @ n s jai e thi k r a © 2014,uOracle s and/or its affiliates. All rights reserved. n Copyright o k e to ( AIN icens J l is started by a service when it is invoked by a client, and ends when Ka transaction In general, R A OtheNservice operation completes. If the invoked service completes successfully, the
K transaction started is committed; otherwise errors roll back the transaction.
With the Oracle SOA Suite 12c platform, a transactional service can be implemented as a Java web service, a Database adapter, a JMS adapter, and the AQ adapter—each of which can be invoked from the Mediator and BPEL components. Note: SOAP endpoints, File adapter, and FTP adapter service implementations are nontransactional; that is, they do not join existing transactions and start new transactions (if any). In each case, transactional boundaries depend on the context, configuration, and environment of the services that are implemented and invoked. Transaction semantics are different for services that are invoked synchronously as compared with services that are invoked asynchronously. Note: In the case of multiple operations with a database (for example, insert, delete, and update), these multiple operations constitute a single transaction.
Oracle SOA Suite 12c: Build Composite Applications 5 - 39
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz The ____________ exposes the database operations that can be invoked by the components in a composite application. a. File adapter b. Socket adapter c. Database adapter d. Oracle Application adapter
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARc N KOThe Database adapter exposes the database operations that can be invoked by composite applications. However, using the Oracle Application adapter, you can access and invoke service operations that ultimately perform database operations through stored procedure calls. But, this is not the same as directly invoking database SQL operations.
Oracle SOA Suite 12c: Build Composite Applications 5 - 40
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary In this lesson, you should have learned how to: • Discuss the adapter architecture • Identify the types of technology adapters • Configure and use the JMS adapter • Configure and use a Database adapter • Describe the configuration of runtime connections for adapters
le
an r t n
s
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 5 - 41
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 5-1 to 5-4 Overview A Database adapter provides access to a database table with credit card information. Exposed Services
request
Entry Point
Components
External References
Mediator
DB Adapter
response
le
b a r e f
s
A synchronous Mediator provides bidirectional routing and transformation of request and response messages.
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ice a composite application that receives a credit card number and a K J you lcreate In this R practice, NA order total. The application uses a Database adapter to query credit card Opurchase
K information in an Oracle Database. Based on the results of that query, a status of VALID or INVALID is returned.
To create this application, you: • Create a new SOA project • Add a Database adapter that is configured to perform a select operation on the database • Add a synchronous Mediator, defining a WSDL interface based on the elements of the file creditcheck.xsd •
Deploy and test the composite application with both valid and invalid credit card numbers
Oracle SOA Suite 12c: Build Composite Applications 5 - 42
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 5-5 to 5-7 Overview A JMS adapter publishes a message to a JMS queue.
Exposed Services
request
Entry Point
Components
External References
Mediator
JMS Adapter
le
b a r e f
(producer)
s
an r t n
no a An asynchronous Mediator provides s ฺ a h one-way routing and transformation of ) ide m the request message. u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice KJ
R
In these practices, you create a new SOA project. You add a JMS adapter and configure that adapter to publish messages to a queue. You then add a Mediator to perform message routing. Finally, you deploy and test the JMSProducer composite application.
K
A ON
Oracle SOA Suite 12c: Build Composite Applications 5 - 43
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Optional Challenge Practice 5-8 Overview Destination Name (Queue): jms/soaDemo/Queue JNDI Name: eis/soaDemo/Queue
Exposed Services
Components
File output
External References
le
b a r e f
s
an r t n
no a s so ฺfar. a In this practice, you recall and apply the skills that you havehlearned ) in the previous ide practice. You create a project to consume the messages produced m u o Gthem. You determine the components to add, and howฺc to configure t m n b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice practice, you create a new SOA project that is configured to K J unstructured In this R optional, NA the messages that are sent to the queue in the previous practice. The messages Oconsume
K pass through the application unchanged and are written to a file.
Oracle SOA Suite 12c: Build Composite Applications 5 - 44
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Optional Challenge Practice 5-9 Overview Set the message property. From: $in.request/inpl:Shippingrequest/inpl:custName To: $out.property.jca.jms.JMSProperty.Artist
Entry Point request
Mediator
JMS Adapter (producer)
le
Set the Message Selector: Artist LIKE '%Berry’
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A liceyou modify your previous SOA project so that JMSProducer sets a K J practice, In this R optional message property to a specific value. You then modify JMSConsumer to use a NA Ouser-defined JMS Adapter
(consumer)
K message selector so that only a subset of the published messages are received and written to a file.
Oracle SOA Suite 12c: Build Composite Applications 5 - 45
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
an r t n s
N KO A no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Introduction to BPEL
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Describe the role of the XSD, WSDL, and BPEL files in a business process module • Describe the relationship between WSDL partner link types and BPEL partner link elements • Describe the role of a business process in a composite application ble a r fe s • Create a business process in a BPEL module n tra n • Use the BPEL editor in JDeveloper no a spartners • Use basic BPEL activities to interact with a ฺ h e ) d i u in BPEL • Use the Assign activity to manipulate om tdata c G ฺ variables ฺibm den
in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • •
Introduction to Business Processes and BPEL BPEL Process in Oracle SOA Suite 12c
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Business Processes and BPEL
Service
Service
Service
Service
WSDL
WSDL
WSDL
WSDL
orchestration
BPEL Engine
le
b a r e f
s
an r t n
no a s ฺ a h ) de BPEL ฺcom Gui m ent b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K canl be incorporated into a business process through the use of the Business MultipleRservices Process NA Execution Language, or BPEL. The BPEL specification defines the XML grammar that O K allows you to describe a business process. This process may (among other things) invoke services, manipulate data, and throw faults.
Multiple services are orchestrated by a BPEL engine (such as the Oracle BPEL Process Manager) by using the BPEL, WSDL, and XSD files. In the context of BPEL, the term orchestrating means to coordinate the flow of information to and from clients and between the services invoked by the BPEL process to implement all or part of a business process. The engine creates representations of the process (instances of the process) in an application server (such as WebLogic). In Oracle SOA Suite 12c, a BPEL process is a component of a SOA composite application, which receives and returns data through service entry points. The service entry points can be wired to a BPEL process component, which processes the data and interacts with the external references (external services) of the composite application. When a message is received, the BPEL engine creates a new process instance and starts it. The engine is in charge of executing the business logic specified in the BPEL process.
Oracle SOA Suite 12c: Build Composite Applications 6 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Parts of a BPEL Process
BPEL Process
Client
Partner Links
Partner Links
Interface
Partner Link External ble a r Service sfe
n
tra n o
an s ha deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K The key elements ofla BPEL process are: R A O•N A service interface, which is the WSDL that describes the BPEL process operation and The service interface (WSDL) describes the BPEL process operation and the associated request and (optional) response message structures.
K
•
•
Activities make up the BPEL process flow or sequence of instructions to be executed.
Partner links represent a reference to the external services that are invoked by BPEL process activities.
associated request and optional response message structures. A BPEL process can be exposed as a service for a composite application. The service interface provides the BPEL client with a way to interact with the BPEL process component. Activities, which are the actual XML elements that make up the BPEL process flow or sequence of instructions to be executed. This usually involves invoking other services to perform the function required for a business process implementation. Partner links, which represent a reference to the external services that are invoked by the BPEL process activities. In the JDeveloper Composite Editor, when you wire a BPEL process component, an external (service) reference—a partner link—is created in the BPEL process component. A partner link describes the roles played for the interaction between the BPEL process and the service that it invokes.
Oracle SOA Suite 12c: Build Composite Applications 6 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
BPEL, WSDL, and XSD BPEL includes all information from both the WSDL and XSD files. Imported into BPEL
WSDL describes message types.
le
Imported into WSDL
b a r e f
s
an r t n
no a s ฺ a h ) XSD describes ide m u o message structures. ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceprocess interacts with other web services. To connect with those i l K By definition, a business AR the BPEL process imports the information stored in the WSDL for each service. services, N O
K Recall from the conversation about WSDL that these documents in turn import information from the XSD files. Therefore, a BPEL file typically includes a series of statements that enable the process to leverage the information stored in each service’s WSDL and XSD files.
Oracle SOA Suite 12c: Build Composite Applications 6 - 6
Partners, Partner Links, and Roles
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
BPEL partnerLink
le
WSDL partnerLinkType
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce a relationship between the BPEL process and the invoked service i l K Each interaction represents ARa role that each plays in the interaction. To identify the roles and relationships that are through N KO applicable in an interaction, a BPEL process uses a partner link and a partner link type. A partner link, which is defined in the BPEL source, describes the roles that the BPEL process and the invoked service play. Each role is associated with a port type (operation defined in the WSDL), which determines the message data structures the process and the invoked service can manipulate in their respective roles. A partner link is configured with a name, a partner link type, and one role for synchronous interactions or two roles for asynchronous interactions. A partner link type, which is defined in a WSDL document, describes the possible interactions a service can perform, thereby characterizing the conversational relationship between two services by specifying roles for each type of interaction offered by the service. A partner link type defines one or two roles. • One role indicates that the service can complete the conversation without a callback. • Two roles indicate that there is a requirement to receive a callback from the service. A role is associated with a port type, which is defined in the WSDL of a service, which determines the operation performed by the role and the message structure received in a request or returned as a response within the context of the conversation.
Oracle SOA Suite 12c: Build Composite Applications 6 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Variables in BPEL
Request
Receive
Assign
Client
Invoke
Assign Reply
Input Message
Partner
le
b a r e f
Output Message
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K The BPEL engine is responsible for managing the data values used by the business process. R A Typical N values include data passed to the process via the invoking client partner, and the reply O Reply
K data to be sent back to that partner. Similarly, input and output messages for invoked services
may need to be created or tracked or both. Finally, the process may have the need to maintain data internally, such as sequence numbers and so on. All this data can be stored in BPEL variables. The BPEL process file declares its variables before the sequence of activities is begun. An example appears in the slide. Note: Local variables can be utilized within a Scope activity, which we will discuss later in this lesson.
Oracle SOA Suite 12c: Build Composite Applications 6 - 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Interacting with Partners
Request
Receive
Assign
Client
Invoke
Assign Reply
Input Message
Partner
Information from the partner’s WSDL is referenced here.
le
b a r e f
Output Message
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A lice into discrete steps, or activities. The BPEL specification identifies K J is organized A BPELRprocess a number NA of activities with a variety of applications. One group of activities includes primitive, or O Reply
K basic, activities. These activities may instruct the BPEL engine to invoke an operation on some service to wait for a message to be received from a client, to generate the response of an input/output operation, to copy data from a source to a destination, to indicate that something went wrong, or a number of other tasks.
Three different activities are used for interacting with partners. The first of these is the Receive activity. Receive represents the input (receipt of a message) of a WSDL operation provided by the process. An example is shown in the slide. Attributes of the Receive activity include the partnerLink, as well as the portType and operation of the process that the partner is targeting. The Receive activity takes the incoming message, puts it in the specified variable, and ends. The createInstance attribute is of particular importance here. The BPEL script is a blueprint for a process, but that process is instantiated by the BPEL Service Engine only when a createInstance attribute set to “yes” is encountered.
Oracle SOA Suite 12c: Build Composite Applications 6 - 9
The second activity that interacts with partners is the Invoke activity. The Invoke activity invokes a one-way or request-response operation between the BPEL process and a partner web service on a port provided by the partner.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Parameters for the Invoke activity, such as portType, partner, and operation, are specified as attributes. Also specified are the input and output variables, which contain the input and output of the operation being invoked. Finally, if the process needs to send back a synchronous reply to the client partner who sent the message, a Reply activity is also necessary. The partnerLink, operation, and portType attributes for the Reply activity should match those of the corresponding Receive activity.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Synchronous Process Concepts Obtains the request with a Receive activity
1
Receive
2
Assign
Request: Name
Client
Concatenates "Hello " + Name Response: Hello Name
3
Reply
le
b a r e f
s
an r t n
no a Returns the response as eฺ with a Reply activity) h om t Guid c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J K BPELl process: A synchronous R A O•N Contains activities that should not take a long time, because the client waits for the
K
• •
response Obtains the request with a Receive activity Returns the response with a Reply activity
When you create a synchronous BPEL process, Oracle BPEL Process Designer automatically creates a BPEL process template with a Receive activity and a Reply activity. You create additional processing tasks between the Receive and Reply activities. The slide illustrates the simple design of a HelloUser BPEL process. The process is shortlived, and sends a response (a Reply) to its invoker. It meets the criteria for a synchronous process. The sequence of activities in the HelloUser process design is as follows: 1. Receive a request XML message that contains a name string and that is input from the client (invoker). 2. Assign the text "Hello" concatenated to the name string that is received as input to the result message. 3. Reply with the result XML message (output data) that is sent to the client in response.
Oracle SOA Suite 12c: Build Composite Applications 6 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Asynchronous Process Concepts Obtains the request with a Receive activity
1
Receive
2 Client
3
Some number of long-running intermediate steps
Receive Invoke
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceprocess: i l K An asynchronous BPEL R A N O• Contains activities that may take some time
The final Invoke operation is a callback. (Omit the final Invoke activity for a oneway operation.)
K
• •
Obtains the request with a Receive activity Returns an optional response with a callback that is implemented with an Invoke activity
The basic structure of an asynchronous BPEL process flow, as created by the Oracle JDeveloper Create BPEL Process wizard, comprises the following items: 1. A Receive activity at the start of the flow 2. Some number of long-running intermediate activities 3. An Invoke activity at the end of the flow Oracle BPEL Process Manager automatically manages the correlation between the clients of the invoked process by using WS-Addressing techniques. This enables a long-running process to invoke the client when the process is complete. The final Invoke operation is a callback. The client should not have to wait for an asynchronous process to complete before it responds and must provide a way for the invoked process to call it back to obtain the result (response). Note: The slide shows an asynchronous process structure created by Oracle BPEL Process Designer when using the Asynchronous BPEL Process template.
Oracle SOA Suite 12c: Build Composite Applications 6 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Assigning Values to Variables
Request
Receive
Assign
Input Message
le
Client
Invoke
Partner
b a r e f
s
an r t n
no a s ฺ a h ) de i Reply m u o Reply ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce a BPEL process and its partners must conform to a particular i l K Data exchanged between AR structure. These structures are defined by the service WSDL, and usually consist of message N KO XML elements described by an XML schema document. Assign
Output Message
The two most commonly used variables are inputVariable, which receives the client request, and outputVariable, which contains the client response. Each service invoked by the business process also has an associated input variable, and if it returns a response, a variable is defined to store that data.
Oracle SOA Suite 12c: Build Composite Applications 6 - 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Ordering Execution with a Sequence Activity A Sequence activity is a container used to define the execution order of activities. A Sequence can be used to logically group related steps.
Request
Receive
Activity 1
Activity 2
le
client
Activity 3
b a r e f
s
an r t n
no a s ฺ a h ) Sequences ide can be nested. m Reply u o ฺc nt G Reply (not shown: A Sequence m b e i must contain at least one ฺ n Stud i activity.) @ is n i kja se th r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ca ecollection of activities to be performed in sequential order. A Sequence i l K A Sequence contains AR can be N O used to logically group related steps, thus simplifying larger business processes. (nested)
Sequence
K
Oracle SOA Suite 12c: Build Composite Applications 6 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Structuring a Process with a Scope Activity
Request The Scope activity provides a container and a context for other activities. A Scope provides handlers for faults, events, and compensation, as well as data variables and correlation sets. Client
Receive
Assign
Invoke
Input message
Partner
le
Assign
Output message
b a r e f
s
an r t n
no a s ฺ a h ) idecan be nested. m Reply u o Scopes ฺc nt G Reply m (not shown: A Scope must b e i ฺ d contain at least one activity.) in Stu @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J Kactivity isl used to manage complexity and provide a container and context for other The Scope R activities NA within a BPEL process. It may contain constructs such as variable definitions, faultO (nested) Scope
K and event-handling definitions, and others. A Scope is a structured activity that contains one other (mandatory) activity (which may itself contain other activities). Scopes may be nested.
Note: Scopes are important in BPEL processes in a number of different ways. This lesson focuses on Scopes as they relate to variables. In the lesson titled “Handling Faults in Composite Applications,” we discuss Scopes as they relate to fault handling and compensation.
Oracle SOA Suite 12c: Build Composite Applications 6 - 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Global and Local Variables
BPEL Process Built-in Types XML Schema …
Element Type WSDL
Variable Type
Scope
Local Variable
Message Type
Global Variable
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce at the process level are called global variables. They are visible to all i l K Variables that are created AR within the BPEL process and are present for the lifetime of the process. Variables the activities N KO that are created within a scope are called local variables. They are visible to activities only within their own scope, and they are discarded when the scope ends.
When created, a variable in BPEL is assigned a data type. That type determines its structure and memory (size) requirements. Variable types can be derived from built-in XML data types, such as string, boolean, int, and others. They can also be derived from an XML element type defined in an XML schema document (XSD) file, or can be described by a message type defined in the imported or inline XML schemas of a WSDL document. Note: It is a best practice to keep common element type definitions in a centralized XML schema document to enable sharing across cooperating services.
Oracle SOA Suite 12c: Build Composite Applications 6 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Manipulating Data in Variables
Source Variable
XPath Functions • • • • •
Type Conversion Database Functions Date Functions Logical Functions String Functions and more
Target Variable
Because XPath is used to copy data values, a rich library of XPath functions is available to enable evaluation and manipulation of data values held in variables.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e licactivity, K J Assign During R a BPEL data is copied from variable to variable. assign includes a A N element and a element. There are multiple forms of the from element. One of KO the most powerful specifies an expression to be evaluated by using XPath. This expression can be anything that XPath will allow, provided it returns an XPath value type (string, number, or Boolean). Expressions are often used to do simple math (increment sequence numbers), string concatenations, or other operations on variables, messages, or other values.
Oracle SOA Suite 12c: Build Composite Applications 6 - 17
Transformation
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
BPEL Design Time uses
XSLT Mapper
Transform defines
Source-def.xsd
Transform.xsl
le
Target-def.xsd
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m XSLT b e nฺi StudProcessor Source XML i Target XML @ n s jai e thi k r a © 2014,uOracle s and/or its affiliates. All rights reserved. n Copyright o k e to ( AIN icens J l involves many copy statements between complex data structures, it K If a given Assign activity R may be preferable to use the transform activity and the associated design-time visual NA O BPEL Run Time
K mapping capabilities inherent in the XSLT Mapper.
Transformations are implemented as a BPEL Assign activity with a BPEL extension annotation that enables the design-time visual representation to be a Transform activity. The element defines an expression that uses the ora:processXSLT function, which is an Oracle extension service to BPEL. This extension enables the runtime engine to execute the transformation in the XSL processor provided by the Oracle Application Server Java EE container service infrastructure. The graphic in the slide shows the design-time components, where a BPEL Transform is created from which the XSLT Mapper is opened to create an XSL file that defines the mapping rules for converting elements from a Source-def.xsd to a Target-def.xsd. The BPEL run time shows the Transform.xsl file being used by the XLST processor to convert a source XML structure to a target XML structure.
Oracle SOA Suite 12c: Build Composite Applications 6 - 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz The BPEL engine instantiates a business process when a message is received by an activity (often a Receive activity) with the createInstance attribute set to “yes.” a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J lice Answer:RaK NAReceive represents the input (receipt of a message) of a WSDL operation provided by the True. O K process. The process is instantiated by the BPEL Service Engine when a createInstance attribute set to “yes” is encountered.
Oracle SOA Suite 12c: Build Composite Applications 6 - 19
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • •
Introduction to Business Processes and BPEL BPEL Process in Oracle SOA Suite 12c
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
BPEL Design Editor
The process model is composed of activities in the center canvas.
BPEL activities are available in the Component Palette.
le
b a r e f
s
an r t n
K
no a View and edit the s ฺ a h process as a ) ide m model, or as XML. u Client and service partners o ฺc nt G are displayed inm their b ฺi lanes. de respectivenswimlanes. swim u i t in@ this S a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K The slide shows the JDeveloper BPEL Editor with a visual representation of the process R A diagram N on the Design tab. The Design tab is divided into three swimlanes: O •
• •
The left partner link swimlane contains the BPEL process service interface that clients, applications, or components use to interact with the BPEL process component. The right partner link swimlane contains external service references. The middle swimlane contains the BPEL process activities that form the process flow.
The main editor window has a Source tab to view and edit the BPEL XML source that was created in the Design view, and a History tab to view historical changes. The Component Palette contains components that can be added to your BPEL process flow.
Oracle SOA Suite 12c: Build Composite Applications 6 - 21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Standard JDeveloper windows (not shown) offer additional editor support. • The Application Navigator panel shows the files within the application and projects. • The Structure panel contains two ways to view the XML structure of the BPEL process. The Source tab shows the raw XML source element hierarchy. The BPEL tab shows the BPEL process component structures in a tree format. You can edit the BPEL process in the Structure panel. Next to the Structure panel is a Thumbnail view that provides a movable frame to change what is visible on the Design tab page. • The Log windows enable you to view design-time errors and check validation results. • The Property Inspector shows properties for a subset of selected objects.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 22
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Creating a BPEL Process
XSD describes the XSD describes the request and request and response messages response messages. the process will use.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce a business process is built as a service component within a i l K In Oracle SOA Suite 12c, AR application. When complete, the BPEL component is configured with the necessary composite N O A WSDL file (which may include XSD references) describes each external partner interface.
K XSD files to define the XML data types used in the process, the WSDL files that describe the interfaces for the partner services, and the BPEL file, which contains the source code for the business process itself.
A BPEL component can be added to a composite application at any time, but it cannot be configured until the necessary XSD and WSDL files are created and are available. For this reason, it is more efficient to ensure that XSD files are created to describe all message types, and WSDL files are available for all external service partners before undertaking the completion of a BPEL component. Note: The Web Services Inspection Language (WSIL) connection can be used to locate the WSDL path in the Create Partner Link configuration windows in the BPEL Editor. However, for production runtime environments, it is recommended to consider using an Enterprise Repository and a Service Registry solution for the additional SOA governance capabilities that they offer. You can also access service URLs by using an Application Server connection. However, only SOA composite application services are exposed through an Application Server connection, whereas Java EE Web Services and SOA services are exposed through the WSIL connection.
Oracle SOA Suite 12c: Build Composite Applications 6 - 23
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Mapping Values to Variables Simple copy operations in an are generated with drag-and-drop.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A licefrom one variable to another with simple drag-and-drop actions in the KbeJ assigned ValuesR can A pane. Edit NAssign O K
Oracle SOA Suite 12c: Build Composite Applications 6 - 24
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using Expression Builder
XPath expressions are built in Expression Builder.
le
s
an r t n
The XPath function library is categorized by type.
b a r e f
no a s ฺ a h ) ide Variables are available m u o in a tree structure. ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cassignments i l K More complex variable can be created with Expression Builder. With it, XPath R A expressions and function calls can be invoked to assign values to target variables. N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 25
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Testing a BPEL Process
Supply input values and run the test.
The response is displayed. The Flow Trace is accessed from here.
le
The Flow Trace lists each step of the test and its state.
b a r e f
s
an r t n
no a s ฺ a h ) ide Click the BPEL m u o ฺc nt G process to access m b the audit trail. nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceprocess are the same as those for any composite application. If the i l K The steps to test a BPEL AR application service entry point operation selected for the test is a synchronous composite N O
K operation, the test page is refreshed with the response or fault information on the Response tab page.
For synchronous and asynchronous operations, the Launch Message Flow Trace link is always visible, enabling you to drill down into the details of the composite application execution. To view the results of an asynchronous operation test, you must click the Launch Message Flow Trace link. When you click the Launch Message Flow Trace link, a new web browser window is opened with the Flow Trace page for the composite application instance. On the Flow Trace page in the Trace section, to view the audit trail for the BPEL process, click the BPEL component link name in the Trace tree.
Oracle SOA Suite 12c: Build Composite Applications 6 - 26
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Examining the BPEL Process Audit Trail The Flow tab provides access to the Visual Flow information for the process.
The Audit audit trail Trailallows allows you to examine values at each activity.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J liclink ClickingRaK component in the Trace section of a Flow Trace page opens the Audit Trail tab A page. N For a BPEL process, the execution sequence of activities in the process is displayed, KO either in completion or up to the activity that the process executed (if still active). On the Audit
Trail tab page, you can expand the activity sections and their child nodes to examine the effects of that activity and the payload (data) changes made. Next to the Audit Trail tab, you can see the following additional tabs: • The Flow tab displays a visual form of the process flow, similar to the BPEL model in the JDeveloper BPEL Designer. • The Sensor Values tab enables you to view the BPEL sensor data (if any) produced by the activity, variable, or fault sensors implemented in the BPEL process. • The Faults tab displays the details of any fault conditions that arise during the BPEL process execution. (Faults are discussed in the lesson titled “Handling Faults in Composite Applications.”)
Oracle SOA Suite 12c: Build Composite Applications 6 - 27
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Examining the BPEL Process Visual Flow
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m The Visual Flow lets u o c activity t G you click ฺan m n b e i and view information. ฺ d in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l a graphical representation of the activity sequence executed by the KFlow provides The Visual R BPEL NAprocess. On the Flow tab page, you can click each activity icon to open and view the O
K details for that activity in its Activity Detail window.
Note: If the BPEL process is still executing, click the refresh icon (on the top-right corner of the page) to get an updated view of the process over time.
Oracle SOA Suite 12c: Build Composite Applications 6 - 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz A business process can be deployed as a stand-alone application separately from a composite application, and can then interact with the composite at run time. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J lice Answer:RbK NAIn Oracle SOA Suite 12c, a business process is built as a service component within a False. O K composite application.
Oracle SOA Suite 12c: Build Composite Applications 6 - 29
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary In this lesson, you should have learned how to: • Describe the role of the XSD, WSDL, and BPEL files in a business process module • Describe the relationship between WSDL partner link types and BPEL partner link elements • Describe the role of a business process in a composite application ble a r fe s • Create a business process in a BPEL module n tra n • Use the BPEL editor in JDeveloper no a spartners • Use basic BPEL activities to interact with a ฺ h e ) d i u in BPEL • Use the Assign activity to manipulate om tdata c G ฺ variables ฺibm den
in Stu @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 6 - 30
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 6 Overview
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce a composite application that includes a simple BPEL process. The i l K In this practice, you create R Aprocess BPEL accepts input, and calls the credit card validation project that you built in the N KO previous practice.
Oracle SOA Suite 12c: Build Composite Applications 6 - 31
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
le
an r t n s
N KO A no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
More BPEL Activities
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Perform conditional branching by using an If activity • Implement parallel processing by using a Flow activity • Implement non-blocking invocation with a Flow • Create parallel branches dynamically with a forEach activity le • Implement a Pick activity with an alarm and a timeout erab sf • Execute activities repetitively with a While activity-tran
on n a s a h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • •
More Activity Types Interaction Patterns
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Conditional Branching with the If Activity Use elseif to test alternative conditions.
le
b a r e f
s
an r t n
no a s ฺ a h ) Expression Use the Empty ideUse m u Activities are executed if o Builder define cdo nothing. activityฺto G the test tocondition t condition is true. m n for the If. nฺib Stude i @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l branching is defined with the If activity. An If element includes: K conditional In BPEL 2.0, R A O•N A condition to be evaluated If can be nested.
K
• •
One or more activities to be executed if the condition evaluates to true An branch, which includes one or more activities to be executed if the condition evaluates to false An If activity may also include one or more ordered branches, each with a condition to be evaluated. Only one branch is executed; that is, the first branch that returns a true result is processed, and no other branch is evaluated. Note: For the XPath expressions and conditions that are created in XPath Expression Builder, it is recommended that you use explicit type conversion where appropriate to avoid subtle problems that can arise from implicit type conversion in an XML context. For example, XML data is usually treated as string data, and comparing two numerical strings performs a stringbased comparison that may not yield the intended result for a numerical value comparison.
Oracle SOA Suite 12c: Build Composite Applications 7 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Processing with the Flow Activity flowactivity activityenables enables The Flow two or more sequences of activities to be processed concurrently.
le
b a r e f
s
an r t n
no a s ฺ a h ) The Flow completes ide m u o when all activity ฺc nt G m b sequences are finished. nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce implements the processing of concurrent sequences of activities. A i l K In BPEL, the Flow activity R Aactivity Flow may contain one or more branches, each with its own activity sequences that are N O
K processed simultaneously. Each branch of the flow must contain a Sequence activity, which in turn may contain additional activities (including a nested Flow activity). Flow branches are specified at design time. At run time, a Flow terminates when all flow branch sequences have completed.
Oracle SOA Suite 12c: Build Composite Applications 7 - 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Using the nonBlockingInvoke Property
If a synchronous Invoke blocks execution until it completes…
Invoke
…the asynchronous Invoke waits until the synchronous Invoke completes.
Invoke Receive
2
le
b a r e f
Solution: Edit the partner link for the synchronous service. Set the nonBlockingInvoke property to true.
s
an r t n
no a s ฺ a h 4 ) ide m u o ฺc nt G m b 3 nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceSequence construct are processed sequentially. A synchronous i l K The activities in a BPEL AR Invoke N O activity in a Flow branch causes the remaining Flow branches to wait until the 1
K synchronous exchange is completed. This has the effect of serializing the execution of Flow branches. However, by setting the nonBlockingInvoke partner link binding property to true, the Invoke activities are executed in separate threads.
The nonBlockingInvoke property has a default value of false, in which case the invocation is executed in the same thread as the BPEL process instance. When this property value is set to true, a separate thread is spawned to do the invocation so that the Invoke activity does not block the instance. To add the nonBlockingInvoke property to a partner link, perform the following steps: 1. 2. 3. 4.
In the BPEL Designer window, right-click a partner link and select Edit. In the Edit Partner Link window, click the Property tab, and then the Create Property icon. Select the nonBlockingInvoke value from the Name drop-down list, and click OK. In the Edit Partner Link window, replace the text “Property Value” with the value true, and click OK. The property value is inserted inside the BPEL component element in the composite.xml file.
Oracle SOA Suite 12c: Build Composite Applications 7 - 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Parallel and Sequential Looping with the forEach Activity
Both sequential and parallel looping are supported.
le
Declare the starting Declare start and end and final values for values for the loop. the loop counter.
b a r e f
s
an r t n
no a s ฺ a h ) In BPEL 2.0, the forEach ide m u o activity performs looping ฺc nt G m iterations sequentially N times b over a given set of activities. nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce both sequential and parallel looping iterations. By default, the i l K The forEach activity supports ARactivity performs looping iterations sequentially N times over a given set of activities forEach N O
K that are defined within a Scope activity. For instance, the forEach activity iterates over an
incoming purchase order message where the purchase order message consists of N order items. The enclosed Scope activity must be executed N+1 times, with each instance starting only after the previous iteration has completed. In parallel iteration, all looping iterations are started at the same time and processed in parallel. Parallel iterations are useful in environments where sets of independent data are processed or independent interaction with different partners is performed in parallel. In these scenarios, execution of the N+1 instances of the contained Scope activity occurs. Each copy of the Scope activity has the same counter variable that you specify. Each instance’s counter variable must be uniquely initialized in parallel with one of the integer values beginning with the starting counter value and proceeding up to and including the final counter value.
Oracle SOA Suite 12c: Build Composite Applications 7 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Unlike a Flow activity, the number of parallel branches is not known at design time with the forEach activity. The specified counter variable iterates through the number of parallel branches, controlled by the starting counter value and the final counter value. You can also specify a completion condition on the Completion tab. This condition enables the forEach activity to complete without executing or finishing all the branches specified. An example would be: You send out parallel requests and a sufficient subset of the recipients has responded.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Suspending a Process with the Wait Activity You can suspend a BPEL process by using the Wait activity.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce process by using the Wait activity. The Wait activity pauses for a i l K You can suspend a BPEL AR amount of elapsed time or until a specified date-time. specified N KO The Wait activity pauses for a specified amount of elapsed time or until a specified date-time.
The slide shows the configuration window for a Wait activity. You can use an expression to calculate the time period for which the process will wait or the time it waits until. For example, if you set a Wait for 2 minutes, the BPEL Designer creates the following Wait element:
Here, the P designator must always be present and precede the year (Y), month (M), and day (D) parts, each of which is preceded by a number, if present. The T precedes the time parts for hour (H), minutes (M), and seconds (S). If you use an expression to set the wait time, the resulting string must conform to the following format: “P1Y1M1DT1H1M1S.” For example, a Wait for 1 year, 1 month, 1 day, 1 hour, 1 minute, and 1 second is: An example of a Wait until a specified date and time is: Note: The time format conforms with the ISO 8601 international time format standard.
Oracle SOA Suite 12c: Build Composite Applications 7 - 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Waiting for a Message with the Pick Activity The Pick activity is used to wait for a message, just as a Receive activity does.
An onAlarm branch implements a wait time, and provides an optional timeout.
le
b a r e f
s
an r t n
K
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ceto wait for a message (just as a Receive activity does), but with an i l K The Pick activity is used ARtimeout. To achieve this, it includes two branches: optional N O • •
One or more onMessage branches receive a specific message from an operation that is exposed by a service through a partner link. Zero or more onAlarm branches implement a wait time.
One branch is selected before the other, based on the occurrence of the associated event. After the Pick activity has accepted an event for handling, other events are no longer accepted. The possible events are the arrival of some message in the form of the invocation of an inbound one-way or request-and-response operation, or an alarm based on a timer (analogous to an alarm clock). The Pick activity completes when one of the branches is triggered by the occurrence of its associated event.
Oracle SOA Suite 12c: Build Composite Applications 7 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Looping with the While Activity
The While executes its activity in a loop if its condition is true.
le
b a r e f
s
an r t n
no a s ฺ a The While contains a h e ) single activity, which idThe m u o condition is may be a Sequence ฺc nt G defined m with or a Scope. b e i ฺ d Expression Builder. in Stu @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l to repetitively execute a single activity (or a set of activities in a K continues A WhileRactivity Sequence NA or Scope) if the specified condition is true. When the condition becomes false, the O
K loop terminates.
To add and configure a While activity, perform the following steps: 1. Drag a While component from the Component Palette to the process diagram. 2. Click the View Condition Expression icon and construct the conditional expression in Expression Builder. 3. Expand the While activity and drag another activity, Sequence, or Scope, into the body of the While activity. Note: When working with a While activity, treat it as a traditional programming loop construct, such that you: • Perform an initialization before the loop • Evaluate the condition before entering the loop • Execute the body of the loop if the condition is true • Increment or modify the variables that affect the condition, such as the example for using a counter, as shown in the slide
Oracle SOA Suite 12c: Build Composite Applications 7 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Indexing XML Arrays Dynamically To access the nth element of an XML array, use the XPath expression syntax: /parent/array[n]/child $i <= $numItems and $inStock=true() $inputVariable.payload/ns2:product[position()=$i]/ns2:prodId $Invoke_check_getInternalStoreView1_InputVariable.parameters/ns4:prod Id
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce processing, you may need to index XML array structures. Accessing i l K When performing dynamic ARelement of an XML array uses the following XPath expression syntax: the nth N KO /parent/array[n]/child For dynamic index expression, use either the XPath syntax [position()=num] or simply the value [num].
Here, the value n is enclosed in square brackets to form the index (starting from 1) for a specific XML array element. For example: To obtain the price of the second item in a purchase order, the XPath expression could be /OrderItems/Item[2]/price. Note: For dynamic index expression, use the XPath syntax [position()=2].
Oracle SOA Suite 12c: Build Composite Applications 7 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz The Flow and forEach activities are the two looping constructs that are available in BPEL. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J lice Answer:RbK NAThe While and forEach activities are the two looping constructs that are available in False. O K BPEL. The Flow activity implements processing of concurrent sequences of activities.
Oracle SOA Suite 12c: Build Composite Applications 7 - 13
Basic BPEL 2.0 Activities
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Web Services
Receive
Reply
Invoke
Updating Variables
Assign
Validate
Transform
XQTransform
Fault and Error Handling
Throw
le
Rethrow
Catch
b a r e f
Catch Alls
an r t on Compensate CompensateScope n a s a h deฺ Miscellaneous ) om t Gui c ฺ m en Empty Wait Exit b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l of the BPEL activity icons that appear on the Component Palette or in Kshows some The slide R A process flow. The activities are classified, similar to the definitions found in the WSthe NDesign O BPEL V2.0 specifications. Activities are defined as Basic or Structured activities, which are
K subdivided into functional groups. Basic Activities
Invoking and Providing Web Service Operations • Receive: Waits for an initiating message or an asynchronous callback response message from a service • Invoke: Enables you to invoke a service (identified by its partner link) and specify an operation for this service to perform • Reply: Allows the process to send a message in reply to a message that was received through a Receive activity Updating Variables and Partner Links • Assign: Manipulates XML data to copy the contents of one variable to another • Validate: Provides the ability to validate variables against schema definitions • Transform and XQTransform: Process XSL and XQuery Transformations that map source elements to target elements to update variables
Oracle SOA Suite 12c: Build Composite Applications 7 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Fault and Error Handing • Throw: Generates a fault from inside the business process • Rethrow: Allows you to raise a previously handled fault • Compensate: Executes a compensation handler, which contains a sequence of activities executed, to reverse the results of a fault scenario • CompensateScope: Points to a scope whose compensation handler is to be run • Catch: Enables you to trap a name (specific) fault or an error condition • Catch All: Enables you to catch unnamed (non-specific) fault or error conditions Note: The Catch and Catch All activities are branches of a Scope activity. Miscellaneous • Wait: Allows a process to specify a delay for a certain period of time or until a certain deadline is reached • Exit: Enables you to end the tasks of an activity (for example, the fault-handling tasks in a catch branch) • Empty: Provides a no-operation activity. This is useful for inserting sensor points for monitoring business activity or when a fault needs to be caught and suppressed.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 15
Structured and Extension BPEL 2.0 Activities Sequential and Parallel Processing
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Execution Context
Scope
Sequence
Flow
Looping Execution
While
ForEach
RepeatUntil
Conditional Branching
Pick
onMessage onAlarm
le
If
b a r e f
s
an r t n
no a s ฺ a h ) de others! iMany m u o Human Task Business Rules ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K Structured Activities R A N Execution Context KO SOA Components
•
BPEL Extensions
Scope: Consists of a collection of nested activities that can have their own local variables, fault handlers, compensation handlers, and so on. A Scope activity is analogous to a “coding block” in structured programming languages.
Sequential and Parallel Processing • Sequence: Contains a collection of activities to be performed in sequential order • Flow: Executes two or more branches of activities in parallel (concurrently) Looping Execution • While: Supports repeated performance of a specified iterative activity. The iterative activity is repeated until the given while condition is no longer true. • ForEach: Processes multiple sets of activities sequentially or in parallel • RepeatUntil: Executes the body of the activity at least once. At that point, a condition is tested. If the condition is true, the activity ends.
Oracle SOA Suite 12c: Build Composite Applications 7 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Conditional Branching Execution • Pick: Provides a way to wait for the occurrence of a set of events, such as a message (onMessage branch) arriving or a timeout condition specified by an alarm (onAlarm branch). Only one of these events is acted upon by a sequence of activities, to handle the event. • If: Enables you to define conditional behavior for specific activities to decide between two or more branches. Only one activity is selected for execution from a set of branches. SOA Components • Human Task: This Oracle BPEL Extension provides for the invocation of a Human Task service component. • Business Rule: This Oracle BPEL Extension provides for the invocation of a Business Rules service component. Other Extensions • Many other BPEL Extension activities are available on the Component Palette. To learn more about them, refer to the Developing SOA Applications with Oracle SOA Suite 12c documentation.
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 17
le
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Summary In this lesson, you should have learned how to: • Perform conditional branching by using an If activity • Implement parallel processing by using a Flow activity • Implement non-blocking invocation with a Flow • Create parallel branches dynamically with a forEach activity le • Implement a Pick activity with an alarm and a timeout erab sf • Execute activities repetitively with a While activity-tran non • Explore various SOA component interactiona patterns as eฺ • Explore a dynamic service invocation) h pattern d
om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 18
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 7 Overview
1
2
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce calling an asynchronous service. To do this, you build a composite i l K This practice demonstrates AR with two BPEL processes. application N KO
Note: In this practice, you build a synchronous process, which calls an asynchronous process. This would rarely, if ever, be considered a suitable design pattern in the real world, but it works well to illustrate many of the activities that were discussed in this lesson.
Oracle SOA Suite 12c: Build Composite Applications 7 - 19
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 7 Overview The incoming message specifies a numeric value, which is stored in the variable $numSecs. A second variable $elapsed is initialized to 0.
The While activity will loop as long as $elapsed < $numSecs.
A Wait activity pauses for 3 seconds. An Assign activity adds 3 to $elapsed. At this point, the While activity loops.
le
b a r e f
s
an r t n
no a s ฺ of a The value h ) $elapsed ide is copied m u o ฺc nt G to the reply and m b e i ฺ returned to the client. in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J Kthese is anl asynchronous BPEL process. The process uses the While and Wait The first of R activities NA to loop for a specified amount of time. The time is specified by a value passed in the O
K incoming message.
Oracle SOA Suite 12c: Build Composite Applications 7 - 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 7 Overview
The incoming message specifies a numeric value, which is passed to the AsyncProcess.
The AsyncProcess waits the specified number of seconds.
The Pick activity includes an onMessage branch that executes if a reply is received.
le
b a r e f
s
an r t n
no a s ฺ a h ) Pick activity The ide also includes an m u o G branch that executes if ฺc onAlarm t m n b no reply received within a nฺi Studespecifiedisamount i of time. @ is n i kja se th r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce the asynchronous service, and specifies how long that process i l K The second process calls AR should N O loop. The calling process then uses a Pick activity with both an onMessage and an
K onAlarm branch. The onAlarm branch specifies how long to wait for a response. If the called process returns a message before onAlarm is activated, the onMessage branch executes. If not, the onAlarm branch is triggered instead.
During testing, you pass two values to the process: one to trigger the onMessage branch, and the other to trigger the onAlarm branch.
Oracle SOA Suite 12c: Build Composite Applications 7 - 21
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Before You Begin The instructions for this practice and those that follow include path references that include XML namespace prefixes, for example: • “Use Expression Builder to define the expression string($inputVariable.payload/ns4:shipMethod).” If you have built each of the components in the order that was prescribed in the instructions, Expression Builder generates an ble ra e expression that includes namespaces that match. f s n a r -t If you have built components in a different order, or deleted, n o and then re-created components, your namespace a n prefixes s may not match what is listed in these instructions. ) ha deฺ
m
• •
i
o t Ginu your project. c In that case, use the namespace references ฺ m en b i ฺ Do NOT change those references in ttoudmatch the book.
in@ this S a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 7 - 22
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Handling Faults in Composite Applications
le
s
b a r e f
an r t n
N KO
A
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Objectives After completing this lesson, you should be able to: • Describe basic fault handling and propagation • Explain fault management for synchronous and asynchronous services • Modify a WSDL operation to have a fault message • Manage faults with Mediator components ble a • Throw and catch faults in a BPEL process r fe s n • Describe the Fault Management Framework -tra
K
on n a s a h deฺ ) om t Gui c ฺ m en b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l to design and use fault management and handling techniques by K you learn In this R lesson, NAthe following: Ousing • • •
A Mediator component A BPEL component The SOA Fault Management Framework (by implementing fault policies that can be associated with applications and components through fault-binding definitions)
You are reminded that fault management and handling depend on interaction types. Different strategies are needed for synchronous interactions than for asynchronous interactions. You learn how to design faults for synchronous interactions by specifying fault definitions in WSDL documents.
Oracle SOA Suite 12c: Build Composite Applications 8 - 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Faults: Overview Managing Faults in Mediator Fault Handling in BPEL Compensation in BPEL The Fault Management Framework Faults in Enterprise Manager
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Faults: Overview Faults are: • Errors encountered during the execution of an application • Similar to exceptions in Java There are different types of faults. We focus on two: • Business faults, which are: – – – –
Available in synchronous operations ble a Defined by a user and are application-specific r fe s n Generated when a problem is detected with data tra n o Thrown by the process or received from an invoked an s operation a
h deฺ ) • Runtime faults, which are: om t Gui c ฺ – Defined by the system ฺibm den insystem tufor incorrect logic or values S @ – Thrown by the runtime n s jai e thi k r a © 2014,uOracle s and/or its affiliates. All rights reserved. n Copyright o k e to ( AIN icens J l K R NA
KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Fault-Handling Challenges The handling and propagation (passing on) of faults is a multidimensional problem. Strategies for fault handling must consider the following: • Fault type – Business – Runtime
•
le
Component type – Mediator – BPEL component
an r t n
s
no a • Interaction type s ฺ a h ) – Synchronous ide m u o ฺc nt G m – Asynchronous b ฺi tude n i • Transactionality of the S involved s in@services i a h j k se t r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R NA
KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 5
b a r e f
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Fault-Handling Options Oracle SOA Suite provides multiple tools for responding to faults, including: • Mediator configuration options • BPEL language constructs • The Fault Management Framework • Enterprise Manager
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Faults: Overview Managing Faults in Mediator Fault Handling in BPEL Compensation in BPEL The Fault Management Framework Faults in Enterprise Manager
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Managing Faults in a Mediator
Mediator Routing Rule return to caller
1
Faults Section • Return to the initial caller • Route to a service • Publish an event
fault
le
b a r e f
s
an r t n
no a as route to a service publish )anhevent eฺ m Guid o c ฺ 2 m en3 t b i ฺ in Stud @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l when you create a routing rule for a target service that defines one K component, In a Mediator R A faults (in its WSDL), the Faults section becomes visible. In the Faults section of a orN more O K routing rule, you can add a fault handler to: 1. Return a fault from the target service to the caller of the Mediator component, provided that the WSDL of the Mediator component supports returning faults to its clients 2. Forward a fault from the target service to another service to deal with the fault message, such as a logging and notification service. You can forward faults whether or not the Mediator defines faults in its WSDL interface. 3. Publish an event When the Fault section appears in the routing rule, an initial fault routing handler is created. The target service set for the initial fault routing is: • Set to the initial caller of the Mediator component, if the Mediator component defines faults in its WSDL that can be returned to its caller • Not set to any target, if the Mediator component does not define any faults in its WSDL interface. In this case, you must forward the fault to a target that you configure.
Oracle SOA Suite 12c: Build Composite Applications 8 - 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Quiz A Mediator can return a fault to the original caller, if the fault is defined in its WSDL. a. True b. False
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J c i l K Answer: ARa N KOTrue. A synchronous Mediator can return a fault to the caller of the Mediator, provided that the WSDL of the Mediator component supports returning faults to its clients.
Oracle SOA Suite 12c: Build Composite Applications 8 - 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Agenda • • • • • •
Faults: Overview Managing Faults in Mediator Fault Handling in BPEL Compensation in BPEL The Fault Management Framework Faults in Enterprise Manager
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Faults in BPEL Processes •
During execution, a BPEL process can encounter: – Both business and runtime faults – A third type of fault known as a standard fault
•
Standard faults are: – Defined by the WS-BPEL specification – Not associated with a message type or WSDL message – Thrown by the systems
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J liceBPEL process execution because of errors generated by the invoked Koccur Faults R that during services NA or internal or system failure conditions can be handled and gracefully managed. O K Faults detected by a BPEL process may need to be returned to the process client by using a technique that is dependent on the type of interaction. The types of faults defined for a BPEL process include: • Standard faults, which are defined by the WS-BPEL specification (http://docs.oasisopen.org/wsbpel/2.0/wsbpel-v2.0.html). Some standard fault name examples are: bindingFault, conflictingReceive, invalidReply, and remoteFault.
•
•
Note: These faults have no message type, and are therefore caught without requiring a fault variable to store or access an error message. Business faults are user-defined, application-specific names that are generated by the BPEL process as a result of errors in business logic or data, such as CreditLimitExceeded. Runtime faults are caused by the errors detected in the BPEL process execution environment, known as system faults, for example: an endless loop, and SOAP faults.
Oracle SOA Suite 12c: Build Composite Applications 8 - 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Faults in Synchronous BPEL
BPEL Process Operation
request
response
fault
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o Calling Application ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce in several ways. A fault can be returned by a called service. BPEL i l K BPEL faults can be raised R Acan faults be caused by situations encountered during run time, including mismatched types N KOin an Assign activity, uninitialized variables, out-of-memory conditions, and so on. Depending on the nature of the fault and the design of the BPEL code, it may be possible to recover a fault, or to take some sort of mitigating actions before exiting gracefully. In this section, you learn more about the behavior of BPEL faults and the language constructs that are available to you to plan for and respond to fault conditions.
Oracle SOA Suite 12c: Build Composite Applications 8 - 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Synchronous Service Faults
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce Language (WSDL) for a synchronous web service describes the i l K The Web Services Definition ARresponse for a given operation. It may also describe a fault for that operation. WSDL regular N KOfaults have a name and a reference to a message definition, as shown in the example in the slide. To define a business fault for a synchronous service (WSDL does not support the creation of fault elements for one-way or asynchronous operations), perform the following: 1. In an XSD, define a fault element containing a structure for error information. The element can be as basic as a single string to contain an error message. 2. In the WSDL, create a WSDL message whose structure is defined as the XSD type. 3. In the WSDL, create a fault part in the process operation and associate it with the correct message structure. Note: Choose meaningful fault names that reflect the business fault condition, because the fault names are used in the Mediator Faults section of the routing rules and BPEL process Throw activities.
Oracle SOA Suite 12c: Build Composite Applications 8 - 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Review: Scope Activity
Request The Scope activity provides a container and a context for other activities. A Scope provides handlers for faults, events, and compensation, as well as data variables and correlation sets. Client
Receive
Assign Assign
Invoke Invoke
Input Message
Partner
le
Assign
Output Message
b a r e f
s
an r t n
no a s ฺ a h ) idecan be nested. m Reply u o Scopes ฺc nt G Reply m (not shown: A Scope must b e i ฺ d contain at least one activity.) in Stu @ in this a j k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l titled “Introduction to BPEL” that the Scope activity is used to organize K the lesson Recall R from activities NA within a BPEL process into logical units of work. A Scope is a structured activity that O K contains one other (mandatory) activity (which may itself contain other activities). Recall also (nested) Scope
that Scopes may be nested. Even if no Scopes are explicitly added to a process, there is an implied Scope at the process level. Scopes are important in BPEL processes in a number of different ways, but within this lesson, we focus on Scopes as they relate to error handling and compensation.
Oracle SOA Suite 12c: Build Composite Applications 8 - 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Fault Handlers
catch
Fault handling can be attached to the (implied) process-level Scope.
catchAll Each fault handler must have at least one Catch or CatchAll defined.
le
b a r e f
s
an r t n
no a sScopesฺ can have fault a Individual h ) defined. handlers ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K The receipt of a fault message results in a fault condition being raised in the BPEL code. R A When N this condition occurs, the BPEL engine seeks to execute any fault handlers associated KOwith that particular fault, and within the current scope of execution. The faultHandlers catch
construct is a BPEL container associated with a given Scope (or the implied process-level Scope). A faultHandlers container includes the Catch and/or CatchAll elements. These elements work in very much the same way as their Java counterparts. The Catch activity is used to intercept and deal with a specific kind of fault. A faultHandlers container may contain zero or more Catch elements. Properties of the Catch element include the Fault Name, which may be one of the BPEL-defined faults, or the faults defined in a WSDL file. You can also specify a fault variable name (name of an existing BPEL variable) that will contain the fault message.
Oracle SOA Suite 12c: Build Composite Applications 8 - 15
Use the CatchAll element to intercept and deal with all faults that are not caught by an associated Catch element. There are no properties for the CatchAll element. Its behavior is predefined and it requires no configuration. A faultHandlers container may contain zero or one CatchAll element.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Note: Both the Catch and CatchAll constructs are considered optional, but a faultHandlers container must contain at least one Catch or CatchAll element to be valid. If no fault handler is present for an error condition within the current Scope of execution, the fault is automatically propagated to the parent Scope, until the process-level Scope is reached. If no suitable fault handler is found at the process level, the default fault-handling rules of the BPEL Process Manager server are invoked.
le
s
b a r e f
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a kon e to u ( AIN icens J l RK
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Returning Faults from a Synchronous Process BPEL Client
Synchronous Process
catch
invoke
If condition
le
b a r e f
s
an r t n
noelse a s ฺ a h ) ide m u o G Reply ฺc ntReply m Fault Response b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce a fault to its client, as opposed to handling it internally. This is i l K A BPEL process can return ARas propagating a fault. For synchronous operations, the Reply activity is used to return known N O isError
K the fault. To return a fault to the process client, perform the following:
1. Define the business fault in the process WSDL for the synchronous process operation. This includes associating the fault with the correct message structure. 2. Terminate the BPEL process with a Reply activity that is configured with the Fault QName of the business fault that is defined in the WSDL. The BPEL element syntax of a Reply activity that returns a fault in a synchronous interaction is:
Oracle SOA Suite 12c: Build Composite Applications 8 - 46
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 8-1 to 8-4 Overview You then build the BPEL client that will call the training booking service. You invoke the service to reserve a seat in the class, and then invoke it again to process payment information.
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A J ce i l K R
In anticipation of building error handling, you enclose both invocations in a scope, and then enclose the enrollment invocation in a second (nested) scope activity, shown here by the red dashed line.
A
N KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 47
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 8-1 to 8-4 Overview
le
s
b a r e f
an r t n
no a s ฺ to the outer You addh aa Catch element ) which willidbeeinvoked if a specific Scope, m You add a compensation handler to the u by BookingService. o fault is returned c G ฺ nested Scope that will reverse the seat t include a m The nCatch element will assignment when invoked. b e i CompensateScope to invoke the ฺ d in Stu compensation handler. @ n i is a h j t k r e a s n u Copyright © 2014, Oracle and/or its affiliates. All rights reserved. ko e to ( AIN icens J l K R NA
KO
Oracle SOA Suite 12c: Build Composite Applications 8 - 48
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 8-5 Overview callGreeting
fault-policies.xml
fault-bindings.xml
le
sayHello
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A ice a fault policy with the Fault Policy wizard and associate the fault K J you ldesign In this R practice, NAwith the fault policy binding file. You are provided a pair of composite applications that Opolicy
K interact, but do not (yet) have any fault policies associated with them.
The SayHello project is the classic “Hello World” project. It concatenates the string “Hello” and an input string that is received as part of the project invocation. The CallGreeting [asynchronous] project accepts an input string that you provide, and then passes that string when it invokes SayHello.
Oracle SOA Suite 12c: Build Composite Applications 8 - 49
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 8-5 Overview
le
b a r e f
s
an r t n
no a s ฺ a h ) ide m u o ฺc nt G m b nฺi Stude i in@ this a j k se r a uOracle and/or its affiliates. All rights reserved. on © t2014, o kCopyright ( N nse I A e J cSayHello. i l K You shut down project When project CallGreeting attempts to invoke the service, a R A remote N fault is raised. To manually recover the fault, in Enterprise Manager, you examine the KOFlow Instances for project CallGreeting. When the Recovery Required link is displayed, you are provided the options to Retry or Abort. After restarting project SayHello, you select Retry, and observe that the Flow Trace is updated, indicating the completion of the instance.
Oracle SOA Suite 12c: Build Composite Applications 8 - 50
View more...
Comments