12c SOA Design Composites2

October 13, 2017 | Author: joydeep.bonner | Category: Service Oriented Architecture, Xslt, Computer Data, Software, Software Engineering
Share Embed Donate


Short Description

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 II D84361GC10 Edition 1.0 | November 2014 | D89148

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ฺ

Implementing Human Workflow and Notifications

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 human task concepts • Explain the human task component • Design a human task • Invoke a human task from a BPEL process • Interact with the Worklist application to act on tasks • Add email notification to a BPEL 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 licehow to: K J you learn In this R lesson, A • Implement a human task component that specifies a simple approver assignment and ON

K

• •

routing policy Include notifications to approvers that they must act on a manual approval task that has been assigned to them Send email notification messages to customers to inform them about the status of their order

This lesson discusses the human workflow concepts and the creation and configuration of the human task components. You learn how to orchestrate a human task from a BPEL process component. You also learn how to generate ADF task forms. These forms control the visual appearance of order information in the notification email message and the Worklist application. The Worklist application is used by the approvers who are assigned the task of manually approving the selected orders.

Oracle SOA Suite 12c: Build Composite Applications 9 - 2

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

Agenda • • •

Human Tasks The Worklist Application Notifications

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 9 - 3

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

Human Tasks: Introduction BPEL

The TheBPEL BPELactivities activitieswe we’ve have visited visited thus thus farfar represent represent the execution of BPEL code or service invocations.

le

b a r e f

s

an r t n

no a s ฺ a h In ) contrast,idaetask in a human m urepresents the work workflow o c G ฺ t m enthat needs to be done by a b i ฺ in Stud person (user, role, or group). @ 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 as work items. Each task is associated with parameters that Tasks R areKalso referred describe NA the nature and data related to the task. O K

Oracle SOA Suite 12c: Build Composite Applications 9 - 4

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

Human Tasks: Overview

Users or participants access task data and perform tasks through the Worklist application.

Tasks can be invoked asynchronously by application clients or from BPEL.

initiate

client

receive

parameters

le

task

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G User information is typically LDAP m b e i retrieved from an LDAP server. ฺ 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 Kworkflow supports A human the declarative assignment and routing of tasks. In the simplest R A N a task is assigned to a single participant (user or group). Often, more complex task Ocase, Task parameters are either simple data types, or XML formats, described with an XSD.

K assignment and routing are required. For example, tasks that follow an approval pattern may require the task to be routed up a management chain, or worked and voted on by a group of people. This requires some form of routing policy definition. A participant is a user or set of users specified in the assignment and routing policy definition. For example, a vacation request (task) is assigned to a manager (participant). The manager must act on the request task before the vacation starts. When the manager formally approves or rejects the request, the employee is notified of the decision. The notification can be an email, voice message, instant message, or a short message service (SMS) message. The Worklist application enables task assignees to view their assignments and act or route the task as defined by the policies. The Human Task Editor tool enables you to specify task settings such as task outcome, payload structure, task participants, assignment and routing policy, expiration and escalation policy, and notification settings.

Oracle SOA Suite 12c: Build Composite Applications 9 - 5

Human Task Service Component

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

Human Task Service Component Task Definition

BPEL

Oracle BPM Worklist

Roles and Assignments

Service Interface

Deadlines and Escalations

Presentation

Client Interface

Portals Email and RSS Clients

le

b a r e f

sand Phone n a Other r n-t Notification

no Channels a s ฺ a h ) ide m u o G ฺc Directory Identity t m n b example, de LDAP) nฺi (for 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 processes require human interactions with the process. For i l K Many end-to-end business AR humans may be needed for approvals, exception management, or performing example, N KOactivities that are required to advance the business process. The human task service 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 activity) • Presentation of tasks to end users through a variety of mechanisms, including a Worklist application (Oracle BPM Worklist) • 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 9 - 6

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

Human Tasks in a Composite Application

Human tasks can be created in a composite application as stand-alone components exposed as a service.

le

b a r e f

s

an r t n

no a s ฺ a h They can also be added to ) ide m u a BPEL process as part of o ฺc nt G an orchestrated interaction. 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 cein a composite application is associated with a BPEL process and is i l K Typically, a human task AR as part of the business process flow. However, a human task can also be added as integrated N KOa stand-alone component. A stand-alone human task component is useful when there is no need for automated activity in the application. In this case, the client application creates the task itself by interacting with the operations that are exposed from the human task component. At run time, the business logic and processing rules of the human task service component are executed by the human workflow service engine. All human task service components, regardless of the SOA composite application of which they are a part, are executed in a single human task service engine on their deployed platform.

Oracle SOA Suite 12c: Build Composite Applications 9 - 7

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

Adding a Human Task to a Composite Application

Double-click the component to display the task editor. Select Expose as a SOAP Service to expose the task to clients of the composite application.

le

The configuration is stored in a .task file.

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 cecreate a human task component in the composite. During creation, if i l K In the Composite Editor, R A you select “Create Composite Service with SOAP Bindings,” the human task is exposed to the N KOclients of the composite application. These clients interact with the human task service by Tabs on the left side of the editor provide access to categories of configuration parameters.

using its operations and associated message structures. Whether the component is exposed or not, it can be associated with a BPEL process component. Configure the task details (such as outcomes) and data for the parameters. These task detail settings are saved to an XML file in the project with a .task extension that maintains the task metadata. The human task metadata (.task) file stores workflow pattern configuration data, including: • Task details, such as title, payload, and other properties • Routing slip configuration to specify: - The task flow: Simple, sequential, parallel flow, ad hoc workflow, and For Your Information (FYI) tasks. An FYI task is a notification scenario that does not require the task assignee to perform any action on the task information. - The assignment and routing policy (assignment of a task to a user, group, or role; static or dynamic assignment; rules based on task outcome or payload content and title) - The escalation, renewal, and expiration criteria Oracle SOA Suite 12c: Build Composite Applications 9 - 8

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

Configuring the Human Task The human task configuration is stored in a .task metadata file that is deployed with the project.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o The configuration options ฺc nt G m are organized into b i de categories. inฺ u 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 cetask component in the SOA composite application or a BPEL process, i l K After creating a human AR file is opened in the Human Task Editor, where you can configure task parameters the .task N KOand properties. The editor enables you to configure settings that are organized into sections, including: • General: To specify the task title, description, task outcomes, task category, task priority, and task owner. Many of these can be literal values or dynamically determined. • Data: To define the task parameter structures (types) that are included with the task payload that is sent to the task management service. Task parameters can be displayed and modified in the Worklist application. • Assignment: To assign participants to the task and create task routing policies for the workflow definition • Deadlines: To specify the expiration duration of a task • Notification: To create and send notifications when a user is assigned a task or informed that the status of the task has changed

Oracle SOA Suite 12c: Build Composite Applications 9 - 9

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

Configuring the Task Outcomes Configure possible outcomes from a list, or define your own. Specify a default outcome.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G m Set a priority for the task. 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 the title for the task, a priority, a task owner, and a commai l K General task details include AR list of outcome strings. The default outcomes are APPROVE and REJECT, but separated N KOthese can be modified. 1. Click the magnifying glass icon next to the Outcomes field. 2. In the Outcomes dialog box, select options from the list of seeded values. To create additional outcomes, click the Create (green plus symbol) icon. 3. In the Add Custom window, enter a string for the custom outcome and click OK. The new outcome is added to the list. 4. Select the desired values and click OK.

Oracle SOA Suite 12c: Build Composite Applications 9 - 10

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

Adding Human Task Parameters Task parameters can be simple data types or XML elements described with an XSD.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o The “Editable via worklist” check box ฺc nt G enables users to modify the task m b de parameters in the Worklist application. inฺi u 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 e J cthe i l K Task parameters form structure of information passed to the Task Service. If you generate R A aN Task Form with the information included, task parameters can be displayed in the Worklist KOapplication so that a task assignee can view and optionally modify the data. To add a task parameter, perform the following steps: 1. Click the Add Task Parameter icon (the plus symbol) in the Parameters section. 2. In the Add Task Parameter dialog box, perform either of the following: - Select the Type option to browse for a desired type, and then enter the parameter name. - Select the Element option to browse for an XSD element. In this case, the Parameter Name field is set based on the chosen element name. 3. Click OK. To allow the assignee to modify task parameter values in the Worklist application, select “Editable via Worklist.” Changes made to the task parameter data are returned to the BPEL process in the task payload along with the task outcome. Multiple task parameters can be added to a task definition. Each parameter must be supplied with values. The preceding two steps define the task parameter data structure that is passed as the payload to the Task Service. Oracle SOA Suite 12c: Build Composite Applications 9 - 11

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

Assigning Task Participants On the Assignment tab, you configure the route that the task will follow. You also assign assignthe those participants participants whowho will will review review and and those those who who willwill receive receive errors. errors.

le

b a r e f

s

an r t n

no a s ฺ a h ) idaesingle participant m u o Add ฺc nt Gor multiple participants in m b serial or parallel. 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 you configure the route that the task will follow. You also assign the K On theR Assignment tab, NA who will review and those who will receive errors. The icons on the Component Oparticipants

K Palette allow you to add a single participant or multiple participants in serial or parallel.

The choices are: • Single: Specifies that any single person from a list can action the task. The task completes when any of the assignees actions the task. • Parallel: Specifies when multiple users, who are working in parallel, must act simultaneously on the task. Completion depends on a voting percentage specified, or setting a majority or unanimous vote. • Chain: Specifies a list of participants for a workflow to act on the task in sequence • FYI: Specifies that a task is sent to a user for notification purpose. The business process does not wait for a user action. An FYI task does affect the task outcome. To add the desired participant type, drag the appropriate icon onto the stage in the central canvas. The Add Participant Type window is displayed.

Oracle SOA Suite 12c: Build Composite Applications 9 - 12

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

Configuring Task Participants Build a list of participants based on different criteria.

le

b a r e f

s

an r t n

no a s An LDAP application a ฺ h typically serves as the e ) d i m source of participant u ฺco nt G information. m b e 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 Click the Add icon inl the Participant list section. Select to add a user, a group, or an R application NA role. The Identity Lookup window opens. This window enables you to look up the O K user, group, and application role names that are configured in an identity server, such as an LDAP server. In addition, you can select to build a list of participants by using different strategies, such as: • A static list of names, or a list that is dynamically populated by using an expression • A management chain that enables definition of the starting assignee and the number of levels to process up the management chain to a specified top assignee • Rule-based, in which business rules determine the list of assignees based on conditions

Oracle SOA Suite 12c: Build Composite Applications 9 - 13

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

In the example, the LDAP server connection is associated with the Oracle SOA Suite Manager Server instance in WebLogic, which provides an embedded LDAP server. The steps to select a single user include: 1. Selecting (or creating) an application server connection. On successful connection, the realm is populated. By default, there is only one realm. 2. To add a user, you can select the username (or other LDAP field entries, such as first name) to which the Search pattern is applied, and click the Lookup icon to populate the Search User list. 3. From the Search User list, select one or more entries and click Select to move them to the Selected User list. 4. Click OK to add the selection to the participant row in the Add Participant Type window. Note: After selecting a user in the Search User list, you can click Hierarchy to display that user’s manager hierarchy. Click Reportees to list those users who report to that user. Doubleclick an entry to view additional details about each user.

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 9 - 14

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

Configuring the Stages of a Task

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 you configure the assignees to whom the task is routed and i l K In the Assignment section, ARhow the task is routed to those assignees. When you first display the Assignments specify N KOsection, you are provided with a single stage and no participants. In simple terms, assignment and routing comprise: • Stages, which organize the approval process for a block of participant types • Participants, who are created by using an editor (a participant list builder). The sequence in which the assignees are added indicates the execution sequence. Assignments and routing can be structured in complex ways with multiple stages, with each stage having its own collection of participants (assignees) to whom the task can be assigned depending on routing policy settings. As shown in the slide, you can add additional stages that are processed in serial, in parallel, and by using a combination of both.

Oracle SOA Suite 12c: Build Composite Applications 9 - 15

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

Configuring Expiration and Escalation Settings Options provide a fixed duration in days, hours, and minutes, or a period calculated by using an expression. “Renew after” sets the number of renewals.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G “Escalate after” sets the number of m b levels and the highest approver title. 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 the Deadlines section of the Human Task Editor include: i l K The options that are available R A N KO• Never Expire: The task remains in the system until acted on by a participant. • • •

Expire after: A period can be determined as a fixed number of days, hours, and minutes, or as a dynamically calculated period based on an expression. Renew after: The expiration period is extended when a participant does not respond within the specified time period. You limit the number of renewals before final expiration. Escalate after: A task is escalated up a management chain by a specified number of levels if a user does not respond within the time period specified.

Note: An expiration duration set in the “Limit allocated duration to” field, for a participant type level, takes precedence over the settings specified in the Deadlines section (routing slip level).

Oracle SOA Suite 12c: Build Composite Applications 9 - 16

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

Configuring Notification Settings

Notifications are sent through channels such as email, voice message, instant message, and SMS.

Notifications are sent to different types of participants for different actions.

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 Notification settings determine when a user is assigned a task or informed that a task status R A has Nchanged. Notifications are sent through channels such as email, voice message, instant KOmessage, and SMS. Notifications are sent to different types of participants for different actions based on the settings selected in the Notification Settings section. Three notification settings are configured, each with a default message: • Assign: When the task has been assigned • Complete: When the task has been completed • Error: When there is a task error To configure or change notification settings, perform the following steps: 1. Click the Add icon to create additional notification row entries. 2. Select the task status for the notification. 3. Select the recipient for the notification. 4. Configure the notification message based on an expression. 5. Configure the reminder options. Note: The “Make notification actionable” check box enables actions to be performed through email notifications.

Oracle SOA Suite 12c: Build Composite Applications 9 - 17

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

Adding a Human Task to a BPEL Process Use the configuration dialog box to relate BPEL variables to the task input and output values.

le

Double-click the human task activity to open the configuration dialog box.

b a r e f

s

an r t n

no a s ฺ a When the configuration dialog box h ) is closed, an activity is ide m u o created to process each of the ฺc nt G m possible outcomes of the task. 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 cein a BPEL process, add a human task activity to the process flow. i l K To create a human task R Athe When Create Human Task window opens, select an existing task definition or create a N O

K new human task. After you click OK, a .task file is created and opened.

Configure the human task properties by selecting an XML element from a BPEL variable whose type is compatible with the task parameter definition. The source of data can be an XML fragment, an expression, or a partner link. The following components are created in the BPEL process: • A partner link for the human task service • A Scope containing the activities that assign task parameters to the variable, invoke the task service, and wait for the task outcome in the response • An If activity containing an branch for each outcome specified in the .task file. You can add additional activities to these branches to implement the process activities that are needed to manage the returned outcome.

Oracle SOA Suite 12c: Build Composite Applications 9 - 18

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

Expand the “taskIf” activity and configure the task outcome branches. The number of branches that exist depends on the number of initial outcome values specified in the Create Human Task window. For example, the REJECT case, APPROVE case, and ELSE branches are created by default. For each outcome branch, you can modify or remove the existing CopyPayloadFromTask Assign activities, and add any additional activities that are required to perform the processing that is needed for each outcome. Note: If the task definition specifies task parameters that can be modified by the task service, the CopyPayloadFromTask Assign activities are generated with a single copy operation to copy the modified task payload data to the BPEL variable that is defined as a task parameter in the task definition. Otherwise, the CopyPayloadFromTask Assign activities are generated without a copy operation, and can be deleted unless you want to reuse them for your own purposes.

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 9 - 19

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

Quiz A human task can be used only by a BPEL process component. 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 KOA human task can be used as a stand-alone component within a composite application, and

any of its operations can be invoked as a service if its WSDL interface is exposed as a service. Mediator components can be wired to a human task for sending messages in a For Your Information (FYI) task scenario. For more complex human workflow patterns, it is more common to use a human task from the context of a BPEL process. Note: The FYI task is a form or notification that does not require the task assignee to perform an action when receiving the task information.

Oracle SOA Suite 12c: Build Composite Applications 9 - 20

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

Agenda • • •

Human Tasks The Worklist Application Notifications

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 9 - 21

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

Task Display Forms Task display forms are: • Designed to display and optionally modify task information supplied as parameters to a human task in a composite application • Generated as JavaServer Page XML (.jspx) files by using:

– The human task activity in a BPEL process component ble a r fe – The “ADF Task Flow Based on Human Task” item in the JSF s n a category of the New Gallery window n-tr

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 Worklist application users with a way to view and optionally modify i l K Task display forms provide R Adata. task The Oracle BPM Worklist application displays all tasks assigned to a user logged in N KOas the task assignee. When a task assignee clicks an assigned task, a task display form appears to show the task information. However, if the composite application that contains a human task component is not deployed with a task display form, the task information details are not displayed. Oracle Application Development Framework (Oracle ADF), which is integrated with Oracle JDeveloper, enables you to design task display forms that display task information and the parameters received from a human task in a SOA composite application. ADF-based task display forms can be generated from the human task activity in a BPEL process or created by using the ADF task flow based on a human task item in the JSF category in the New Gallery window. Advanced users can design their own task display forms by using ADF data controls to lay out the content on the page and connect to the workflow service engine at execution time to retrieve the task content and act on tasks. Note: Before creating task flow forms, change the encoding preference to UTF-8 in the JDeveloper Tools > Preferences > Environment settings.

Oracle SOA Suite 12c: Build Composite Applications 9 - 22

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

Generating a Task Display Form

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G Task parameters obtained m b from a task payload definition 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 cincludes i l K If the SOA composite a human task, you need a way for users to interact with the R A task. N The integrated development environment of Oracle SOA Suite includes Oracle ADF, KOwhich enables you to design a task display form that depicts the human task in the SOA composite. A task form is a Java Server Page XML (.jspx) file that defines how a task payload (from task parameters) is displayed in the Worklist application. When you create an ADF task flow based on a human task, you must select a task metadata file to generate the data control. This data control is used to lay out the content on the page and connect to the workflow service engine at execution time to retrieve the task content and act on tasks. A task form can be auto-generated for a simple interface that contains task parameters, or you can generate a custom task form. The example shows the steps to auto-generate a simple task form: 1. Right-click the human task activity and select Auto Generate Task Form. 2. In the Create Project window, enter a new project name, such as ApprovalTaskForm, for the ADF task form application files, and click OK. Note: The Directory field is automatically populated and can be changed by entering or browsing for a directory name. 3. (Optional) Modify the task form, save any changes, and close the JSP tabbed page.

Oracle SOA Suite 12c: Build Composite Applications 9 - 23

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

Deploying Task Display Forms

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o Task flows can be deployed ฺc nt G with their related composite m b applications. 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 lictask K deploy BeforeR you the display form files, the composite application that utilizes them A should N already be deployed. KO

After deploying the composite application, you can deploy the task display forms by rightclicking the Application menu and selecting the Deploy option. When you create a generic project and add the ADF task form based on human task files, a deployment profile is created for the project and for the application workspace in which the project resides. Using the Application Menu Deploy option deploys the EAR file that is identified by the project’s deployment profile in the Application Properties, instead of the Project Properties. Note: The Oracle SOA Suite 12c server automatically associates the task display form URI with the human task for which it was generated.

Oracle SOA Suite 12c: Build Composite Applications 9 - 24

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

Accessing the Worklist Application

Access the Worklist application at http://host:port/integration/worklistapp.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o LDAP ฺ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 application is a web application that is installed with Oracle SOA i l K The Oracle BPM Worklist R A12c Suite components. To access the Worklist application, use the following URL: N KOhttp://host:port/integration/worklistapp. By default, the Oracle WebLogic Managed server instances have an embedded LDAP server, which can be used for authentication and authorization.

The Worklist application login page is displayed. Log in to the application with a username that is authorized to use the Worklist application.

Oracle SOA Suite 12c: Build Composite Applications 9 - 25

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

Viewing and Acting on Task Information

Task information is visible if task display forms are deployed with the composite application.

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 ceWorklist application, they can view the task assignments, work i l K After users log in to the ARand task parameter information by selecting the specific task. queues, N KO

The Worklist application provides a default webpage with task information, excluding task details. By using Oracle JDeveloper to generate task display forms, you can view task details, which are rendered in the browser. The task display form can also render an Action menu and buttons. The action for an assigned task can be completed on either of the following: • The Worklist application page that contains the task information • The task form that displays the task parameter details. If the task parameter data is configured to be modifiable at design time, users can view and save modified values before they perform a selected action on the page. Note: If task data is modified, changes must be saved before applying a selected action. In the pane that contains the list of assigned tasks, you can select a task and perform an action that is available in the Action menu, such as APPROVE or REJECT. The action items correspond to the task outcomes configured in the human task component metadata. Note: If you have not generated task forms, the Worklist application does not display any information in the bottom-right pane. However, you can still apply an action to the tasks that appear in the Inbox.

Oracle SOA Suite 12c: Build Composite Applications 9 - 26

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

Quiz Task display forms provide Worklist application users with a way to view and (optionally) modify task data. 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 J ce i l Answer: a K AR True N KO

Oracle SOA Suite 12c: Build Composite Applications 9 - 27

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

Agenda • • •

Human Tasks The Worklist Application Notifications

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 9 - 28

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

Working with Notification Services Web Services interface

Java interface

WebLogic Domain User Messaging Server JMS

XMPP

EMAIL

SMPP

Extension

le

s

an r t n drivers

b a r e f

no a s ฺ a h ) ideservers 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 tasks, notifications are often part of applications that include i l K Although not part of human ARtasks. The notification service enables an asynchronous message to be sent to a user human N KOby a specific channel. The message can be sent as an email message, a voice message, a text message, or an instant message. Actionable notifications enable users to respond. Oracle SOA Suite 12c is configured with the Oracle User Messaging Service (UMS) application that enables composite application components (such as a BPEL process and human task, Web Service clients, and Java applications) to send notifications through email, voice, IM, or SMS messaging channels. Message channels are configured with drivers that handle the sending of messages to and receiving of messages from devices that are associated with that type of channel through an appropriate server or channel service provider.

Oracle SOA Suite 12c: Build Composite Applications 9 - 29

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

Oracle User Messaging Service (UMS) • • • •

Enables sending notification through email, voice, IM, or SMS channels Supports two-way messaging (sending and receiving messages) Provides user messaging preferences, enabling users to configure how and when to receive notifications Integrates with Fusion Middleware components through:

le

b a r e f

s – BPEL notification activities, such as email, IM, and voice n a r -t – Human workflow notifications that also provide o actionable n an messages s – Oracle BAM alerts for monitored events ) ha ideฺ

om 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 enablesl two-way communication between users and composite applications. It OracleR UMS exposes NA operations that can be invoked from the BPEL business process or human task to O K send notifications through the email, voice, IM, or SMS channels. Oracle UMS is integrated with a human workflow, enabling notification messages to be delivered for different events and enabling actionable email messages to be implemented. Oracle UMS supports: • Sending and receiving messages and statuses • Sending notifications to a specific address on a particular channel • Sending notifications to a set of failover addresses The email channel is configurable out of the box. To configure additional UMS driver channels, you need to deploy the driver JEE application EAR file and ensure that you have access to a service provider for the type of channel driver deployed. Oracle UMS tracks the delivery status information that is provided by messaging gateways, so that applications can respond to a failed delivery. Applications can specify one or more failover addresses for a message in case of delivery failure to an initial address. This capability frees application developers from having to implement complicated retry logic.

Oracle SOA Suite 12c: Build Composite Applications 9 - 30

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

Configuring UMS Notification Properties Changes require a server restart.

1

3

le

b a r e f

s

an r t n

no a s ฺ a h Set)notification demode and email i m u o 2 G as appropriate. ฺc nproperties 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 services are communicated through Oracle UMS components. i l K The workflow notification AR the workflow notification properties, use Enterprise Manager Fusion Middleware ToNconfigure KOControl and access the SOA Infrastructure page menu by performing the following steps: 1. In the Target Navigation Pane, expand the SOA folder and right-click soa-infra. 2. In the context menu, select SOA Administration > Workflow Properties. 3. On the Workflow Notification Properties page, set the notification mode to All (or Email). Set other email properties as appropriate to your email server configuration. Click Apply. Note: After making changes to the workflow notification properties, you must restart the SOA server.

Oracle SOA Suite 12c: Build Composite Applications 9 - 31

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

Configuring the User Messaging Email Driver 1 2

le

b a r e f

s

3

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 the Workflow notification properties, configure the user messaging i l K In addition to configuring R Adriver email settings to ensure that the email server and protocol settings are correctly N O

K specified. To access and configure the user messaging email driver settings, perform the

following steps: 1. On the Workflow Notification Properties page, click the “Go to the Messaging Driver page” link. Alternatively, on the Enterprise Manager Control page, in the Target Navigation pane, expand the User Messaging Service folder and click usermessagingserver (soa_server1). 2. On the User Messaging Service page, click the Configure Driver icon in the User Messaging Email Driver row entry. 3. On the User Messaging Email Driver page, enter the email driver properties and other driver-specific configuration settings. These include mail protocols, such as Post Office Protocol (POP3), the outgoing Simple Mail Transport Protocol (SMTP) server name, and the incoming server name, among other settings. Click Apply. 4. After confirming the changes to be made, restart the WebLogic Managed server (SOA server) instance.

Oracle SOA Suite 12c: Build Composite Applications 9 - 32

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

Viewing and Testing Email Notifications

1

2

le

b a r e f

s

an r t n

no a s ฺ a h ) 3 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 cview i l K You can monitor and the notification activity performed by the human workflow service R A engine. N To view and test the human workflow notification activity, perform the following steps: KO

1. In Enterprise Manager, in the Target Navigation pane, expand the SOA folder and rightclick soa-infra. 2. In the context menu, select Service Engines > Human Workflow. 3. On the Human Workflow Engine page, click the Notification tab. You can examine any notification messages in the Outgoing Notifications and Incoming Notifications sections. If you click Send Test Notification, the Send Test Notification window is displayed. 4. In the Send Test Notification window, you can select the notification channel type to test (provided that it has been configured) and send a message. In the example, the Email channel is selected for the test.

Note: The test message mechanism uses BPEL notification activities to send test messages. The messages that are sent appear in the list in the Outgoing Notifications section. The example message in the Outgoing Notifications section is actually from the human task of a composite application that is identified by the WORKFLOW value in the Source column.

Oracle SOA Suite 12c: Build Composite Applications 9 - 33

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

Sending Email Notification from BPEL BPEL Process

Email notification User Messaging Email Driver SMTP IMAP/POP

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o Email G Email activity is ฺc ntimplemented m as a scope. b server 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 process component provides different ways to notify users through email, IM, SMS, R A and NTwitter activities. The example in the slide implements email notification by: KO •



Dragging an Email service icon into the BPEL process and configuring the details for sending the email Configuring the email settings provided by the email activity

The email activity parameters can be static strings or can be dynamically derived from the data held in the BPEL process variables. Each field (except From Account) enables you to build an XPath expression to construct its value by clicking the XPath Expression Builder icon on its right. Configuring the incoming and outgoing mail server information is performed on the User Messaging Service Email Driver page in Enterprise Manager Fusion Middleware Control. Note: An email notification may contain multipart attachments along with the message.

Oracle SOA Suite 12c: Build Composite Applications 9 - 34

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

Sending a Notification to a User’s Preferred Channel

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 a BPEL process design in which a notification channel is i l K The user notification activity AR specified during design time, and simply indicates that a notification must be not explicitly N KOsent. The notification channel used is resolved at run time based on the user preferences The user notification activity: • Sends a message to a user’s preferred channel • Enables additional properties to be sent with the message

defined on the Notifications tab of the Worklist application, or in the User Messaging Preferences user interface of Oracle UMS. Therefore, the responsibility of notification channel selection is moved from Oracle BPEL Designer to the end user. If the end user has not selected a preferred channel or rule, email is used by default. Note: To access the User Messaging Preference user interface as a stand-alone application, enter the following URL: http://localhost:8001/sdpmessaging/userprefs-ui. Remember to replace “localhost” and the port with values that are suitable for Oracle SOA Suite installation.

Oracle SOA Suite 12c: Build Composite Applications 9 - 35

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

Quiz Which of the following provide support for notification? (Select all that apply.) a. User notification activity b. An OnMessage branch in a Scope or Pick activity c. Mediator routing rules d. Human task component e. Email 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 c i l K Answer: ARa, d, e N KOBy using the notification activity in a BPEL process, a user’s preferred form of notification is

used. The preferred notification channel is configured by the user on the Worklist application Preferences Notification tabbed page. The email activity specifically uses email to notify someone. The human task, as configured in the .task file, provides notification through the Worklist application user’s preferred notification channel or email by default.

Oracle SOA Suite 12c: Build Composite Applications 9 - 36

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

Summary In this lesson, you should have learned how to: • Describe human task concepts • Explain the human task component • Design a human task • Invoke a human task from a BPEL process • Interact with the Worklist application to act on tasks • Add email notification to a BPEL process

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 9 - 37

b a r e f

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

Practice 9 Overview A composite application is built that includes a BPEL process component and a human task component.

le

s

b a r e f

an r t n

no a s ฺ a h Database eand notification ) d i m u external references o tG c ฺ provide customer lookup m en and email capabilities. 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 9 - 38

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

Practice 9 Overview A sales order file is received by the process and passed to the human task activity.

An If activity routes the various outcomes of the Manual Approval process.

le

s

an r t n

no a s Worklist The application a ฺ h provides a chance to e ) review d i m and edit the details u ฺco nt G before approving or m rejecting the order. 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 J ce i l K R

A

N KO

b a r e f

Oracle SOA Suite 12c: Build Composite Applications 9 - 39

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

Practice 9 Overview A Database adapter is invoked to query the customer database for email information.

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 An email task advises customers of the status of their order.

A

N KO

Oracle SOA Suite 12c: Build Composite Applications 9 - 40

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

Sharing Functionality in Oracle SOA Suite

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: • Use the design-time Metadata Services (MDS) Repository to share files • Create and use component and project templates • Create and use inline and stand-alone BPEL subprocesses e • List the differences between templates and subprocesses rabl

e

sf n a tr

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 10 - 2

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

Agenda • • •

Design-Time Metadata Services (MDS) Repository Templates BPEL Subprocesses

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 10 - 3

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

Design-Time Metadata Services (MDS) Repository

Share WSDL, XSD, Transfer to/from other repositories.

WADL, & XQuery

Export and import to/from JAR files.

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 Metadata Services Repository, Oracle SOA Suite includes a filei l K In addition to the run-time R ASOA based design-time MDS Repository for use during design time. The repository is N O

K automatically created when you create a SOA composite application. The default directory

location is $JDEV_USER_DIR/soamds, but the repository location can be modified to point to another folder or version control location. The SOA-MDS Transfer wizard enables you to share WSDL, XSD, WADL, and XQuery files with the SOA design-time MDS Repository. This eliminates the need to duplicate these resources across projects and applications. When artifacts are moved into the repository, all dependencies are included and references to the transferred artifacts are updated with the correct MDS URLs on transfer. WADL refers to Web Application Description Language.

Oracle SOA Suite 12c: Build Composite Applications 10 - 4

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

These files can then be shared with other SOA composite applications. You can: • Export selected contents of the SOA design-time MDS Repository to a JAR file • Import the contents of a JAR file to a SOA design-time (or a database-based) MDS Repository • Transfer selected contents of one MDS Repository to another MDS Repository. There are no limitations on the type of MDS Repository to which to transfer. For example, you can transfer the selected contents of a file-based repository to a database-based MDS Repository, and vice versa. • Browse for and select files in the SOA design-time MDS Repository. For example, the WSDL Chooser dialog box that you access from the Create Web Service dialog box includes a selection for the SOA design-time MDS Repository.

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 10 - 5

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

Quiz When artifacts are moved into the repository, it is important to manually include all dependencies and references. 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 NAWhen artifacts are moved into the repository, all dependencies are included and False. O K

references to the transferred artifacts are updated with the correct MDS URLs on transfer.

Oracle SOA Suite 12c: Build Composite Applications 10 - 6

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

Agenda • • •

Design-Time Metadata Services (MDS) Repository Templates BPEL Subprocesses

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 10 - 7

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

Templates: Overview

A complete SOA project packaged and used to start new projects

A Service component, such as a BPEL process, packaged for import into other projects. All dependent components and wires are also packaged.

le

b a r e f

s

an r t n

no a A Scope activity of a BPEL that s process a ฺ h is packaged as a custom activity in the ) idiseready for m u o Components window and that ฺc nt G m import into other b e projects nฺi StudBPEL 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 cepart of an Oracle SOA Suite project that you can use to create new i l K A template is a reusable ARThere are three types of templates, as described in the slide. Use templates to share projects. N O

K common code (subpart of a process or a scope) between applications, composites, and

processes. You create the template once, and then share it with others. The template can be reused multiple times. Project templates are a way of creating a SOA project instead of starting with an empty composite. The template can include predefined components, as well as services and references. For example, frequently used adapters and transformations can be pre-configured in a template to eliminate the need to re-create the same components every time a new project is created.

Component templates package one main component, for example a BPEL process, including all references (adapters and bindings) invoked by the process. You can enforce best practices by packaging a BPEL process with a predefined fault handler and a number of mandatory variables as a component template and sharing it across departments. By providing this template to all developers, you ensure a consistent way of handling faults and naming variables.

Oracle SOA Suite 12c: Build Composite Applications 10 - 8

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

Custom activity templates consist of a group of activities in a BPEL process, which can include partner links and external services. The templates are available within the BPEL palette and can be dragged and dropped into any BPEL process. You can, for example, package a BPEL scope, which consists of a complex assign or transformation and the invocation of an external web service. By sharing this scope, you eliminate the chances of introducing errors and of course save development time through re-use. SOA templates work in a “drag-and-drop” way. After they have been used, they become an integral part of the application and can be customized going forward. When changes are made to the original template, they are not reflected in the composites and components that are created through templates.

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 10 - 9

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

Creating and Using Templates

Default Location

Create Template Wizard

le

b a r e f

Custom Location

s

an r t n

no a s ฺ a h e MDS Repository ) d i m u ฺco nt G m 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 J cright-click i l K To create a template, the appropriate object and select Create Template to invoke R A the NCreate Template wizard. You specify a name and location for the template. The location O

K can be the design-time MDS Repository, the default location in the file system, or a custom

location that you specify. After completing any additional prompts specific to the template type selected, the template (with any dependencies) is saved to the specified location.

Oracle SOA Suite 12c: Build Composite Applications 10 - 10

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

Using Project Templates

Select Start from: SOA Template Specify the desired template.

le

b a r e f

s

an r t n

no a The project is s ฺ a h created from ) ide m the template. 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 in the Create SOA Application wizard, select the start type: SOA To useR aK project template, Template. NA Then, specify the desired template. O

K

Oracle SOA Suite 12c: Build Composite Applications 10 - 11

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

Using Service Component Templates 1 Insert a Component Template.

2 Select the specific template.

le

3

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 template, right-click in the Components swimlane of the composite i l K 1. To use a component R Aoverview window. Select Insert > Component Template. N KO2. Select the specific template. Review the template information and click Finish.

3. Click Finish.

Oracle SOA Suite 12c: Build Composite Applications 10 - 12

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

Using Service Component Templates

le

b a r e f

s

an r t n

no a s ฺ The component and any a h dependencies are added 4 ) ide m to the project. 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 ctemplate i l K 4. When a component is used, the service component and its dependencies are R A added N to the project. O

K

Oracle SOA Suite 12c: Build Composite Applications 10 - 13

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

Using BPEL Scope Activity Templates Add the activity from the Component Palette.

1

Resolve any conflicts (if the project references any files that are also named in the template).

le

2

b a r e f

s

an r t n

K

no a s ฺ that are a Bind any variables h )referenced dinethe template ifound m u o to those G project. in the ฺc nBPEL t m 3 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 Kactivity templates 1. Scope can be added to a BPEL process from the Component Palette. R A 2. NWhen the scope is added, you are prompted to resolve any naming conflicts (if the project O references files that are also named in the process).

3. You then bind any variables that are referenced in the template to those found in the BPEL project.

Oracle SOA Suite 12c: Build Composite Applications 10 - 14

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

Quiz Which of the following are types of templates? a. SOA Project b. Partner Link c. Component d. External Reference e. Scope 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 Kc,Jand elice Answer:Ra, NA components (such as BPEL processes), and scope activities can be packaged as Projects, O K templates.

Oracle SOA Suite 12c: Build Composite Applications 10 - 15

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

Agenda • • •

Design-Time Metadata Services (MDS) Repository Templates BPEL Subprocesses

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 10 - 16

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

BPEL Subprocesses: Introduction • • • • •

Are process fragments that modularize a reusable piece of business logic Can include partner links and references Can be invoked from other “parent” BPEL processes through a call activity Do not have an interface (compares to a subroutine in an object-oriented programming language) ble a r fe s Execute completely in the context of the parent process, n trafault permitting access to process variables and inheriting n no a handling and compensation logic 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 limitedl support for modularizing business process logic for reusability. The only BPEL provides R method NA is to package reusable process logic as completely separate processes, which are O K utilized by the parent process (the process utilizing the reusable process logic), in a method that is identical to using a web service (through the Invoke activity).

To address this challenge, Oracle SOA Suite provides a subprocess extension to BPEL. A BPEL subprocess is actually not a complete process, but a fragment that modularizes a reusable piece of business logic. This fragment can include partner links and references, and can be invoked from other “parent” BPEL processes through a new “call” activity. A subprocess does not have an interface like a standard BPEL process does. You can at best compare it to a subroutine in an object-oriented programming language. At run time, it executes completely in the context of the parent process, permitting access to process variables and inheriting fault handling and compensation logic.

Oracle SOA Suite 12c: Build Composite Applications 10 - 17

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

The subprocess extension provides the following benefits: • BPEL process code reusability, which reduces the need to create the same activities multiple times to perform the same tasks • Code modularity • Code maintenance (changes are propagated, which eliminates the need to implement updates in multiple places every time a change is necessary) • Less overhead than Invoke activities • Memory footprint reduction, which can be considerable in a complex process Notes • Subprocesses are supported only with BPEL version 2.0. There is no support with BPEL version 1.1. • Correlation sets are not supported in subprocesses. If you create a correlation set in an inline or stand-alone subprocess, it fails at run time. • Subprocesses cannot be shared between multiple composites.

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 10 - 18

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

Stand-Alone Subprocess A stand-alone subprocess is a self-contained snippet of process logic. All references resolve to local definitions or arguments that are defined in the partner links and 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 J cisenot a valid business process, but is a self-contained snippet of i l K A subprocess element ARlogic. All references in its process snippet resolve to local definitions or arguments, process N O

K which are defined in the partner links and variables sections of the subprocess.

Note: This contrasts with an inline subprocess, which allows unresolved references to variables and partner links that are in-scope at the call activity. A subprocess can converse with partners synchronously (InOut) or asynchronously (InOnly). The partner link for these interactions can be passed as an argument from a parent process or configured within the subprocess. Note: For asynchronous requests, the conversation ID for the WS-Addressing or normalized messages is set with the parent process instance ID. This enables routing of callback messages to the correct process instance.

Oracle SOA Suite 12c: Build Composite Applications 10 - 19

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

Calling a Stand-Alone Subprocess

le

b a r e f

s n a r t -subprocess. A call activity transfers control to the n o nArguments in the There is no service invocation. avariables call activity map in-scope and partner s a ฺ h links to subprocess element parameters. Each ) idbyevalue or reference. argumento ism passed either u ฺ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 K J BPELlicprocess, Within R a parent a call activity transfers control to the subprocess. There is no A service N invocation. Therefore, no inbound message activity is required to consume the KO message from the call activity, and no Reply or Invoke activity is required to return the value. This is analogous to executing a member function; control is transferred to the implicit subprocess scope on call activity activation, and back after scope activity completion.

There may be multiple inputs and outputs through arguments. Arguments in the call activity map in-scope variables and partner links to subprocess element parameters. Each argument is passed either by value or by reference, as specified in the call activity. Upon activation, the subprocess scope is initialized with the input variables, which are set with the call activity’s arguments. Outputs are pass-by-value parameters that are written to by the subprocess.

Oracle SOA Suite 12c: Build Composite Applications 10 - 20

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

Inline Subprocess

An inline subprocess is a subprocess embedded in another (“parent”) process.

le

b a r e f

s

an r t n

no a Arguments in the a map hcallsactivity variables and)partner linksetoฺ the inline id uparameters. subprocess The omelement c G ฺ t subprocess can also refer to other m in scope n at the time of the call. b e i ฺ items 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 is a subprocess that is embedded in another (“parent”) process. K An inline subprocess R A AN call activity executes the referenced subprocess code. Arguments in the call activity map inO

K scope variables and partner links to the inlineSubProcess element parameters. Arguments can be passed by reference or by value. The call activity transfers control to the subprocess, at which time the subprocess scope is initialized with the argument variables. In addition to parameter passing, other visible items (those in scope at the time of the call activity) can be referred to by the inlineSubProcess element. Execution is similar to the subprocess element execution model. On completion of the subprocess, control is returned to the parent process. In the normal case, execution continues with the next activity after the call activity. In the case of abnormal subprocess completion, the parent process resolves the process according to the standard life cycle rules of WS-BPEL.

Oracle SOA Suite 12c: Build Composite Applications 10 - 21

Comparing Stand-Alone and Inline Subprocesses

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

Stand-Alone Subprocess • • •

Inline Subprocess

They are available in BPEL 2.0 only. A BPEL call activity invokes the subprocess. They are visible in the Components window.

Is a fragment of a BPEL process that includes a number of activities that are reused across other BPEL processes

Is useful for groups of activities that are reused within one BPEL process

ble a r fe Can be called from any BPEL process in Is part of the parent BPEL process code s n the same composite and is not visible in the composite traview n ntheo parent BPEL Can be called only from Does not have an interface, and can be a sthe partner and called only from another BPEL process. It process. It can use a ฺparentlinks h e ) in-scope variables ofid the process. can include partner links. om t Gu c ฺ Defines the parameters to set Can either the parameters to set or m edefine n b i ฺ in canSuse tudparent process values @ 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 subprocesses are both available only in BPEL 2.0. Both are invoked by K and inline Stand-alone R A (extension) call activity. Both are visible in the components window in JDeveloper. the NBPEL O K Beyond these similarities, there are only differences. Stand-alone subprocesses can be called by any number of BPEL processes within the same composite application. Inline subprocesses are embedded within a single BPEL process, and are visible only from within that process. Both stand-alone and inline subprocesses can include variables and partner links. The calls to both types of subprocess can include mapping of process values to subprocess arguments. However, inline subprocesses can also make use of any partner links and/or variables that are in scope at the time of the call activity.

Oracle SOA Suite 12c: Build Composite Applications 10 - 22

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

Creating an Inline Subprocess

1

Right-click the scope activity and select Convert to a Subprocess.

le

b a r e f

s

an r t n

no a s ฺ a Assign a name, and if h ) ide m 2 desired, add a label and/or u o G ฺByc default, an image. t the scope is m n b 3 de to a call activity. nฺi Stconverted u 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 cecreated from process scope activities. To create an inline subprocess, i l K Inline subprocesses are AR and configure a scope with the activities that will define the subprocess. To convert first create N KO the scope to a subprocess, perform the following steps: 1. Right-click the scope and select Convert to a Subprocess. The Create Inline Subprocess dialog box is displayed. 2. Name the subprocess. Typically, you leave the Replace Scope with Subprocess Call check box selected. This automatically replaces the current scope with a Call activity. 3. Click OK. A call activity replaces the scope in the process. The subprocess is also displayed in the palette under Subprocesses. You can see and edit the definition of the subprocess when switching from the Main Process to the subprocess at the top of the BPEL editor. All partner links that are available in the main process are displayed, in case you want to add another Invoke. Changes to the subprocess are reflected in every call.

Oracle SOA Suite 12c: Build Composite Applications 10 - 23

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

Calling an Inline Subprocess The subprocess is available from the Component Palette.

1 Drag and drop the subprocess onto the BPEL process.

2

le

b a r e f

s

an r t n

K

no a s ฺ a h ) is ide A call activity m u o generated. c G ฺ 3 t 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 call R anK inline subprocess, perform the following steps: A O1.N Expand the Subprocesses section of the Component Palette. All available subprocesses are displayed. 2. Drag the desired subprocess from the Component Palette to the BPEL process. A new call activity is added to the process. 3. Configure the call activity to map any necessary values from the parent process to the subprocess.

Oracle SOA Suite 12c: Build Composite Applications 10 - 24

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

Creating a Stand-Alone Subprocess

1

Right-click the Components swimlane and select Insert > Subprocess.

le

b a r e f

s

an r t n

K

no a s ฺ a h ) de i m u o Name the subprocess ฺc nt G 2 and click OK. 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 ceBPEL subprocess, perform the following steps: i l K To create a stand-alone R A N O1. Create a SOA composite application that includes a BPEL 2.0 process. Right-click in the SOA Composite Editor and select Insert > Subprocess. The Create Subprocess dialog box is displayed. 2. Enter appropriate values or accept the default values, and click OK to create the standalone subprocess.

Oracle SOA Suite 12c: Build Composite Applications 10 - 25

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

Creating a Stand-Alone Subprocess

3

Right-click the subprocess and select Edit.

le

b a r e f

s

an r t n

n5o a s The a subprocess is ฺ h e ) stored in the project id as an .sbpel m u o file. ฺc nt G m 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 J ce i l K 3. Right-click the subprocess in the SOA Composite Editor and select Edit. R A N Design the desired process logic in the stand-alone subprocess. This can include 4. KO variables, activities, and partner links. 4

Configure the subprocess, adding the required logic and variables. Save your work.

5. The subprocess is stored in the composite as an .sbpel file. Notes about subprocess design: • A stand-alone subprocess can include an inline subprocess. • There is no restriction on one BPEL subprocess calling itself recursively. You must determine if you want to recursively call the same BPEL subprocess and the number of times the subprocess calls occur. • A stand-alone subprocess cannot be shared in the MDS Repository. However, a BPEL process with call activities for calling the subprocess can be shared in the MDS Repository.

Oracle SOA Suite 12c: Build Composite Applications 10 - 26

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

Calling a Stand-Alone Subprocess from BPEL

1

Add the activity from the Component Palette.

Map parent process values to subprocess arguments.

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 lisubprocess, KJ To call R a stand-alone perform the following steps: A O1.N Expand the Subprocesses section of the Component Palette. All available subprocesses 2

K

are displayed. Drag the desired subprocess from the Component Palette to the BPEL process. A new call activity is added to the process. 2. Configure the call activity to map any necessary values from the calling process to the stand-alone subprocess.

Oracle SOA Suite 12c: Build Composite Applications 10 - 27

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

Differences Between Templates and Subprocesses A template is a customizable, skeletal composite, process, or scope activity. You can drag and drop a template onto a SOA composite application or a BPEL process and make additional changes. You essentially are copying and pasting a template. For example, if there are 50 lines of code in a template and you copy it twice to use, the code increases by 100 lines.

le

b a r e f

s A subprocess is a BPEL code snippet that is intended for a specific n a r -t purpose. A subprocess can be called and used as it is. An inline n o subprocess of 50 lines can be called twice and the parent a nprocess code s a ebetter remains at 50 lines, and not 100. Subprocesses h perform ฺ and ) d i have a smaller memory footprint than templates. u om

ฺ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 10 - 28

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

Quiz Inline subprocesses can make use of any partner links and/or variables that are in scope at the time of the call activity. 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 NAAn inline subprocess can either define the parameters to set or can use parent process True. O K values. Stand-alone subprocesses require that you define the parameters to set.

Oracle SOA Suite 12c: Build Composite Applications 10 - 29

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

Summary In this lesson, you should have learned how to: • Use the design-time Metadata Services (MDS) Repository to share files • Create and use component and project templates • Create and use inline and stand-alone BPEL subprocesses e • List the differences between templates and subprocesses rabl

e

sf n a tr

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 10 - 30

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

Practice 10 Overview

2

You use a component template in the building of a project.

le

b a r e f

s

an r t n

3 o n a You create and 1 s a h deฺcall an inline You first import a ) m Gui BPEL subprocess. collection of templates o c ฺ from a JAR file. 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 practice,l you first import a collection of templates into the SOA Design Time 1. InR this NARepository. O K 2. You create a project and use a BPEL component template to accelerate the development of the project. 3. You modify the project. These modifications include the creation and calling of a BPEL inline subprocess. You test the finished project.

Oracle SOA Suite 12c: Build Composite Applications 10 - 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ฺ

Using the REST Adapter

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: • Identify the format of REST queries • List the differences between REST and SOAP • Create and test a REST binding in a composite application

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 11 - 2

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

Agenda • •

REST: Overview Using REST bindings in Oracle SOA Suite

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 11 - 3

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

REST: Overview • • •

Stands for Representational State Transfer Provides an alternative to using SOAPbased web services Incorporates the concept of resources. A resource is similar to an object instance in an object-oriented programming language. Resources have data associated with them.

le

Resources are typically described with either XML or JSON.

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 http://:/soa-infra/resources//relative/resource/path 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 cRepresentational i l K • REST stands for State Transfer. R A •N REST provides an alternative to using SOAP-based web services. KO XML





• •

JSON

resource

Each resource has its own address or Uniform Resource Identifier (URI).

It incorporates the concept of resources. A resource is similar to an object instance in an object-oriented programming language. Resources have data associated with them. The underlying concept is that when you send a request for a resource, the resource that is returned shows you the options for the next step. This model is very flexible, and does not require that the client know in advance what services and service calls are available. REST services rely on a stateless, client-server, cacheable communications protocol— and in virtually all cases, the HTTP protocol. RESTful applications use the HTTP verbs GET, PUT, POST, and DELETE to create, update, read, and delete data. RESTful services do not impose constraints on the data format that is exchanged. Data can be formatted as XML, HTML, JavaScript Object Notation (JSON), and so on. REST services themselves are often described with a Web Application Description Language (WADL) document.

Oracle SOA Suite 12c: Build Composite Applications 11 - 4

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

REST Queries Example REST query: http://soa12c.example.com/items/123

Action

Method

URI

Get all the items.

GET

/items

Get a single item.

GET

/items/id

Create a new item. POST

/items

Edit an item.

/items/id

PUT

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 resources (reference to data) in terms of URIs and that REST KREST Recall R that describes services NA nearly always use the HTTP protocol. HTTP messages include a header and a body O K (although the body can be empty). HTTP request messages include methods in the header to Delete an item.

DELETE

/items/id

specify an action. With this combination, REST queries use HTTP verbs and URIs to specify actions on resources (or data).

The table in the slide lists some typical actions, and the HTTP methods and URIs that might be used to accomplish them.

Oracle SOA Suite 12c: Build Composite Applications 11 - 5

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

Comparing REST and SOAP: Two Ways to Access Web Services

REST

SOAP

Is an architectural style that leverages Is a formal standard for message web standards exchange Uses HTTP

Is protocol independent

Permits many data formats

Uses XML

Uses URI and HTTP verbs to access resources (data)

Uses a WSDL document to access operations (business logic)

le

b a r e f

s

an r t n

no a s support Is stateless WS* standards provide for a ฺ h e ) stateful transactions. 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 style, whereas SOAP is a message exchange standard. Comparing K architectural REST is an R them NAis much like comparing apples and oranges, but in practical terms, they describe ways to O K access web services. As such, the table in the slide lists some features of each. These differences in features mean that in some situations, REST offers advantages, and in others, SOAP is the better choice.

Oracle SOA Suite 12c: Build Composite Applications 11 - 6

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

Example Use Cases for REST and SOAP

REST •



Operations with limited bandwidth and resources - Mobile - Series of short, chatty conversations Stateless operations

SOAP •

• •

Operations that require contextual information and conversational state management Asynchronous operations Operations that require high levels of security and reliability

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 crequire i l K For web services that robust security, transactions, and reliability, SOAP can leverage R A the NWS* standards, and would typically be a better choice. However, because of its use of URIs O

K and lighter-weight message formats such as JSON, REST can offer better performance and

scalability. REST is well-suited for situations such as mobile computing, which are constrained by limited bandwidth and resources.

Oracle SOA Suite 12c: Build Composite Applications 11 - 7

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

Agenda • •

REST: Overview Using REST bindings in Oracle SOA Suite

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 11 - 8

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

Supported Features in Oracle SOA Suite Oracle SOA Suite provides the following REST support: • Enabling REST support in new or existing services • Integration with external REST APIs • Orchestration of a set of RESTful state transitions • Support for XML and JSON • Generation of sample URI for REST service operations ble a r • Support for WADL services fe s n • Support for REST security with the Oracle Web Service tra n o Manager (OWSM) policy an

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 K JSuite 12clicprovides Oracle R SOA the following REST support: A •N It supports exposing an existing SOA SOAP service as a REST service. KO •



• • •

REST APIs are web APIs that conform to the REST architectural style. REST APIs are basically defined by some web requests (the “methods”) and the data that they return or need, which is usually JSON or XML. REST state transitions occur by following hypermedia (hidden fields, headers, and so on) to reach the next step at which the client is. SOA Suite 12c allows you to model a series of REST state transitions as a business process with a sequence of RESTful invocations. For JSON, SOA Suite 12c supports automatic translation to and from XML. It supports publishing a REST interface either through WADL or WSDL 2.0. WADL files provide an XML description of HTTP-based web applications. It supports attaching OWSM policies to REST binding components, both Service and Reference.

Oracle SOA Suite 12c: Build Composite Applications 11 - 9

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

REST Adapter Oracle SOA Suite composite applications can consume REST services.

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 cebe used to expose and consume REST services. i l K The REST adapter can AR N O Oracle SOA Suite composite applications can also be exposed as a REST service.

K

Oracle SOA Suite 12c: Build Composite Applications 11 - 10

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

Creating a REST Binding

Provide a name and a description, and identify the binding as a service or a reference.

Provide a relative path for the resources.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o Name the operation, resource ฺc nt G m path, and HTTP verb. 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 you provide a name and an optional description, and identify it as i l K To create a REST binding, AaRservice or a reference. You then provide a relative path (URI) for the resources. either N O

K Finally, you bind the operation, the resource path, and the HTTP verb.

Oracle SOA Suite 12c: Build Composite Applications 11 - 11

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

Adding an Operation Binding

Add an operation binding.

Specify the HTTP verb.

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 the HTTP verb (method) is selected from a drop-down list. You then i l K When adding the binding, ARthe request and response messages by using the Type Chooser. describe N KO Describe the request and response messages.

Oracle SOA Suite 12c: Build Composite Applications 11 - 12

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

The Finished Binding Component server

application

service

resource

http://:/soa-infra/resources//PackAndShipService/packingService/shipping

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 binding component, the resource URI, and a sample HTTP i l K The slide shows the finished AR including both the header (the method or verb can be found here) and the payload message, N O

K (in this example, the XML message).

Oracle SOA Suite 12c: Build Composite Applications 11 - 13

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

Testing the Component

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 ccan i l K The component WADL be observed from within JDeveloper. R A ON

K

Oracle SOA Suite 12c: Build Composite Applications 11 - 14

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

Examining the Results

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 can be completed by using the HTTP analyzer in JDeveloper. The TestingR ofK the component example NA in the slide shows a request message being sent, and the response received. In this O K example, the status field of the message was updated by the called operation.

Oracle SOA Suite 12c: Build Composite Applications 11 - 15

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

Quiz REST queries use ______________ to describe resources. a. XML b. URIs c. SOAP d. JSON

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 lice Answer:RbK NAqueries use URIs to describe resources. REST O K

Oracle SOA Suite 12c: Build Composite Applications 11 - 16

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

Summary In this lesson, you should have learned how to: • Identify the format of REST queries • List the differences between REST and SOAP • Create and test a REST binding in a composite application

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 11 - 17

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

Practice 11 Overview This practice covers the following topics: • Exposing a REST interface • Testing a REST interface • Consuming a REST service

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 11 - 18

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

Practice 11-1 to 11-4: Overview

3

4

le

1

b a r e f

s

an r t n

no a s ฺ a h ) ide 2 m u o ฺc nt G m b nฺi Stude i JDeveloper 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 cemodify the HelloBPEL composite application by exposing it as a liyou K practice, 1. InR this NAREST service. O K 2. You test the service from JDeveloper. 3. You create a second composite that invokes the REST service, passing the required resource. 4. You deploy the two composites and verify that they interact as expected.

Oracle SOA Suite 12c: Build Composite Applications 11 - 19

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ฺ

Developing Business Rules

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 business rule concepts • Describe the Oracle Business Rules architecture • Describe the Rules Engine • Explain the role of the Oracle Business Rules dictionary • Create rules with the JDeveloper Rules Designer ble a r • Integrate a simple rule with a BPEL process fe s n • Describe the role of the Rules SDK -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 l basic vocabulary and the concepts for Oracle Business Rules. You K you learn In this lesson, R learn NAhow to configure business rules and Decision Tables. You also learn how to invoke your O K configured business rule service component from a BPEL process.

Oracle SOA Suite 12c: Build Composite Applications 12 - 2

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

Agenda • •

Business Rules: Introduction Business Rules in the Oracle SOA Suite

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 12 - 3

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

Business Rules: Introduction Business rules are declarative statements that describe business policies or key business decisions. Examples of business rules include: • Business policies such as spending policies and approval matrixes • Constraints such as valid configurations and regulatory requirements ble a r fe • Computations such as discounts and premiums s n -tra • Reasoning capabilities such as offers based onon customer n value sa

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 enable dynamic decisions at run time, allowing you to automate K Rules Oracle R Business policies, NA computations, and reasoning while separating rule logic from the underlying O K application code. This allows more agile rule maintenance and enables business analysts to

modify rule logic without programmer assistance and without interrupting business processes. Consider implementing rules for the following cases: • Volatility: Rules that are likely to change frequently • Impact: Rules that affect the business the most • Ownership: Rules owned by particular business parties • Compliance: Rules that express regulatory requirements

Oracle SOA Suite 12c: Build Composite Applications 12 - 4

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

Business Rules Component A decision component, which is also called a business rule service component, supports the use of Oracle Business Rules in a SOA composite application. Decision components can be called within a composite application: • By a BPEL component • By a human task • By the dynamic routing capability of Oracle Mediator ble a r fe s • Directly by the SOA composite client n 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 composite application that includes the BPEL process, business rule, K a SOA You can create R A task service components. These components are complementary technologies. and Nhuman O K BPEL processes focus on the orchestration of systems, services, and people. Business rules

focus on decision-making and policies. Human tasks enable you to model a workflow that describes tasks for users or groups to perform as part of an end-to-end business process flow.

Oracle SOA Suite 12c: Build Composite Applications 12 - 5

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

Business Rules Use Cases Business rules can be used in various ways in composite applications: • Dynamic processing – Rules can perform routing within a business process based on service-level agreements or other guidelines.



Externalization of business rules in a business process – Many conditions must be evaluated in a business process. ble a The parameters for these conditions can be changed r fe s n independently of the process. ra

-t n o n a s – Validate input documents or apply constraints ฺ requests. ha deon ) • Human task routing om t Gui c ฺ m to especific n b i – Policy-based task assignments roles or users ฺ d n Stu i @ among – Load balancing ofintasks is users 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 Rules can perform intelligent routing within a business process based Kprocessing: Dynamic R A onN service-level agreements or other guidelines. For example, if a customer requires a O K response within one day, send a loan application to the QuickLoan loan agency only. If the •

Data validation and constraint checks

customer can wait longer, route the request to three different loan agencies.

Externalization of business rules in the process: There are typically many conditions that must be evaluated as part of a business process. However, the parameters for these conditions can be changed independently of the process. For example, you provide loans to only those customers with a credit score of at least 650. This value may be changed dynamically based on new guidelines set by business analysts.

Oracle SOA Suite 12c: Build Composite Applications 12 - 6

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

Data validation and constraint checks: Rules can validate input documents or apply additional constraints on requests. For example, a new customer request must always be accompanied by an employment verification letter and bank account details. Human task routing: Rules are frequently used for human tasks in a business process: • Policy-based task assignments to specific roles or users: For example, a process that handles incoming requests from a portal can route loan requests and insurance quotes to a different set of roles. • Load balancing of tasks among users: When a task is assigned to a set of users or a role, each user in that role acquires a set of tasks and acts on them within a specified time. For new incoming tasks, policies may be applied to set priorities on the tasks and to put them in specific user queues. For example, a specific loan agent is assigned a maximum of 10 loans.

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 12 - 7

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

Declarative Rules

IF THEN

One or more business terms are tested. tested

One or more actions are taken.

le

b a r e f

s n a r If customer is a Premium customer, THEN apply a 10% discount. -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 K form, al business rule can be expressed as an if/then statement. The IF part In its simplest R tests NAone or more business terms. If the tests pass, one or more actions are performed in the O K THEN part, such as adding or changing business terms. The rule IF part is composed of conditional expressions (rule conditions) that refer to facts. Example: IF Rental_application.driver age < 21 The conditional expression compares a business term (Rental_application.driver age) to the number 21 by using a less-than comparison.

The rule condition activates the rule whenever a combination of facts makes the conditional expression true. In some respects, the rule condition is like a query over the available facts in the Rules Engine, and for every row that is returned from the query, the rule is activated. The rule THEN part contains the actions that are executed when the rule is fired. A rule is fired after it is activated and it is selected among other rule activations by using conflict resolution mechanisms such as priority. A rule might perform several kinds of actions. An action can add facts, modify facts, or remove facts. An action can execute a Java method or perform a function that may modify the status of facts or create facts. Rules fire sequentially rather than in parallel. Note that rule actions often change the set of rule activations and thus change the next rule to fire.

Oracle SOA Suite 12c: Build Composite Applications 12 - 8

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

Facts

If customer is a Premium customer, THEN discount=10%.

Working Memory Facts are discrete pieces of data that constitute the input and output values for the business rule.

le

Customer.status

b a r e f

s

an r t n

no a s ฺ a h ) de a fact is put iWhen m u o ฺc nt G forth in memory, it is m b said to be asserted. 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 Kapplied to ldata objects that are known as facts. Facts are discrete pieces of data that Rules are R constitute NA the input and output values for a business rule. Facts must be exposed through XSD O K definitions. Fact definitions make up part of a data model, and must be defined before you can Discount.amount

create rules.

These facts are asserted and added to the working memory of a rule session. Each data object instance corresponds to a single fact.

Oracle SOA Suite 12c: Build Composite Applications 12 - 9

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

Decision Tables A Decision Table provides a compact representation of all possible if/then permutations.

Decision Table

R1

CONDITION If shipChoice

two_day

ACTION Assert carrier

RedShipper

R2 five_day

GreenShipper

R3 next_day or international

le

s

an r t n

BlueShipper

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 in a spreadsheet-like format called a Decision Table. A Decision i l K Rules can also be expressed AisRmore compact and intuitive when many rules are needed to analyze many Table N KO combinations of property values. You can use a Decision Table to create a set of rules that covers all combinations, or a set of rules in which no two combinations conflict.

You write rules and Decision Tables in terms of fact types and properties. Fact types are often imported from the Java classes, XML schema, or Oracle ADF Business Components View Objects. They can also be created in the Rules Designer.

Oracle SOA Suite 12c: Build Composite Applications 12 - 10

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

Value Sets Value sets define a list of values, a range of values, or an enumeration of values for a specified type.

Value sets are defined as types in an XSD file. They define the possible values for shipChoice and carrier.

le

b a r e f

s

an r t n

o R3 n a next_day or s two_day five_day CONDITION a ฺ h deinternational ) If shipChoice i om t Gu c ฺ RedShipper BlueShipper ACTION m GreenShipper n b e i ฺ Assert carrier 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 havela name, value, data type, and an optional value set. Value sets define a Fact properties R listN ofAvalues, a range of values, or an enumeration of values for a specified type. A value set O K splits the value space of a fact property data type into buckets that can be used to specify Decision Table

R1

R2

constraints on the values associated with Decision Tables, choice lists, variable initial values, and function return values or function argument values. There are three forms of value sets: • List of values (LOV): Defines a list of values • List of ranges: Defines a list of value ranges, defined by range endpoints • Enumeration: Defines a list of fixed types. Enumerated types can be imported from XML or Java facts. You can define a value set as a global construct that allows reuse, or as a local construct that applies to only one condition expression.

Oracle SOA Suite 12c: Build Composite Applications 12 - 11

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

Globals IF orderTotal > approvalLimit THEN needsApproval=true()

orderTotal

needsApproval

approvalLimit

le

b a r e f

s

an r t n

no a s ฺ a h Globals ecan be variable ) or constant. d i m They are u o tG c ฺ m en similar to public static b i ฺ variables in Java. 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 A global represents al data value or an expression that can be evaluated in rule conditions and R expressions. For example, if a 10% discount is used in several rules, you can create and use a NA O A global represents a data value or an expression that can be evaluated in rule conditions and expressions.

Working Memory

K defaultDiscount global variable, so that changes to the value need to be carried out in only one place while the discount is applied to many rules in the dictionary.

Globals are named types that can be based on object, string, or standard primitives, and can be used in rule definitions and actions. Globals can be variable or constant. They are visible to all the rulesets in the dictionary. A global is similar to a public static variable in the Java language.

Oracle SOA Suite 12c: Build Composite Applications 12 - 12

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

Rulesets

A ruleset is a collection of one or more related rules and Decision Tables.

Ruleset IF/THEN IF/THEN IF/THEN

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 are grouped in an Oracle Business Rules object called a ruleset. A i l K Rules and Decision Tables AR ruleset is a collection of one or more related rules and Decision Tables that are seen as a unit N KO of execution and that can be chained together to yield an outcome. A ruleset provides a Rulesets and Decision Tables are seen as a unit of execution and can be chained together.

namespace, similar to a Java package, for rules and Decision Tables.

Oracle SOA Suite 12c: Build Composite Applications 12 - 13

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

Rules Dictionary Create or import

1 3

Rules Dictionary

Java Facts Java class

2

RL Facts ADF-BC Facts

3 Rules Designer

XML Facts XML Schema

Facts

Value sets

Globals

le

Data model

b a r e f

s

an r t n

.rules n4 o a s ฺ a h Rule ) ide m u o 5 ฺc nt G Rule m IF condition condition1THEN THENaction ฺib tude Define Business Policies naction i 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 cefacts, functions, globals, value sets, and rulesets in an Oracle Business i l K You group one or more R Aobject Rules called a dictionary. A dictionary is an XML file (in the local file system with a N .rules extension) that stores the application’s rulesets and the data model. KO Ruleset

Creating an Oracle Business Rules dictionary requires the following: 1. Creating or importing a dictionary into a project by using the JDeveloper Rules Designer 2. Populating the dictionary with the set facts, functions, globals, value sets, and rulesets. A data model contains the business data definitions for the facts or data objects used in the rules. 3. Creating one or more facts. Facts can be created as XML facts (derived from XML schema elements), Java facts (based on a Java class), RL Language (RL functions) facts, or ADF Business Component facts (based on View Object definitions). 4. Creating rulesets as a container for a set of one or more rules or Decision Tables 5. Defining rules to express the business policies based on the facts in the data model

Oracle SOA Suite 12c: Build Composite Applications 12 - 14

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

Oracle Business Rules RL Language The goldCust rule uses a Java class containing the customer data, cust. rule goldCust { if (fact Customer cust && cust.SpentInLastMonths(3) > 500 ){ assert (new GoldCustomer(cust: cust)); } } An instance of the GoldCustomer RL class is asserted, representing a customer who spends more than $500 in a three-month period.

le

b a r e f

s

an r t n

rule goldDiscount { if (fact Order ord & fact GoldCustomer(cust: ord.customer) ) { The RL fact GoldCustomer is used to ord.discount = 0.1; infer that if a customer spent $500 in assert(ord); the past three months, the customer is } eligible for a 10% discount. }

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 more complex business logic, Oracle Business Rules supports a i l K For situations that require AR Java-like language called Oracle Business Rules RL Language (RL Language). RL high-level N O

K Language defines the syntax for Oracle Business Rules programs. RL Language includes a Java-like syntax for defining rules that support the power of Java semantics.

With RL Language, application programs can assert Java objects as facts, and rules can reference object properties and invoke methods. Likewise, application programs can use XML documents or portions of XML documents as facts. Programmers can use RL Language as a full-featured rules programming language, both directly and as part of the Oracle Business Rules SDK. RL Language is directly executed by the Rules Engine. It is interpreted rather than compiled, to enable rules to be changed without rebuilding, redeploying, or even restarting applications.

Oracle SOA Suite 12c: Build Composite Applications 12 - 15

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

Oracle Business Rules SDK JDeveloper Rules Designer

design time

Create, modify, and maintain rules.

Rules SDK

run time

le

b a r e f

Rules Dictionary

SOA Composer

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 SDK (Rules SDK) is a Java library that provides business rule– i l K The Oracle Business Rules AR features that a developer can use to write a rule-enabled program that accesses management N O Custom Java Application

Java API

K a dictionary, or to write customized rules programs that add rules or modify existing rules. The

Rules Designer uses the Rules SDK to create, modify, and access rules and the data model by using well-defined interfaces. Customer applications can use the Rules SDK to access, display, create, and modify collections of rules and the data model. You can use the Rules SDK APIs in a rule-enabled application to access rules or to create and modify rules. The rules and the associated data model can be initially created in a custom application or by using the Rules Designer.

Oracle SOA Suite 12c: Build Composite Applications 12 - 16

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

Oracle Business Rules Components Working Memory

Ruleset IF/THEN IF/THEN IF/THEN

Facts

Rules Engine

Pattern match rule to facts?

le

b a r e f

ns

If yes, execute rules.

Inference tra n Engine 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 is a data-driven forward chaining system, in which the facts determine K Rules Oracle R Business which NArules are evaluated. When a matching rule fires, the rule may add more facts. New facts O K are again compared against the rules. The process repeats until a conclusion is reached or the cycle is stopped or reset. This process is called an inference cycle.

A rule-based system consists of the following: • Rule base: Includes business policies expressed as IF-THEN rules and Decision Tables • Working memory: Includes the fact information added by applications by using assert calls • Inference Engine (Rules Engine): Processes the rules, and performs pattern-matching to determine which rules match a given set of facts

Oracle SOA Suite 12c: Build Composite Applications 12 - 17

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

Editing Business Rules at Run Time SOA Composer can be used to modify rules dictionaries at run time, without the need to redeploy the application.

Rules Dictionary

le

Facts

Value sets

b a r e f

s

an r t n

Globals

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 in a SOA composite application, Oracle Business Rules lets you K J isldeployed When aRdictionary A Composer to view, edit, and commit changes to a dictionary. SOA Composer is a use NSOA O K browser-based editing tool.

Oracle SOA Suite 12c: Build Composite Applications 12 - 18

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

Quiz A __________ is a collection of one or more rules that are seen as a unit of execution. a. Fact b. Ruleset c. Dictionary

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 A AN ruleset is a collection of rules that are considered as a unit of execution, and can be chained O K together to yield an outcome.

Oracle SOA Suite 12c: Build Composite Applications 12 - 19

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

Agenda • •

Business Rules: Introduction Business Rules in Oracle SOA Suite

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 12 - 20

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

Business Rules Component: Overview The Oracle Business Rules component can be used in various ways in a SOA composite application.

le

b a r e f

s

an r t n

no a as eฺ One of the most common ) h uses is to call the component om t Guid c ฺ from a BPEL process. 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 component (also called a Decision component) can be used to K Rules service A Business R implement NA dynamic routing with a Mediator component. It can be implemented as advanced O

K routing rules in human task definitions, where it can perform policy-based task assignments

that dispatch tasks to specific roles or users. It can also provide load balancing of tasks among users to control the task assignment load. A Business Rules component can also be called from a BPEL process. When used thus, the rules can determine intelligent routing paths within a business process based on service-level agreements or other guidelines. It can also externalize business rules in the process: Rule conditions that are evaluated as part of a business process where parameters can be changed are best implemented separately from the process. Rules can also validate input documents or apply additional constraints on requests. Oracle Business Rules is a powerful and flexible tool, and can be utilized in many ways to achieve many objectives. In this course, we focus on its creation, configuration, and invocation from a BPEL process within a composite application. For more information about Oracle Business Rules, go to http://www.oracle.com/technetwork/middleware/businessrules/documentation/index.html.

Oracle SOA Suite 12c: Build Composite Applications 12 - 21

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

Creating a Business Rules Service Component Create or import a dictionary.

le

b a r e f

s

an r t n

K

no a s ฺ a h e structures ) idfact Specify the initial XML m u o G service input ฺc default and the Decision t m n b demessage structures. nฺiandSoutput 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 J ce component in a composite application, perform the following steps: i l K To create a Business Rules R A N O1. Drag a Business Rules component into the Components column. 2. Select to create or import the dictionary. 3. Select Create > Input or Create > Output to define the initial XML fact structures. These structures are added to the Business Rules dictionary. They define the default Decision service input and output message structures. 4. Select an XML schema element to define either the Input or Output fact structures. 5. Click OK to create the component.

When you create a Business Rules component in the Composite Editor, it creates a standalone business rule in the composite application and the Business Rules dictionary. The dictionary is created with a default Decision function for the Decision service. However, the dictionary is not opened in the Rules Designer. Note: The Decision service name is defined on the Advanced tab (not shown in the slide).

Oracle SOA Suite 12c: Build Composite Applications 12 - 22

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

Adding a Business Rule to a BPEL Process

1

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 cein a BPEL process provides you with the option to create a new i l K Creating a business rule AR Rules component in the composite application, or to select a Business Rules Business N KO component that already exists in the composite application. In addition, creating a business rule in the context of a BPEL process enables you to create the Business Rules dictionary and specify the rulesets that are invoked.

To create a business rule in your BPEL process: 1. In the BPEL Designer window, drag a Business Rules component into your BPEL flow. This opens the Business Rule activity window.

Oracle SOA Suite 12c: Build Composite Applications 12 - 23

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

Configuring a Business Rule in a BPEL Process Select a dictionary. Select the operation.

le

b a r e f

s

Map BPEL variable values to input and (if the business rule is synchronous) output facts.

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 the desired Business Rules component to the composite and i l K If you have already added AR it, select the desired dictionary and, from that dictionary, the operation. Then map configured N KO the input and output facts for the business rule to the appropriate BPEL variables. Note: If you have not yet created and configured the desired Business Rules component, you can add a dictionary and specify the input and output facts from the configuration dialog box shown in the slide.

Oracle SOA Suite 12c: Build Composite Applications 12 - 24

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

Examining Business Rules Component Files

The Business Rules dictionary contains the ruleset definitions, rule, facts, and globals. The Decision Service XML Schema defines the structures for the input and output facts.

le

b a r e f

The Decision Service WSDL document defines the basic stateless and stateful web service operations that can be invoked.

s

an r t n

no a s metadata a The Business Rules e ฺ h ) d i defines the mapping u of the Decision omoperations c G ฺ service to the Decision t mfunctions. n b e 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 After you create the Business Rules component in your composite application or BPEL R A process, N the following files are created in the project folder: KO• A Decision service XML Schema that defines the structures for the input and output facts • • •

A Decision service WSDL document that defines the basic stateless and stateful web service operations that can be invoked A Business Rules dictionary (.rules file) for containing the ruleset definitions, rule, facts, and globals that are added to the dictionary The Business Rules metadata (.orig file) that defines the mapping of the Decision service operations to the Decision functions that can be executed

Note: When you expand the business rule activity in the BPEL process, you find that it is in fact a scope that contains the following: • • •

A few Assign activities to prepare the input fact data An Invoke activity to execute the business rule functions A few more Assign activities to receive output facts

Oracle SOA Suite 12c: Build Composite Applications 12 - 25

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

Editing the Rules Dictionary

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o The Rules Designer includes a series of ฺc toneach t Gof m tabs to provide editing access e b ฺi turule. d nbusiness the elements ofia S @ 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 Rules ldictionary holds the rules that are executed by an application. The Rules The Business R Designer NA saves rules and their associated definitions in the dictionary (a .rules file). The O

K dictionary is created when you first add a Business Rule component to your composite or BPEL process flow. By using the Rules Designer, you can define basic building blocks such as facts, globals (variables and constants), value sets, and rulesets. Advanced features can also be defined and edited from here, including the following: • Functions: These are parameterized functions based on the RL Language syntax. • Links: These enable linking dictionaries to other dictionaries. • Decision functions: These provide access to rules through a Decision service that is invoked as a web service or from a Java program through the Rules SDK API.

Oracle SOA Suite 12c: Build Composite Applications 12 - 26

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

Defining Globals Assign the global a name, a data type, a value set (optional), and a value.

le

b a r e f

s

an r t n

no a s ฺ a h ) de iExpression m u o Use Builder Specify Constant and/or c G ฺ t m to define a value. n Final if appropriate. 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 J lice click the Globals tab, and then click the Create (+) icon. KRules 1. InR the Designer, NAIn the Edit Global window, enter a name (for example, defaultDiscount), select a 2. O K Type (for example, int), and in the Value field, click the Expression Builder icon. 3. In the Expression Builder window, create an expression or enter a literal value (for example, 10). Then click OK. 4. In the Edit Global window, select the Constant check box to make it a constant, and the Final check box to make it a final value. - Final: Select the Final check box to use the global in a rule test condition. In this case, the global is initialized once at run time and cannot be altered. A non-final global is modifiable in assign actions. Constant: If the Constant check box is selected, it does not require double quotation marks around string literal values, and it can be selected from expression value choice lists. Constant expression values must be constant to be valid. 5. Click OK to create the global. -

Oracle SOA Suite 12c: Build Composite Applications 12 - 27

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

Defining Value Sets A value set can be a list of values, or it can be a list of ranges that defines a list of value ranges by range endpoints.

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 ce value set, perform the following steps: i l K To define a “List of Values” R A N O1. In the Rules Designer, click the Value Sets tab, and then click the Create (+) icon > “List

of Values” to create a row. 2. In the new value set row, select the row and replace the name. Click the Edit icon to open the Edit Value Set window. 3. In the Edit Value Set window, click the Create (+) icon to add values and aliases.

To define a “List of Ranges” value set, perform the following steps: 1. In the Rules Designer, click the Value Sets tab. Then click the Create (+) icon > “List of Ranges.” This adds a row to the Value Sets table. 2. In the Value Sets table, double-click the Edit icon for the new value set to display the Edit Value Set window. 3. In the Edit Value Set dialog box, enter the value set name, select the desired data type for the range values, and click the Add Bucket With Lower Endpoint Included icon repeatedly to add the number of buckets required. In each bucket row that is added, click the endpoint cell and set the lower endpoint for each range. 4. Click OK to create the “List of Ranges” value set. Note: The Rules Designer always adds the negative Infinity (–Infinity) bucket in “List of Ranges” value set definitions. Oracle SOA Suite 12c: Build Composite Applications 12 - 28

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

Defining a Ruleset Test Condition and Action refer to previously defined facts and globals.

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 ceof organizing your rules. Before rules can be created, you need to i l K Rulesets provide a way AR create a ruleset as a container for the rules. After the ruleset is created, rules and Decision N KO Tables can be defined within it.

Oracle SOA Suite 12c: Build Composite Applications 12 - 29

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

Defining a Decision Table

Each condition row requires a value set from which to draw the values values.

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 ce and a condition operand, perform the following steps: i l K To create a Decision Table R A N O1. In the Rules Designer, select an existing ruleset. Click the Add icon and select the Create Decision Table option from the list. 2. In the Decision Table area, from the list next to the Add icon, select Condition. 3. Each condition row requires a value set from which to draw values for each cell. 4. In the Conditions area, double-click to display the navigator to select or enter an expression.

Oracle SOA Suite 12c: Build Composite Applications 12 - 30

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

Decision Functions

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 cehighlighted thus far have resulted in the definition of a Decision function i l K The configuration steps R Aexposed that is and invoked by the BPEL process. However, Decision functions do more than N O

K provide exposure to BPEL. Recall that earlier in this lesson, we saw that Oracle Business

Rules can be invoked by means other than BPEL processes (and even from outside Oracle SOA Suite). Decision functions provide access to rules through a Decision service that is invoked as a web service. Use a Decision function to call rules from a Java application, from a composite, or from a BPEL process. A Decision function performs the following operations: • Collect rulesets and other Decision functions under a single executable umbrella • Handle the assertion of inputs as rule facts in the Rules Engine working memory • Collect the consequent actions to be executed • Run rulesets • Return results In a Decision function, the rules that you use can be organized into several rulesets, and these rulesets can be executed in a prescribed order. Facts may flow to the first ruleset, and this ruleset may assert additional facts that flow to the second and subsequent rulesets until the facts finally flow back to the Decision function as the Decision function output.

Oracle SOA Suite 12c: Build Composite Applications 12 - 31

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

Quiz Which of the following components can execute business rules? (Select all that apply.) a. Mediator components b. Clients of the composite application c. BPEL components d. Database adapter components e. Human task components

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 Kb,Jc, e lice Answer:Ra, NA Rules is a component that is similar to the BPEL or Mediator component. It provides a Business O K WSDL interface to expose the Decision service through which rules can be executed. Therefore, a composite application that exposes a Business Rules component as a service entry point enables any of its clients to execute the business rule and obtain the results.

Mediator components can use routing rules to execute a Business Rules component. In fact, when you create a dynamic routing rule, this creates a Business Rules component whose results determine the target service that is invoked. BPEL components can invoke business rules and use the results to influence a process flow. The human task participant list builders can use business rules to generate a list of approvers for a stage in the human task configuration.

Oracle SOA Suite 12c: Build Composite Applications 12 - 32

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

Summary In this lesson, you should have learned how to: • Describe business rules concepts • Describe the Oracle Business Rules architecture • Describe the Rules Engine • Explain the role of the Oracle Business Rules dictionary • Create rules with the JDeveloper Rules Designer ble a r • Integrate a simple rule with a BPEL process fe s n • Describe the role of the Rules SDK -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 l RK

A

N KO

Oracle SOA Suite 12c: Build Composite Applications 12 - 33

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

Practice 12-1 to 12-3 Overview

1

The incoming message includes order data. If manual approval is required, the Manual Approval project from the previous lesson is invoked. 3

A business rule determines whether or not the order requires manual approval. 2 If manual approval is not required, the order is automatically ble a r approved. fe

4

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 and configure a business rule and call it from a BPEL process. This i l K In this practice, you create R Aprocess BPEL also calls the ManualApproval application that you completed in the lesson titled N KO “Implementing a Human Workflow and Notifications.” In the business rule, a pair of rules will use the IF/THEN logic to compare the incoming order total to a global that defines the threshold for manual approval, and to determine whether or not the order requires manual approval. This determination is returned to the BPEL process. If approval is required, the Manual Approval composite is invoked.

Oracle SOA Suite 12c: Build Composite Applications 12 - 34

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

Practice 12-4 to 12-6 Overview If the order is approved…

5

A second business rule is added. It employs a Decision Table to determine the shipping company for the order.

6

le

The results of the business rule are incorporated into the order data, and the order is published to a JMS Queue.

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G m b 7 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 ceyou modify, redeploy, and test the OrderProcessing composite i l K In this optional practice, AR If the order is approved, either manually or automatically (because the total is application. N KO below the approval threshold), a second business rule uses a Decision Table to route the order to the preferred shipping company based on the shipping option indicated in the order data. The response from the business rule is incorporated into the data, and the message is published to a JMS queue.

To accomplish this, you add a second Business Rules component. This component uses a Decision Table to assign a shipping carrier based on the shipping method specified in the order detail. You configure the Decision service interface by defining the service name and specifying the input and output fact structures, which are drawn from an XSD file that you import into the project.

Oracle SOA Suite 12c: Build Composite Applications 12 - 35

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

Practice 12-4 to 12-6 Overview

The Decision Table in the second Business business Ruleuses rule will use a pair a pair of value of valueinsets sets its definition in its of definition ofand conditions conditions actions and to route actions the order to route to the order toshipping proper the proper shipping company. company.

le

b a r e f

s

an r t n

o R3 n a next_day or s two_day five_day CONDITION a ฺ h deinternational ) If shipChoice i om t Gu c ฺ RedShipper BlueShipper ACTION m GreenShipper n b e i ฺ Assert carrier 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 [provided] XSD document to define the input and output facts and K Table uses The Decision R A sets to constrain the possible shipping choices and carriers. the Nvalue O Decision Table

R1

R2

K

Oracle SOA Suite 12c: Build Composite Applications 12 - 36

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

Designing and Managing Business Events

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 business events • Describe the Event Delivery Network • Define an event with Event Definition Language • Use a Mediator to publish and consume events • Use a BPEL process to publish and consume events ble a r • Use a test case to emulate an event message fe s n • Manage events in Enterprise Manager Fusion Middleware tra n o Control an

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 cthe i l K This lesson describes Oracle SOA Suite 12c Event Delivery Network (EDN) and the use R A ofN the Mediator and BPEL components to publish and consume events. You learn how to KOcreate event definitions by using the Event Definition Language (EDL) standard.

Oracle SOA Suite 12c: Build Composite Applications 13 - 2

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

Agenda • •

Events: Overview Creating and Configuring Events

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 13 - 3

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

Problem Statement

Exposed Services

Components

External References

DB Adapter Stock Updated

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 cSOA i l K Decoupled composite applications require complete separation of the service consumer R A and Nthe service provider, which is typically achieved through the use of asynchronous KOmessaging, where applications can perform in a “fire and forget” mode. When a business event occurs: • Is it of interest to any other services? • How should those services be invoked?

Advantages • This removes the need for an application to know the details of the application on the other side. • Resource utilization improves because applications are not holding on to resources until the interaction is complete Disadvantages • This introduces the complexities of creating and managing message queues and topics. • This requires that both the publisher of the message and the consumer use the same messaging technology. • Each messaging system also has its own constraints on the types of programming languages and environments that can use the service. What is needed is a level of abstraction that allows applications to generate an event by using business terms and to associate a business object in an implementation-independent form. Oracle SOA Suite 12c addresses this need with the Event Delivery Network. Oracle SOA Suite 12c: Build Composite Applications 13 - 4

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

Event Delivery Network

OEP

EDN API

With EDN Adapter

ADF-BC Application

Java Application

Event Delivery Network

le

mediator describe events

BPEL

mediator

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G m MDS b EDL XSD 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 (EDN) is not a messaging infrastructure. It coordinates events i l K The Event Delivery Network R Athe within SOA Suite service infrastructure, and is available to all composites that are running N KOin the SCA container (within the same JVM). Service Infrastructure

The EDN provides a true publish-subscribe abstraction. It supports a fully declarative approach, and does not require explicit wiring between components, thus leading to truly decoupled applications.

Oracle SOA Suite 12c: Build Composite Applications 13 - 5

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

Aligning SOA and EDA Through EDN

Services

JMS Messaging EDN

Interface

WSDL: Standard service interface model

JMS API

EDL: Event Definition Language

Data types

XSD: Strong typing

Handful of raw types

XSD

Orientation Business

Developer

Business

Tools

Mostly coding tools

Fully declarative

Developer’s responsibility

Automatic

Wealth of tools

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 ccompares i l K The table in the slide SOAP (service), JMS (messaging), and EDN (events). When R A these N are used together, you can create a rich and highly functional combination of ServiceKOOriented Architecture (SOA) and event-driven architecture (EDA) approaches to implementing Fault Handling

Developer’s responsibility

the varied business requirements. The EDN provides a way for events to coexist with services. Therefore, the EDN enables the SOA and EDA worlds to be aligned.

Oracle SOA Suite 12c: Build Composite Applications 13 - 6

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

Events: Introduction Events are one-way, fire-andforget asynchronous notifications of a business occurrence. Events are not targeted to a specific service provider, but are available to any and all interested parties.

publish

le

Events are messages that typically have a header and a payload.

Event Delivery Network

subscribe

b a r e f

s

an r t n

no a s ฺ a h ) subscribe 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 licThey Kmessages. EventsR are typically have a header and a payload. The header contains A metadata such as the event type and a time stamp. The payload contains details that N KOdescribe the facts of the event instance that the business logic in the consumer will process. Events are a one-way, fire-and-forget, asynchronous notification of a business occurrence. They are not targeted to a specific service provider, but are available to any and all interested parties. The publisher does not: • Rely on any service component receiving the business event to complete • Care if any other service components receive the business event • Need to know where the subscribers (if any) are and what they do with the data These are important distinctions between business events and direct service invocations that rely on the Web Services Description Language (WSDL) file contract (for example, a SOAP service client). 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 13 - 7

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

XSD

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o Gfile describes ฺc n t Theb referenced XSD m ฺipayload dofethe event. the n 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 inlthe ceslide describes the payload of an event with two values (productID i K The code sample R A and quantity). Components that either produce or consume events use this XSD to N KOunderstand the payload of the event.

Oracle SOA Suite 12c: Build Composite Applications 13 - 8

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

Event Definition Language

XML schema QName QName

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o G ฺc nPayload 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 The EDN uses the XML-based Event Definition Language (EDL), which enables you to define R A the Nevent and its associated strongly typed data. This definition is registered with the SOA KOinfrastructure, and is available to all composites for publication or subscription. An event definition consists of the following: • A global name or QName, which is qualified by a namespace to uniquely define the event name • Custom headers, which can be used for faster content-based routing than an XPath query on the event payload • A payload definition, which is the data associated with the event, and which is provided by the publisher and is available to the consumer. An XSD is typically used to define the structure of the payload information. An EDL file is created and deployed as part of a SOA composite application, even though it does not really belong to any one application—it is applicable throughout the SOA Suite container and is more or less “community property.” After the EDL file is deployed and registered with the EDN, subscriptions can be created on the events in the file.

Oracle SOA Suite 12c: Build Composite Applications 13 - 9

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

Event Publication

Event publication information (QName) is defined in the composite.xml file.

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 cenot have to be registered beforehand; anyone can publish an event of i l K Publishers of events do AR aN type that is defined through EDL. Events of a specific type can be published by many KOdifferent publishers, both inside the SCA container and outside of it. Primary publishers of events to the EDN are the Mediator and BPEL service components. SOA Suite exposes APIs in Java and PL/SQL for publishing events. ADF business components can be configured to publish events to the EDN when data manipulations on entity objects occur. Fusion Middleware Control has a facility for publishing test events.

Oracle SOA Suite 12c: Build Composite Applications 13 - 10

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

Event Subscription Event subscription information (QName) is defined in the composite.xml file.

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 ceregister their interest in events of a specific type with the EDN through i l K Composite applications AR or BPEL components that consume such events. the Mediator N KO An EDN offers the following three levels of subscription granularity: • Namespaces, where the subscriber receives any event with a specific namespace • Event names, where the subscriber receives an event with a specify QName • Content-based XPath filters, where a subscriber can add content-based filters to accept or reject events

The first step to consume an event is to discover its definition. Event definitions can be stored locally in a composite or globally on the server—in either case, they can be discovered through the JDeveloper resource catalog.

Oracle SOA Suite 12c: Build Composite Applications 13 - 11

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

Event Publication and Subscription

Component

Publish

Subscribe

Mediator

Yes (Routing Rule)

Yes

BPEL

Yes (Invoke)

Yes (Receive; Pick)

Human Task

Yes

No

ADF-BC

Yes (CRUD methods)

No

Java Application

Yes

No

PL/SQL

Yes

No

FMW Control

Yes (for testing)

No

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m In this course, we focus on event u o ฺc in thent G publication and subscription m b de Mediator and BPEL nฺi components. 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 e J cBPEL i l K Both the Mediator and service components can publish events and subscribe to them. R A Other N applications, including Oracle Application Development Framework (ADF) business KOcomponent applications and Java EE applications, can raise events. You can also raise events through PL/SQL APIs. Note: For more information about creating and publishing Oracle ADF business component business events, see the Oracle Fusion Middleware Fusion Developer’s Guide for Oracle Application Development Framework. The Oracle Fusion Middleware Developer’s Guide for Oracle SOA Suite 12c discusses how the human task component can create and generate business events, and how a Mediator or BPEL component can subscribe to those events.

Oracle SOA Suite 12c: Build Composite Applications 13 - 12

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

Quiz Which of the following can publish events? (Choose all that apply.) a. BPEL component b. ADF-BC application component c. Mediator component d. Human task component

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, b, c, d N KOAll these components can publish events.

Oracle SOA Suite 12c: Build Composite Applications 13 - 13

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

Agenda • •

Events: Overview Creating and Configuring Events

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 13 - 14

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

Creating an Event Definition

2

1

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o ฺc nt G m 3 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 for a composite application, perform the following steps: i l K To create event definitions R AClick N 1. the Event Definition Creation icon on the composite.xml window toolbar. O 4

K

2. In the Event Definition Creation window, enter: - The Event Definition file name, which is used for the EDL file that contains the event definitions that are added to the project - The directory, to specify where the EDL file is stored - The namespace, to specify the XML Namespace for event definitions Click the “Add an Event” (+) icon to create a new event. 3. In the “Add an Event” window, select an XML element from an XML schema that defines the event payload structure. Enter a name for the event. Click OK. The event is added to the Events table in the Event Definition Creation window and the EDL file. 4. Add additional events, or click OK to create the EDL file in the project folder.

Oracle SOA Suite 12c: Build Composite Applications 13 - 15

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

Configuring a Mediator to Publish Events

1

2

le

b a r e f

s

an r t n

K

no a s ฺ a h 3 ) 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 Mediator component, perform the following steps: i l K To publish an event from R A N O1. After opening the Mediator Editor, for a selected operation, click the Create (+) icon and select “Static routing rule.” 2. In the Target Type window, click Event. 3. In the Event Chooser window, browse for an existing EDL file or create a new EDL file with the events to be published. Select the event entry to be published and click OK.

Note: In the Mediator Routing Rule properties, the event icon appears next to the target field. The event name is formed by concatenating the string Event:: to the event name (for example Event::Event1). In the Composite Editor window, the Mediator component icon has a Published Events icon (lightning within a blue circle) on the left edge as a visual indicator for published events. The name of the published event appears inside the Mediator component icon. A Mediator component can publish more than one event. Each event is published in its own Routing Rule definition.

Oracle SOA Suite 12c: Build Composite Applications 13 - 16

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

Configuring a Mediator to Subscribe to Events

1 2

le

b a r e f

s

an r t n

no a s4 ฺ 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 event in a Mediator component, drag a Mediator component to the i l K To subscribe to a business AR column in the Composite Editor: Components N O 3

K

1. Select “Subscribe to Events” from the drop-down menu. 2. Click the “Subscribe to New Event” icon to locate an existing EDL file and select an event. 3. To further refine a subscription, click the Filter icon to define an XPath-based filter (just as you do for content-based routing). The filter consists of a Boolean expression that evaluates the event’s payload, resulting in true() for events that should be delivered and false() for events that the component declines.

4. After you click OK, the Mediator is added to the Composite Editor with the following visual clues: - The left edge of the Mediator component has a Subscribed Events icon to indicate that it subscribes to events. - The body of the Mediator component displays the subscribed event names. Note: A Mediator component cannot have a service interface and subscribe to events at the same time. A Mediator component can subscribe to multiple events.

Oracle SOA Suite 12c: Build Composite Applications 13 - 17

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

Setting Event Delivery Consistency

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o G transaction. ฺc ownnglobal One and only one: Events are delivered in their t m b Guaranteed: Events are delivered asynchronously nฺi Studewithout a global transaction. 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 that you want, you can set the level of delivery consistency for the i l K After you select the event AinRaddition to the desired filters. The following delivery consistency levels are available: event N KO •



One and only one: An event is delivered to the subscriber in its own global (JTA) transaction. Changes made by the subscriber within that transaction are committed after event processing has completed. If the subscriber fails, the transaction is rolled back. Failed events are retried a configurable number of times before being delivered to an error queue. Guaranteed: Events are delivered to the subscriber asynchronously without a global transaction. The subscriber can create its own local transaction for processing, which is committed independently of other event processing. The event is guaranteed to be handed to the subscriber. However, because there is no global transaction, a system failure can cause an event to be delivered multiple times. If the subscriber throws an exception (or fails), the exception is logged and the event is not resent.

Oracle SOA Suite 12c: Build Composite Applications 13 - 18

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

Publishing Events in BPEL Components

le

b a r e f

s

an r t n

K

no a s ฺ In an Invoke activity: a h e ) • Select Event as the interaction idtype. m u o G ฺcthe event. • Browse to select t m n b ฺi tutodaevariable to store the event. • Create or nbrowse i 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 e J cevent i l K To publish a business from BPEL, perform the following steps: R A 1. Add an Invoke activity to the BPEL process. ON 2. 3. 4. 5.

Double-click the Invoke activity. From the Interaction Type list, select Event. Click the Browse Events icon to select an event. Create or browse to a variable to store the event.

Oracle SOA Suite 12c: Build Composite Applications 13 - 19

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

Subscribing to Events in BPEL Components

le

b a r e f

s

an r t n

K

no a In a Receive or Pick activity: as ฺ h type. e ) • Select Event as the interaction d i m Gu oevent. c • Browse to select the ฺ nt to store the event. bm to da evariable i • Create or n browse ฺ i tu 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 K to a business To subscribe event in a BPEL process, perform the following steps: R A 1. Add a Receive or Pick activity. ON 2. 3. 4. 5.

Double-click the new activity. Select Event from the Interaction Type list. Click Browse Events to select an event. Create or browse to a variable to store the event payload.

Oracle SOA Suite 12c: Build Composite Applications 13 - 20

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

Managing Events from Enterprise Manager

le

b a r e f

s n a r 1 2n-t 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 K OracleR Enterprise Manager Fusion Middleware Control provides a Business Events page that A can Nbe accessed to manage, track, and test events in the EDN. KO

To access the Business Events page after you log in to Oracle Enterprise Manager Fusion Middleware Control, expand the SOA folder in the Farm navigator and right-click the soa-infra node. Click Business Events to display the Business Events pane, where you can examine the configuration information for event definitions as well as individual events. 1. To test an event, select the desired event and click Test. The Test Event window opens. 2. Enter the XML data that is needed to form the event payload that you want to test. This initiates any application that has subscribed to the event being tested. 3. To view all the events in the SOA Infrastructure EDN, click the Events tab. 4. Select an event entry, and then click Show Event Definition.

Oracle SOA Suite 12c: Build Composite Applications 13 - 21

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

Viewing Event Subscriptions

le

b a r e f

s

an r t n

no a For a given event, view the as h deฺ ) subscription configuration om t Gui information. 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 tab to search for and view the different types of subscriptions. K Click the Subscriptions R NA The O K Subscriptions tabbed page enables you to display and search for information about all

subscriptions, and also to create database subscriptions (although the screenshot in the slide has collapsed the Database Subscriptions section). However, in the example, you can see the Search section and some of the options that enable you to search for different subscription types, such as: • Database Subscriptions, to narrow the search result to database subscriptions • Component Subscriptions, to narrow the search result to component subscriptions • Database and Component Subscriptions (the default setting) In the Component Subscriptions section, a table lists the events and components and their owning composite application subscribing to the event, the event consistency settings, and the number of delivery failures (if any). This enables you to quickly monitor the state of events in the EDN.

Oracle SOA Suite 12c: Build Composite Applications 13 - 22

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

Quiz The “one and only one” consistency setting for event subscription causes events to be delivered to the subscriber in its own global (JTA) transaction. 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 KO

Oracle SOA Suite 12c: Build Composite Applications 13 - 23

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

Summary In this lesson, you should have learned how to: • Describe business events • Describe the Event Delivery Network • Define an event with Event Definition Language • Use a Mediator to publish and consume events • Use a BPEL process to publish and consume events ble a r • Use a test case to emulate an event message fe s n • Manage events in Enterprise Manager Fusion Middleware tra n o Control an

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 13 - 24

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

Practice 13 Overview This practice covers the following topics: • Publishing an event from a BPEL process • Subscribing to an event from 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 ice a composite application that updates the inventory quantity of a K J you lcreate In this R practice, NAitem in a database table. The application then publishes a stockUpdate event (from a Ogiven

K BPEL process) that contains the product ID of the stock item that is updated.

A second composite application includes a Mediator that subscribes to the stockUpdate event. The payload of the event is passed to a BPEL process that extracts the purchase order data for any order that includes the updated item, and has a status of “waiting.” When the purchase order is reconstructed, it is passed to the OrderProcessing application that you created and deployed in the lesson titled “Developing Business Rules.” Recall that the application also calls the Approval application that you created in the lesson titled “Implementing a Human Workflow and Notifications.” After deploying the two new applications, you test them by updating the database. You then go to the Worklist application to approve any orders where it is required, and observe the outcome.

Oracle SOA Suite 12c: Build Composite Applications 13 - 25

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

Practice 13 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 13 - 26

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

Testing and Debugging 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: • Create test suites for composite applications • Create test cases to initiate inbound messages, and to emulate outbound, fault, and callback messages • Create test cases with value-based and XML-based assertions ble • Discuss strategies for debugging and troubleshooting a r fe s applications n tra n • Use the SOA debugger to step through an application and o n a observe values during execution as

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 the implementation of unit tests and test suites (a collection of unit K you explore In this lesson, R tests) NAto test various use cases and conditions that verify the correctness of your application O K implementation coding paths.

With Oracle SOA Suite 12c, testing the components in a composite application becomes important when you have an application that depends on other services that may not yet be implemented. By using test suites and test cases, you learn to use emulations and assertions to test your application in the absence of dependent services to find out if your application works. In addition, you learn that unit tests are useful ways to debug an application even with the presence of dependent services to ensure that your application interactions are consistent with the requirements of the services that the application invokes. The goal is to learn how to create test cases and test suites in JDeveloper, deploy them with the application so that you execute the test cases and suites in Oracle Enterprise Manager Fusion Middleware Control, and examine the results. Test cases and test suites provide you with a useful way to debug composite applications and their interactions.

Oracle SOA Suite 12c: Build Composite Applications 14 - 2

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

Agenda • • •

Configuring Test Cases Running Test Cases Using the SOA Debugger

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 14 - 3

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

Testing SOA Composite Applications The goals of testing a SOA composite application are to: • Automate testing of interactions between internal components, as well as with external services • Simulate interactions between a SOA composite application and its partner web services • Ensure that a composite application interacts with web service partners as expected before deployment in a ble a r e production environment 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 RK

A

N KO

Oracle SOA Suite 12c: Build Composite Applications 14 - 4

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

Introducing the Composite Test Framework The composite test framework: • Simulates web service partner interactions • Validates process actions with test data • Creates reports of test results • Supports the creation of tests at the SOA composite application–level for:

le

b a – Wires r e sf n – Service binding components a tr n – Service components (such as BPEL processes noand Mediator a service components) s ฺ a h e – Reference binding components om) uid

ฺ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 an automated test suite framework for creating and running K JSuite provides Oracle R SOA repeatable NA tests on a SOA composite application. O K

Note: The test suite framework calculates the percentage of BPEL process service component source code executed in terms of the percentage of simple activities executed.

Oracle SOA Suite 12c: Build Composite Applications 14 - 5

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

Emulations and Assertions The composite test framework allows you to create emulations and assertions. • Emulations enable you to simulate the message data that your SOA composite application receives from both the service components inside the composite and the binding components outside the composite. • Assertions enable you to validate an entire XML document, ble ra e a part of a message, a non-leaf element, or a leaf element f s n a r at a point during SOA composite application execution t by n o comparing actual values to expected (asserted) a n values.

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 14 - 6

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

Test Suites: Overview For each composite application, the composite test framework supports: • Creating one or more test suites, each comprising a collection of test cases • Deploying the composite application with its test suites to a runtime environment • Running a composite application test suite, called a test able er f run, by using Oracle Enterprise Manager Fusion s an r t Middleware Control n

no a s ฺ a h Note: Each test run corresponds to a) single idecomposite m u o ฺc nt G application instance. 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 supports testing various components at the SOA composite i l K The composite test framework AR application–level, as listed in the slide. N O

K The composite test framework enables creating one or more test suites, each of which consists of a logical collection of one or more test cases. Each test case contains a set of commands that are performed when a test case instance is executed. The execution of a test suite is known as a test run. Each test run corresponds to a single SOA composite application instance.

Oracle SOA Suite 12c: Build Composite Applications 14 - 7

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

Test Cases: Overview A test case: • Is a component of a test suite • Is a specific test that is included in a test run • Can be thought of as a unit test that comprises the following components: – Process initiation to initiate your process with an input payload ble a r fe s – Emulations to emulate interactions n tra – Assertions to validate message content for the interactions n no a – Message files containing the test message samples used in s a ฺ the process initiation, emulations, and ) hassertions ide

om 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 Kcase mustlbelong to a test suite, and can be thought of as a unit test for a composite Each test R application. NA Each test case is executed when the test suite that contains it is run. Test cases O K comprise the following components: • • • •

Process initiation, which enables simulation of input messages that initiate your composite process to test the behavior of the application service entry points Emulations, which enable you to simulate the behavior of the internal and external components with which your SOA composite application interacts Assertions, which enable you to verify the contents of the different data messages that are exchanged during service interactions and process flow Message files, which contain sample XML message structures that are used for execution of the process initiation, emulation, and assertion components

Note: Message data can be embedded in each component or loaded at run time from the message files, which must be deployed with the test suite.

Oracle SOA Suite 12c: Build Composite Applications 14 - 8

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

Contents of a Test Case A test case can contain one or more: • Inbound message initiations or initiating events • Outbound message emulations • Callback message emulations • Fault message emulations • Value-based or XML-based assertions

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 ccollection i l K Test cases consist of a of process initiations (inbound, outbound, and callback), R A emulations, and assertions. Each of these test action types can be added to test cases in test N KO mode of the SOA Composite Editor. You create process initiations to initiate client inbound messages into your SOA composite application. You create emulations to simulate the message data or fault data (or both types of data) that your SOA composite application receives from web service partners. You create assertions to validate the test data in a variable or an XML document as a process is executed.

Oracle SOA Suite 12c: Build Composite Applications 14 - 9

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

Creating a Test Suite

2 1

le

b a r e f

s

an r t n

noCase. Create a Test

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 Kconsist ofl a logical collection of one or more test cases. Each test case contains a Test suites R setNofAcommands to be run as the test instance is executed. The execution of a test suite is O K known as a test run. 1. To create a test suite, in the Project folder, right-click the testsuites folder and select Create Test Suite. 2. Enter a name for the test suite, and then click OK.

Oracle SOA Suite 12c: Build Composite Applications 14 - 10

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

Creating the First Test Case 1

Name the test case.

3

Load or generate the input message to be used.

le

b a r e f

s

an r t n

K

no a s ฺ a h ) ide m u o ฺc Load Specify the service, operation, orG generate the output t m 2 and possible callback to test. n b message, that e 4 i ฺ n Stud output will ornotspecify i be tested. 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 ccase, i l K To create the first test perform the following steps: R A O1.N Enter a name and description for the first test case to be added to the test suite. 2. Specify the operation to be tested. 3. Specify an input message. 4. Specify an output message.

Oracle SOA Suite 12c: Build Composite Applications 14 - 11

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

Test Case Editor

A small blue arrow indicates that the initiating inbound message is defined.

The dashed wire and wire action icon indicate that an output message is defined.

le

b a r e f

s

an r t n

no a s ฺ a h The Test test case Caseeditor editorlooks lookslike likethe the ) ide m assembly editor (composite.xml), u o G ฺclanesare except that the outer m swimlanes swim are t n b differently colored. colored.. 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 the Application Navigator window as a child of the test suite, and i l K The test case file appears ARfile is opened in the Test Case window. The test case XML file visually resembles the the XML N O

K composite.xml file. However, you know that it is the test case file by the name of the tabbed window and because JDeveloper changes the color of the Exposed Services and External References columns. You can now visually edit the test case file by adding process initiations, emulations, and assertions.

Oracle SOA Suite 12c: Build Composite Applications 14 - 12

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

Test Case File compositeTest compositeDN="CCValidate" xmlns="http://xmlns.oracle.com/sca/2006/test"> *** The file includes 9000-1234-1234-1234 200 the input message. *** *** VALID ***

If specified in the wizard, It also includes a wire assertion and the description of the output message.

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 cecase, several folders are created in the project. The tests folder i l K When you create a test ARall the test case XML files. In the slide is an example of a test case file. It is built from contains N KO the information that is provided to the wizard, including the initiating input message, and a wire assertion that provides an output message. The input file simulates a message provided by a client, and the output message mimics data returned to that client by the composite.

Note: The messages folder is used to save the message files that provide messages for emulations and assertions. Message files are XML files that contain XML message fragments, and can be reused by copying them between test cases and test suites. The other subfolders (componenttests and includes) are not used in Oracle SOA Suite 12c.

Oracle SOA Suite 12c: Build Composite Applications 14 - 13

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

Creating Emulations

You can emulate output, callback, and fault messages, depending on the context of the selected wire.

le

b a r e f

s

an r t n

Generate sample messages automatically, or load them from a file or manual input.

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 cecase file opened in JDeveloper, double-click the wire of the SOA i l K With the appropriate test AR application area to test. This displays the Wire Actions dialog box, from which you composite N KO can design emulations and assertions for the selected part of the SOA composite application. With emulations, you can simulate a message returned from a synchronous web service partner, a callback message returned from an asynchronous web service partner, or a fault message returned from a web service partner.

Oracle SOA Suite 12c: Build Composite Applications 14 - 14

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

Emulating Events in a Test Case Event messages can be emulated within a test case.

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 ceenables you to create a test case in a test suite that publishes an event i l K The unit test framework AR to N a subscriber component such as a Mediator. O Specify the event to emulate and the target subscribers.

Sample data can be generated and edited.

K To emulate an event, perform the following steps:

1. In a test case XML editor window, click the Emulate Event Messages icon in the test case XML file window. 2. In the Event Messages window, select the event to be emulated from the Events section (to the left of the window), and select the target subscriber component from the Publish Event To drop-down list. 3. Generate, manually enter, or load an XML value for the event payload, and then click OK. The test case can be executed in the same way as other test cases, by using Enterprise Manager Fusion Middleware Control.

Oracle SOA Suite 12c: Build Composite Applications 14 - 15

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

Creating Assertions

2

1

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 J ceto verify variable data or process flow. Assertions enable you to i l K You perform assertions ARtest data in a variable or an entire XML document as a process is executed. This is validate N KO done by extracting a value from a variable or an XML document and comparing it to an 5

expected value. 1. As with emulations, right-click a wire and select Create Asserts and Emulates. 2. In the Asserts and Emulates window, click the Asserts tab, and then click the Add Assert (+) icon. 3. In the Create Assert window, you can select one of the following assertion options (depending on the type of interaction underlying the wire): - Assert Input: Creates an assertion for the inbound direction - Assert Output: Creates an assertion for the outbound direction - Assert Callback: Creates an assertion on a callback - Assert Fault: Creates an assertion for an application fault

Oracle SOA Suite 12c: Build Composite Applications 14 - 16

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

4. Select Compare by: XML Similar or XML Identical. - xml-identical: Performs an exact comparison between the elements and attributes of the XML message and the assertion value. If there is any difference between the two XML structures, the comparison fails. For example, a failure occurs if one document uses an element name of purchaseOrder, whereas the other uses an element name of invoice. A failure occurs if the child attributes of two elements are the same but appear in a different order in each XML structure. xmlidentical is a strict match comparison. - xml-similar: Performs a comparison based on similar XML content, but not an exact match. For example, comparison succeeds if both XML structures use the same XML Namespace string, but different namespace prefixes. Comparison succeeds if the same elements with the same child attributes exist, but the attributes appear in different orders in each element. Both these examples are considered similar and therefore recoverable. 5. In this example, an XML assertion is done for the entire message.

le

Note: You can create multiple assertions on the same wire.

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

s

Oracle SOA Suite 12c: Build Composite Applications 14 - 17

b a r e f

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

Quiz Which of the following must be present for a test case definition to be run as a unit test? a. Inbound message initiation or an initiating event b. Outbound message emulation c. Callback message emulation d. Fault message emulation

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 A AnN inbound message initiation or an initiating event is required to run a test case. The absence O K of an inbound message initiation or an initiating event prevents execution of the test case.

Oracle SOA Suite 12c: Build Composite Applications 14 - 18

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

Agenda • • •

Configuring Test Cases Running Test Cases Using the SOA Debugger

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 14 - 19

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

Selecting the Test Cases to Run After deploying the application with the test suites, open Enterprise Manager. On the composite application home page, click the Unit Tests tab.

Select a specific test case and click Execute.

le

b a r e f

s

an r t n

no a s ฺ a h Enter a name for the ) ide m test run and click OK. 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 licetest cases within a test suite, you must deploy the composite Kcan Before R you run any application NA project along with all the test suites it contains to an Oracle SOA Suite 12c runtime O K environment, such as a development or test system. Test suites must be deployed with the composite application, because a composite application instance is created to execute the selected test cases that form the test run. A test run is an instance of a test.

After deploying the composite application, log in to Oracle Enterprise Manager Fusion Middleware Control and perform the following steps to select the test cases to be run: • In the Farm navigator, expand the SOA tree and click the composite application name [version] deployed with the test cases. • On the composite application home page, click the Unit Tests tab (do not click the Test drop-down menu). The Unit Tests tab opens the Test Cases tabbed page. • On the composite application Unit Tests > Test Cases tabbed page, if needed, expand Test Suites and select the specific test case to be run, or click the check box next to a test suite name to select all the test cases in that test suite. The collection of test cases selected forms a test run. A test run is a collection of test cases that are executed simultaneously.

Oracle SOA Suite 12c: Build Composite Applications 14 - 20

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

After selecting the test cases to be run, click Execute, which opens a “Details of test run” window. In the “Details of test run” window, enter a name string for the test run. Choose a naming convention for the names to make it easier to search for the test run results on the Test Runs tabbed page. You can change the timeout for each test; a test is terminated if it exceeds the timeout. Set the “Number of Concurrent Test Instances” to create the specified number of test instances (for simulating load tests). Click OK to start the test run.

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 14 - 21

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

Running the Test Cases

Click Test Runs to monitor and view results.

A composite application instance is created for each test case.

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 cthee “Details of test run” window, an instance of the composite application i l K When you click OK in AR for each test case that is executed in the test run. The test cases are initiated by is N created KO using the initiations, emulations, and assertions defined in each test case. The composite application instances run without user intervention (unless your code involves a human task, which still needs to be managed via the normal Worklist application).

Note: After you click Execute to initiate the test run, the web browser page is refreshed with the Test Runs page being displayed. This enables you to monitor the test run progress and view the test run results. The following slide, titled “Examining Results of a Test Run,” provides an example of the Test Runs tabbed page.

Oracle SOA Suite 12c: Build Composite Applications 14 - 22

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

Examining Results of a Test Run

In the “Assertion details for” section, you can see the list of instance IDs for failed test case composite applications.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide the cause m u o Composite application Examine ฺc nt Gof assertion failure. m instance ID link to access b the Flow Trace page 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 cpage i l K The Test Runs tabbed is displayed after you initiate a test run. Initially, the Test Runs R A page N may not contain any information. To update the contents of the page and view the O

K progress or results for the test cases in a test run, perform the following steps:

1. Either click Refresh Test Status, or enter search criteria (such as the test run name), and click Search. 2. In the table immediately under the Search section (or just above the “Result of Test Run” section), the name of the test run should appear. Click the test run row entry that appears to populate the “Result of Test Run” section with a table of the test suites and test cases either in progress or completed and the status of each test. In the “Assertion details for” section, you can see the list of failed test case composite application instance IDs. You can also click the [XML] links in each instance row to examine the test assertion information, such as assertion failures. An example is shown in the next slide, titled “Viewing Assertion Information.”

Oracle SOA Suite 12c: Build Composite Applications 14 - 23

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

In the “Assertion details for” section of the Test Runs tabbed page, you can view the details of the test run assertions. The example shows some assertion failures. When you click any of the [XML] links in one of the “Assertion details for” table rows, you can view the data that is compared by the specific assertion and view the reason for any failures. In the slide, the actual and expected values are displayed and they do not match. However, the reason may not be obvious at first. The creditLimit and status nodes do not match, but the reason for the failure is the difference in the tags themselves—the tags in the actual value include an inp1: namespace reference, whereas those in the expected value do not. Recall that the xml-identical option requires an exact match between the XML message (or fragment) structure and the assertion value. The reason for the failure is the XML structure rather than the data itself. Note: The instance link in each row is the instance ID of the composite application that is used to perform the test case. If you click the instance ID link, you can access the Flow Trace page for that instance to examine and drill down into the composite application and the component details, as you would for any other composite application.

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 14 - 24

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

Quiz You start a test suite or test case by clicking the Test button on the composite application home page in Oracle Enterprise Manager. 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 A AN test suite or test case is executed by clicking the Execute button on the Unit Tests > Test O K

Cases tabbed page of the composite application page, after you select the test suites and test cases that are to be run. A test run creates a new composite application instance to run the test by using the inbound message initiation as initial input.

Oracle SOA Suite 12c: Build Composite Applications 14 - 25

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

Agenda • • •

Configuring Test Cases Running Test Cases Using the SOA Debugger

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 14 - 26

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

Troubleshooting Guidelines Imports

XML Schema

1

WSDL

2

3

Server Logs

Defines

Enterprise Manager

Service Testing Request

Composite Application

le

Response?

Client

SOA Debugger

b a r e Web sf n Service a tr

n o an s ha deฺ ) i Service Test Tool m GWeb Examines u o c ฺ SOAP/HTTP 4 m ent b i ฺ d HTTP Analyzer in StuJDeveloper @ 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 SOAl applications, one approach is to follow the life cycle of a client request To troubleshoot R A and (if any) through all the components involved in the interaction. Using this Nresponse O 5

K approach, you track the flow of a message through the system and examine possible sources

of an error in a systematic way. First look at error messages, if available, and take action or make an “educated guess” as to where to start looking next. Usually, an error message points to the probable cause and source of the error, and/or the log files to be consulted for more information. The graphic in the slide depicts a simple request-response life cycle, highlighting the key service artifacts that may be a source of errors. It shows the tools to help test and debug an application, and highlights the importance of log files as sources of information.

Oracle SOA Suite 12c: Build Composite Applications 14 - 27

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

The numbers in the graphic in the slide represent common sources of problems and the tools to address them: 1. The XML schema validity, and whether it is accessible to the WSDL that is importing it 2. The WSDL document types, the message, the port type and operation definitions, the URL defining the endpoint, and the service binding definitions 3. The service logic and its runtime environment; the application-level (service-level) and server log files. Enterprise Manager Fusion Middleware Control provides access to all log files. 4. The actual contents of the request-and-response messages. If SOAP/HTTP bindings are used, these exchanges can be monitored by using an HTTP Analyzer tool. 5. The SOA debugger, which provides a troubleshooting environment within Oracle JDeveloper. You can set breakpoints in Oracle JDeveloper for troubleshooting the binding components and service components in SOA composite applications, and on synchronous and asynchronous BPEL processes.

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 14 - 28

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

Debugging SOA Composite Applications with the SOA Debugger The SOA debugger provides a troubleshooting environment within Oracle JDeveloper.

le

b a r e f

s

an r t n

no a s ฺ a h ) ide m u o Set breakpoints on binding components, G ฺc nt and service components, and synchronous m b de asynchronous BPEL nฺiprocesses. 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 a troubleshooting environment within Oracle JDeveloper. You can i l K The SOA debugger provides AR setNbreakpoints for troubleshooting on binding components, service components, and O

K synchronous and asynchronous BPEL processes.

The features include: • Local or remote debugging • Setting break points and tracing message flow • Viewing raw messages (SOAP and Non-XML) entering or leaving • Changing variables while debugging • Viewing transaction boundaries

Oracle SOA Suite 12c: Build Composite Applications 14 - 29

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

Starting the Debugger By default, the name of the local host is displayed. You can also enter a remote server.

le

Enter the port on which the debugging agent listens.

Specify in minutes how long the client should wait while attempting to establish a debugging session before stopping.

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 capplications i l K Both local and remote can be debugged. When the debugger is started, the R A Connection Settings window prompts for the server to use for debugging, the debug port, and N KO the timeout for the debugger when it is inactive. The debugger properties are stored per project. If you have imported a project from a different machine, the host will probably have to be changed. These values can be stored in JDeveloper properties, which enables you to skip the Connection Settings window if you always want to use the same options.

Oracle SOA Suite 12c: Build Composite Applications 14 - 30

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

Setting Breakpoints in Services

Choose whether the request, the reply, or both the request and reply are important.

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 pausing locations in a SOA composite application that you set i l K Breakpoints are the intentional AR purposes. You can set breakpoints on a request, on a reply, or on both. forN debugging KO• Create Breakpoints Pair: Set for a request-reply (outbound-inbound) interaction. This is • •

useful for scenarios in which both the request and reply are important. Create Request Breakpoint: Set for a request (outbound) interaction. This is useful for scenarios in which only the request is important. Create Reply Breakpoint: Set for a reply (inbound) interaction. This is useful for scenarios in which only the reply is important.

Components on which breakpoints are set are designated with red request (outbound) icons, reply (inbound) icons, or request-reply (outbound-inbound) icons.

Oracle SOA Suite 12c: Build Composite Applications 14 - 31

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

Setting Breakpoints in BPEL To set a breakpoint on a service component, select Edit.

Right-click the BPEL activity on which to set a breakpoint, and select Toggle Breakpoint.

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 licaeBPEL process, select Edit. This opens the BPEL process in Oracle K J on To set R a breakpoint BPEL NADesigner. Right-click the BPEL activity on which to set a breakpoint and select Toggle O

K Breakpoint.

An icon is added to the activity. These breakpoint icons are only red dots because the flow is always in one direction. It is recommended that you always set a breakpoint on the first activity within an asynchronous BPEL process. To disable the breakpoint, right-click and select Toggle Breakpoint again. The red dot is removed. To display a list of all breakpoints set in the BPEL process, right-click the activity and select Breakpoints. A dialog box appears. You can also enable and disable breakpoints from this dialog box.

Oracle SOA Suite 12c: Build Composite Applications 14 - 32

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

Initiating Debugging

Right-click the right handle.of the service binding component and select Initiate WS Debugging. This invokes the HTTP Analyzer.

le

b a r e f

s

an r t n

Enter the request message no data to sendsoraclick HTTP ฺ paste the hacopydand Content) to e i uan XML file. contents om tfrom c G ฺ n Request. ibmClickeSend

nฺ 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 e J cthe i l K To begin debugging of SOA composite application, right-click the right handle of the service R A binding N component and select Initiate WS Debugging from the shortcut menu. This invokes the O

K HTTP Analyzer. Enter the request message data to send and click Send Request, or click

HTTP Content to copy and paste the contents from an XML file. You can either enter data fieldby-field or copy and paste an XML document.

Oracle SOA Suite 12c: Build Composite Applications 14 - 33

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

Examining Values The first breakpoint turns blue and begins pulsing.

le

b a r e f

s

an r t n

no a s ฺ a In the Log window at the bottomhof ) ide Oracle JDeveloper, click Data. m u o G ฺc ntYou Expand the message contents. m b e dchange can double-click to it. nฺai value u i t S @ 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 stops lat the first breakpoint that you set (for example, on the service binding The debugger R component). In the Log window at the bottom of Oracle JDeveloper, click Data. Expand the NA O

K message contents. You can double-click a value to change it. For non-XML variables, rightclick and select “View value” (for example, the return message from a Database adapter).

Oracle SOA Suite 12c: Build Composite Applications 14 - 34

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

Frames

When you create a breakpoint, a corresponding frame is created in the Structure window. A frame is a location.

A stack of frames is a breadcrumb trail of the locations that lead you to your current location.

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 When you create a breakpoint, a corresponding frame is created in the Structure window. A R A frame N is a location. A stack of frames is a breadcrumb trail of the locations that lead you to your KO current location. This is equivalent to a stack trace. It shows you where you are and how you got there. Frames are created independent of breakpoints. When you stop at a breakpoint, all frames that have been created in the Structure window are displayed. A stack frame also contains the data that existed at that point of time. Clicking a different stack frame in the Structure window also updates the Data tab. You can step over or skip the frame and begin debugging at a different location, such as a different breakpoint. As you proceed with debugging, additional frames are created.

Oracle SOA Suite 12c: Build Composite Applications 14 - 35

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

Stepping Through the Application • F7 Step Into • Shift-F7 Step Out Of • Shift-F8 Step Over • F9 Resume Step

le

The debugger steps through the copy rules in an Assign activity one at a time.

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 lice K J an application, To stepR through use the following function keys or the corresponding toolbar A icons: N O • • •



F8 steps over a frame. This places you at the next breakpoint. If there are no breakpoints, it steps over all the frames and goes back to the first frame. F7 steps into the next valid location. This can be a new frame or the same frame, but in a different location. Shift-F7 steps out of a frame. This option is used only to process a BPEL scope or sequence activity. After completion of scope processing, it pauses at the next scope or activity in the process. F9 resumes a step operation.

Note: The debugger steps through the copy rules in a BPEL Assign activity one at a time.

Oracle SOA Suite 12c: Build Composite Applications 14 - 36

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

Ending a Debug Session Click the Terminate icon to end a debug session. As long as the debugger is running, the project cannot be edited.

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 licaedebugging session, perform the following: To endR orK detach from NAthe Terminate icon in the tools menu to end a debugging session. The Terminate Click O

K Debugger Process dialog box is displayed. Select an option: • •

Detach removes the debugger without ending the debugging process. Terminate ends the debugging process.

Notes • If you selected Detach, click the Debugger icon above the SOA Composite Editor to resume debugging. • If you selected Terminate, right-click and select Initiate WS Debugging to reinitiate the debugger and start a new debugging session.

Oracle SOA Suite 12c: Build Composite Applications 14 - 37

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

Summary In this lesson, you should have learned how to: • Create test suites for composite applications • Create test cases to initiate inbound messages, and to emulate outbound, fault, and callback messages • Create test cases with value-based and XML-based assertions ble • Discuss strategies for debugging and troubleshooting a r fe s applications n tra n • Use the SOA debugger to step through an application and o n a observe values during execution as

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 14 - 38

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

Practice 14-1 to 14-3 Overview

Add assertions.

Emulate a reply message.

le

b a r CREDITCARDS e f tablens a n-tr

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 ceis to create a test suite that contains three test cases and to deploy the i l K The goal of this practice AR application with its test suite. After the composite application is deployed, you use composite N O Initiate an inbound message.

K Oracle Enterprise Manager to run the test suite and one test case.

The slide illustrates the concept of a composite application test case, which comprises: • An initiating inbound message that provides the input data for the composite application when the test case is initiated. This initiating inbound message is created on the composite entry point that is used to initiate the test. • An emulation for the reply from the CreditCardDB service. The reply emulates the response to the ValidateCreditCard Mediator component from the CreditCardDB service. • An assertion to verify that all or a part of the response data contains data and values that we expect to be returned from the Mediator component to the client that is initiating the request Emulations and assertions are wire actions and can be created on any wire in a composite application. When an emulation for a reply is created, the actual service for which the emulation is created does not have to exist. In this case, the CreditCardDB service does exist. However, we are emulating a scenario that does not return useful data because of information that is lacking in the database.

Oracle SOA Suite 12c: Build Composite Applications 14 - 39

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

Practice 14-4 Overview In this practice, you use the SOA debugger to step through a running application.

You observe the values in the HTTP Analyzer.

le

s

b a r e f

You step through a running BPEL process, one line at a time, before terminating the debug session.

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 14 - 40

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

Securing Composite Applications and Invoking Secured Services

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 Web Service Security • Describe Oracle Web Services Manager and its use in securing SOA composites • Discuss security and identity propagation in SOA composites e • Attach security policies to endpoints at design time and runrabl fe s time n 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 scenario: Kthe following Consider R NA The O K composite application that you are building interacts with a credit card validation service. The business owner of the credit card information requests that you secure the interaction with credit card validation processing. Your goal is to learn how to apply security: • At design time by using JDeveloper to attach policies to service endpoints • After deployment by using the Oracle Web Services Manager (OWSM) web interface, which is accessed through Oracle Enterprise Manager Fusion Middleware Control, to attach policies to appropriate service endpoints As a result, you will be better informed on the choices you can make about when to apply security policies to your application. This can be a developer or an administrative task.

Oracle SOA Suite 12c: Build Composite Applications 15 - 2

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

Agenda • • •

Web Service Security Oracle Web Services Manager Securing Composite Applications

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 15 - 3

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

Web Service Security: Introduction Securing web services by using WS-Security standards: • Supported by WS-Security policy standards, among others • Applied to service endpoints to provide: – Authentication and authorization – Signing and encrypting the whole message or parts thereof – Integrity (reliable messaging), confidentiality, and propagation of credentials Authentication Who?

WS-Security UsernameTokenProfile (sign, encrypt, propagate)

le

b a r e f

Allow (Y/N)? Authenticate and authorize WS-Security policy

s

an r t n

no a Policy has ฺ Request e ) enforcement d i om t Gu point c ฺ m en Response b i ฺ in Stud Endpoint Service Client @ 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 (or any services) involves protection of: Kweb services Securing R A N • The service endpoint, which is the entry point to the service functionality O K •

The message contents, through digital signing, encryption, and ensuring message integrity

Securing web services is addressed by many standards, such as WS-Security and WSSecurity Policy, which define various elements for securing web service endpoints and the messages that flow between the service consumer and the service provider. WS-Security standards cover: • Authentication: The process of obtaining a username and password that is validated by using some kind of identity store • Authorization: The process of allowing or disallowing access to some functionality or data, usually implemented through privileges that are assigned to roles, or attaching policies to the environment • Signing and encryption of the message that flows from the client to a service endpoint Using the WS-* security standards, much of the configuration is declarative, which removes most requirements for adding security logic to code. The key benefit of a declarative approach is the ability to change things post-deployment—that is, no code changes.

Oracle SOA Suite 12c: Build Composite Applications 15 - 4

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

Web Service Security: Introduction WS-Security (WSS) 1.0 and 1.1 standards enable: • Authenticating in multiple ways with security tokens • Associating different identities with service requests • Signing or encrypting the whole message body, or a single XML element of the body payload • Adding credentials in the SOAP header, as in this example: ... jcooper welcome1 ... ...

le

b a r e f

s

an r t n

no Security a s ฺ token 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 standard for Web Service Security (WS-Security) to provide K J the lOASIS OracleR supports message-level and transport-level security for web services. WS-Security defines a NA O K mechanism for adding transport independence and different levels of security to SOAP messages. If there is a need to apply integrity and confidentiality at a fine-grained level, XML signature and encryption can be used to protect the SOAP body, header block, or portions of either. If the SOAP message needs to be protected beyond the transport session, message-level security can be used. If there is a need to use different forms of authentication, message-level security authentication tokens can be used, such as username token, X.509 token, or a Security Assertion Markup Language (SAML) token. In the Oracle implementation, all WS-Security features (including digital signatures, encryption, and authentication) are implemented by using a prebuilt JAX-WS handler called an interceptor. The interceptor adds the authentication, signature, and encryption WSSecurity elements to the SOAP message, and then forwards the message to the receiving web service. A receiving web service also has interceptors to decrypt, verify signatures, and authenticate incoming messages. The Oracle implementation of WS-Security integrates with Java Authentication and Authorization Service (JAAS) and a variety of authentication providers.

Oracle SOA Suite 12c: Build Composite Applications 15 - 5

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

Many web service standards are involved with Web Services Security implementations. Remember that authentication for web services is done by using Oracle Platform Security Services (OPSS) Login Modules. For SOA composites and components, security is implemented through the WS-PolicySecurity standard, where policies are stored in the WSPolicy 1.2 format, and the policies that are used are advertised through WSDL in the WSPolicy 1.2 format as well. OPSS and Oracle Web Services Manager enable the same policy to be reused and applied to more than one service, which provides the capability to do bulk attachment. Policies can be versioned so that older policies are re-established by using a policy rollback operation. Oracle Platform Security for Java provides automatic identity propagation. Other supported web service standards include: • WS-Security 1.0 • WS-Security 1.1 • WS-SecurityPolicy 1.1 • WS-Security-SwA • UsernameTokenProfile 1.1 • X509TokenProfile 1.1 • Security-Policy Use cases Working Draft 2

le

b a r e f

s

an r t n

no a s ฺ a h )Application Note: OPSS makes use of the Oracle Fusion Middleware ideServer Java Platform m u o Security (JPS) implementation. ฺ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

K

Oracle SOA Suite 12c: Build Composite Applications 15 - 6

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

Securing Endpoints: Examples Policy name is used to enforce assertions.

le

s

an r t n

no a s ฺ a h The attachment is added to the service (entry ) ide m point) in composite.xml. u o ฺc andnttheG Result: The user is authenticated, m b subject is associated with de thread. nฺi theScurrent 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 J ce attachment fragment for the following scenario: i l K The slide shows the policy R A N KO• The scenario: UsernameToken–based identity authentication. In this case:

The policy enforces the authentication of credentials that are provided via the UsernameToken WS-Security SOAP header (both plain text and digest mechanisms are supported) - The credentials obtained are authenticated against the currently configured JPS identity store The result: The user is authenticated, and the subject is associated with the current request thread. The policy: oracle/wss_username_token_service_policy -

• •

b a r e f

Note: This policy can be applied to any SOAP-based endpoint.

Oracle SOA Suite 12c: Build Composite Applications 15 - 22

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

Attaching a Policy to an Inbound Request by Using Oracle JDeveloper 12c

1

le

b a r e f

s

2

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 12c to attach policies for testing security in a design-time i l K You use Oracle JDeveloper AR When your application is ready for deployment to a production environment, you environment. N KOcan attach runtime policies in the Oracle Enterprise Manager Fusion Middleware Control console. To attach a policy to an exposed service, perform the following steps: 1. Right-click the exposed service and select Configure WS-Policies. 2. Click the Add icon for the type of policy, and then select the respective policy to attach. The slide shows an example to attach an oracle/wss_username_token_service_policy security policy to the receiveOrder service.

Oracle SOA Suite 12c: Build Composite Applications 15 - 23

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

Attaching a Policy to an Outbound Request Scenario: SAML-based identity assertion Policy: oracle/wss10_saml_token_client_policy

le

b a r e f

s

an r t n

no a s ฺ a h ) de The attachment is added to an m external i u o reference in composite.xml. ฺc andnttheG m Result: Identity is propagated, b nฺi Stude payload is encrypted. 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 the policy attachment fragment for the following scenario: i l K The example in the slide R A N KO• The scenario: SAML-based identity assertion. In this case:

The policy enables SAML token population for outbound SOAP requests by using the mechanisms described in WS-Security 1.0 - A SAML token is included in the SOAP message for use in SAML-based authentication with the sender vouching confirmation The result: Identity is propagated and the payload is encrypted. The policy: oracle/wss10_saml_token_client_policy -

• •

Note: This policy can be applied to any SOAP-based reference.

Oracle SOA Suite 12c: Build Composite Applications 15 - 24

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

Attaching a Policy to an Outbound Request by Using Oracle JDeveloper 12c 1 3

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 ceexternal reference, perform the following steps: i l K To attach a policy to an R A N O 1. Right-click the external reference and select Configure WS-Policies. 2

K

2. Click the Add icon for the type of policy. 3. Select the relevant policy to attach.

Oracle SOA Suite 12c: Build Composite Applications 15 - 25

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

Managing SOA Composite Application Policies

Policies page

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 ctoe the delivery of messages. You can attach security policies to and i l K Policies apply security ARsecurity policies from the currently deployed SOA composite applications. detach N KO Specify the component to which the policy is to be attached.

To manage SOA composite application policies, perform the following steps: 1. On the Oracle Enterprise Manager home page, expand the soa-infra > SOA folders, and click a SOA composite application link. 2. On the SOA composite home page, click the Policies tab. Note: The Policies page enables you to attach policies to and detach policies from the web service binding components and the service components of the SOA composite application. The policies table displays the attached policy name, the component to which the policy is attached, the policy reference status (enabled or disabled) that you can toggle, the category (Management, Reliable Messaging, MTOM Attachment, Security, or WS Addressing), any violations, and all authentication, authorization, confidentiality, and integrity failures since the SOA Infrastructure was last restarted. 3. On the Policies page, click Attach To/Detach From. 4. Select the component to which to attach or from which to detach a policy. This invokes a dialog box for attaching or detaching policies.

Oracle SOA Suite 12c: Build Composite Applications 15 - 26

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

Managing SOA Composite Application Policies

Attach the policy.

le

Execute the validation test.

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 ceare appropriate to your environment, and then click Attach. i l K 5. Select policies that R NANote: Attach additional policies as required.

KO6.

When you have finished attaching policies, click Validate. Note: If an error message appears, make the necessary corrections until you no longer have any validation errors. 7. Click OK.

Oracle SOA Suite 12c: Build Composite Applications 15 - 27

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

Summary In this lesson, you should have learned how to: • Describe Web Service Security • Describe Oracle Web Services Manager and its use in securing SOA composites • Discuss security and identity propagation in SOA composites e • Attach security policies to endpoints at design time and runrabl fe s time n 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 RK

A

N KO

Oracle SOA Suite 12c: Build Composite Applications 15 - 28

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

Practice 15 Overview

wss_username_token_service_policy

wss11_saml_token_client_policy

Enrollment

Enroll

Enrollment BPEL

BookingSystem

BookingService

booking_client_ep

le

b a r e f

s

an r t n

no a Propagate security identity. as h deฺ ) om t Gui c ฺ m wss11_saml_token_service_policy n b e i Receive security identity. ฺ 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 is to implement security on the endpoints of composite applications, K The goal of this practice R such NAas the Enrollment and BookingService interactions. O K

In this practice, you perform the following tasks: • Apply the UsernameToken security to the Enrollment composite application, which requires an authenticated username and password to be provided in the WS-Security headers from its client. After receiving valid credentials, the policy sets the security identity. • Attach a SAML client policy to the BookingService external reference, which propagates the security identity to the BookingSystem composite application entry point. • Enforce a SAML service policy on Booking_client_ep, which is the entry point to the BookingSystem composite application and which requires valid security credentials to be provided to allow the invocation to proceed. You first attach the security policies to the deployed applications by using Oracle Enterprise Manager. After detaching the policies, you repeat the process at design time by attaching the policies to the endpoints, in JDeveloper, and deploy the applications. You then deploy the applications with the security policies disabled.

Oracle SOA Suite 12c: Build Composite Applications 15 - 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ฺ

Request-Response Patterns

le

s

b a r e f

Appendix A

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

an r t n

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

Request-Response Patterns The following request-response patterns are covered in this appendix: • One-Way Message • Synchronous Interaction • Asynchronous Interaction • Asynchronous Interaction with Timeout ble a • Asynchronous Interaction with a Notification Timer r fe s n • One Request, Multiple Responses tra n no • One Request, One of Two Possible Responses a s ฺ a h • One Request, a Mandatory Response, and an e Optional ) d i m u Response ฺco t G

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 Request-response patterns are used to facilitate communication between the components of R A aN Business Process Execution Language (BPEL) process. The request-response operation KOincludes one input element (the request) followed by one output element (the response).

Note: The request-response patterns listed in the slide are discussed on the remaining pages of this appendix.

Oracle SOA Suite 12c: Build Composite Applications A - 2

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

One-Way Message Interaction Request

Pattern:

No response Service client

Service

Some SOA implementations: Mediator BPEL

Routing rule Invoke

Service

le

Service

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 A one-way message interaction pattern is a special type of request-response pattern, where R A OtheNclient sends a message to the service, and the service does not need to reply. This could BPEL

Invoke

Receive

BPEL

K be used for business updates if the requester trusts the message service and the transaction not to fail. The communication pattern for the one-way message interaction involves: • A service consumer: The client that invokes the service and supplies the input message • A service provider: The service that accepts an input message from the service client, and does not provide a response (output message) The diagrams show various implementations of a one-way message interaction pattern, such as: • A Mediator component with a routing rule to a service • A BPEL component to a service

Oracle SOA Suite 12c: Build Composite Applications A - 3

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

The service that consumes the message can also be another SOA component, as shown in the BPEL to BPEL example, which contains the following implementation: • The BPEL client executes an Invoke activity to execute a one-way operation that is exposed by the partner link. • The BPEL service accepts the input message by using a Receive activity, and does not use a Reply activity because there is no response provided or expected. Note: The Web Services Description Language (WSDL) for a one-way service does not define an output message for the operation.

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 A - 4

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

Synchronous Interaction Request

Pattern: Service client

Immediate response

Service

Some SOA implementations: BPEL Mediator

request

BPEL BPEL

le

b a r e f

request

s

an r t n

Receive

Receive

no a s ฺ fault fault a h Reply Reply ) ide m u o ฺc nt G m Client Service Client Service b 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 l K In a synchronous interaction, a client sends a request to a service, and receives an immediate R A reply N or fault. KO Route

response

Invoke

response

The service can be at either end of this interaction, and is implemented based on its role as the client or the service. The image in the slide shows two diagrams of a synchronous interaction between two SOA components. • A BPEL process component client with a BPEL process component service - The BPEL client contains an Invoke to manage the request-response cycle. - The BPEL service contains a Receive to obtain the request message, and then after some processing, return a response by using a Reply, or throw a fault condition. • A Mediator component client with a BPEL process service - The client contains a synchronous route to send the request to a BPEL service, and receive the response or fault. - The BPEL service contains a Receive to obtain the request message, and then after some processing, return a response by using a Reply, or throw a fault condition.

Oracle SOA Suite 12c: Build Composite Applications A - 5

Note: A synchronous service may optionally generate an error message (or fault) as a response.

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

Whether the BPEL and Mediator clients are in the same SOA Composite or different ones, the integration pattern remains the same.

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 A - 6

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

Asynchronous Interaction Request

Pattern: Service client

Delayed response

Service

Some SOA implementations: Client

Service BPEL

Mediator

Client

Service

BPEL

BPEL

le

b a r e f

request

request

Receive

s

an r t n

Receive

Invoke

no a response s ฺ a h ) Invoke Receive ide Invoke m u o c G ฺ m ent ProcessOrder CheckInventory 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 linteraction, a client sends a request to a service and waits until the K In an asynchronous R service NA replies. O K Route

response

The image in the slide shows two diagrams of an asynchronous interaction between two SOA components. • A BPEL process component client with a BPEL process component service - The BPEL client contains an Invoke to initiate the request and do some processing, and a Receive to obtain the response. - The BPEL service contains a Receive to obtain the request message, and then after some processing, return a response by using an Invoke to the client callback port. • A Mediator component client with a BPEL process service - The client contains an asynchronous route to send the request to a BPEL service, and wait for a response. - The BPEL service contains a Receive to obtain the request message, and then after some processing, return a response by using an Invoke to the client callback port. Note: An asynchronous service would return errors as another response message. Oracle SOA Suite 12c: Build Composite Applications A - 7

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

One Request, Multiple Responses Request

Pattern: Service client

Multiple responses

Service

SOA implementation: BPEL

BPEL request

Invoke

Receive response1

Receive

le

b a r e f

s

Invoke

an r t n

no a Sequence s a ฺ Receive ) h ide Invoke m u response3 ฺco G t m en b i ฺ in Stud Invoke Service Receive Client @ 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 the client sends a single request to a service, and receives multiple K In this R interaction type, NA in return. For example, the request can be to order a product online, and the first Oresponses Sequence

response2

K response can be the estimated delivery time, the second response can be payment

confirmation, and the third response can be a notification that the product has been shipped. In this example, the number and types of responses are expected. • The BPEL Process client: When the BPEL process is on the client side of this transaction, it needs an Invoke activity to send the request, and a sequence activity with three Receive activities, one for each reply. • The BPEL Process service: The BPEL service needs a Receive activity to accept the message from the client, and a sequence attribute with three Invoke activities, one for each reply. Note: As with all partner activities, the WSDL file defines the interaction.

Oracle SOA Suite 12c: Build Composite Applications A - 8

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

One Request, a Mandatory Response, and an Optional Response Request

Pattern: Service client

Delayed response and optional response

SOA implementation: BPEL

Service

Service BPEL Client request

Invoke

Receive Delay?

Optional response

Otherwise

s

an r t n

Switch

le

b a r e f

no a s ฺ When a h ) ide product responseom u ฺc nt G ships m b e i ฺ Invoke B Receive B 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 the client sends a single request to a service, and receives one or K of interaction, In this R type A OtwoNresponses. Here, the request is to order a product online. If the product is delayed, the Scope

onMessage A

Notify user of delay

Invoke A

K service sends a message to inform the customer. In any case, the service always sends a

notification when the item ships. • The BPEL Process client: When the BPEL process is on the client side of this transaction, it needs a Scope activity containing the Invoke activity to send the request, and a Receive activity to accept the mandatory reply. The onMessage handler of the Scope activity is set to accept the optional message and instructions on what to do if the optional message is received (for example, notify you that the product is delayed). The client BPEL process waits to receive the mandatory reply. If the mandatory reply is received first, the BPEL process continues without waiting for the optional reply. As with all partner activities, the WSDL file defines the interaction. • The BPEL Process service: The BPEL service needs a Scope activity containing the Receive activity and an Invoke activity to send the mandatory shipping message, and the Scope activity’s onAlarm handler to send the optional delayed message if a timer expires (for example, send the delayed message if the item is not shipped in 24 hours).

Oracle SOA Suite 12c: Build Composite Applications A - 9

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

The image in the slide shows a diagram of what happens when one request results in a mandatory response and an optional response. The following actions take place: 1. The client BPEL process has a Scope activity and an onMessage A attribute. The Scope activity has a call service Invoke activity to send the request to the service BPEL process, and wait for a callback Receive activity for the callback. 2. The client call service Invoke activity sends a request to the service BPEL process by way of a WSDL partner link. 3. The service BPEL process has the following activities: - A Receive activity to receive the client’s response - A Switch activity containing logic to either delay a response or not - An Invoke activity to send the mandatory response back to the client 4. If the product is delayed, the Switch activity in the service selects Message A and sends it to the wait for a callback Receive activity in the client BPEL process. 5. When the product ships, the Invoke activity sends Message B to the wait for a callback Receive activity in the client BPEL process.

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 A - 10

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

Asynchronous Interaction with Timeout Pattern Request

Pattern: Service client

Delayed response or timeout

Service

SOA implementation: BPEL

request

Invoke

BPEL

le

Receive

b a r e f

s

an r t n

no a response s ฺ a h e ) idInvoke m u o ฺc nt G m onAlarm onMessage b Client Service nฺi Stude i Timeout logic logic @ 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 linteraction with a timeout, a client sends a request to a service and waits K In an asynchronous R until NAit receives a reply, or until a certain time limit is reached, whichever comes first. O K Pick

The sample implementation in the slide shows: • A BPEL process client, which uses an Invoke to send an asynchronous request to the service, and a Pick activity with: - An onMessage branch to receive the response (callback) - An onAlarm branch to manage the timeout condition if it occurs before the response is received Note: If the response comes after the time limit has expired, the message goes to the dead letter queue. • A BPEL Process service that contains a Receive to obtain the request message, and then after some processing, return a response by using an Invoke to the client callback port Note: As with all partner activities, the WSDL file defines the interaction.

Oracle SOA Suite 12c: Build Composite Applications A - 11

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

Asynchronous Interaction with a Notification Timer Pattern Pattern:

Request

Service client

Delayed response with timeout

Service

SOA implementation: BPEL

BPEL

le

b a r e f

request

Invoke

Notify someone when a timeout occurs.

s

an r t n

Receive

no a Scope response as h deฺ ) om t Gui Invoke Receive c ฺ m en b i ฺ Client Service in Stud @ 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 linteraction with a notification timer, a client sends a request to a service K In an asynchronous R and waits for a reply, although a notification is sent after a timer expires. The client continues NA O K to wait for a reply from the service even after the timer has expired. onAlarm

The BPEL Process client: When the BPEL process is on the client side of this transaction, it needs a Scope activity containing an Invoke activity to send the request, and a Receive activity to accept the reply. The onAlarm handler of the Scope activity has a time limit and instructions on what to do when the timer expires. For example, wait 30 minutes, and then send a warning indicating that the process is taking longer than expected. As with all partner activities, the WSDL file defines the interaction. • The BPEL Process service: As with a synchronous transaction, when the BPEL process is on the service side of an asynchronous transaction, it needs a Receive activity to accept the incoming request, and an Invoke activity to return either the requested information or a fault. Note: This pattern makes use of the onAlarm branch in a Scope. •

Oracle SOA Suite 12c: Build Composite Applications A - 12

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

One Request, One of Two Possible Responses Pattern:

Request

Service client

Delayed response A or response B

Service

SOA implementation: Client

BPEL

Service BPEL

request

Item in stock?

le

b a r e Otherwise sf n a n-tr

Receive

Invoke

no Switch a s ฺ a h ) ide m u o response A G ฺc ntInvoke onMessage onMessage Invoke m b e B A A B i ฺ d n S u i t response B 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 cone i l K In an interaction using request and one of two possible responses, the client sends a R A single N request to a service and receives one of two possible responses. For example, the KOrequest can be to order a product online, and the first response can be either an in-stock Pick

message or an out-of-stock message. The diagram in the slide provides an overview. • The BPEL Process client: When the BPEL process is on the client side of this transaction, it needs the following: - An Invoke activity to send the request - A Pick activity with two branches: one onMessage for the in-stock response and instructions on what to do if an in-stock message is received, and a second onMessage for the out-of-stock response and instructions on what to do if an outof-stock message is received • The BPEL Process service: The BPEL service needs a Receive activity to accept the message from the client. It also needs a Switch activity with two branches: one with an Invoke activity that sends the in-stock message if the item is available, and a second branch with an Invoke activity that sends the out-of-stock message if the item is not available. Note: As with all partner activities, the WSDL file defines the interaction.

Oracle SOA Suite 12c: Build Composite Applications A - 13

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

The image in the slide shows a diagram of what happens when a request results in one of two possible responses. The following actions take place: 1. The client BPEL process has a call service Invoke activity to send a request to the service BPEL process, and a Pick activity to select from the responses. 2. The client BPEL process’s call service Invoke activity sends a request to the service BPEL process by using a WSDL partner link. 3. The service BPEL process has a Receive activity and a Switch activity. The Receive activity receives the client’s request (from the call service Invoke activity) and sends its data to the Switch activity. 4. The Switch activity performs either of the following actions: - If the item is in stock, it invokes Message A. - If the item is not in stock, it invokes Message B. 5. Then the Switch activity sends either Message A or Message B back to the client. 6. The Pick activity in the client BPEL process receives either Message A or Message B, and depending on the message, its branches do the following: - If Message A is sent, the onMessage A branch handles the response. - If Message B is sent, the onMessage B branch handles the response.

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 A - 14

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

Multiple Requests, Multiple Responses Multiple Requests

Pattern: Service client

Multiple responses

Service 1

SOA implementation: Service Client

BPEL Service 2

le

Flow

BPEL

BPEL

request

request

b a r e f

s

an r t n

noReceive a s ฺ a h ) responseide response m u o c G ฺ t m en Invoke Invoke Receive ฺib Receive d n u i t Service 2 Service 1 @ 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 licethe client sends multiple requests to multiple services and receives K J type, In this R interaction NA responses in return. As shown in the slide, the service client (which is a BPEL Omultiple Receive

Invoke

Invoke

K process) uses a parallel flow to coordinate the request and response interactions from two

different services. In this case, two asynchronous callbacks execute in parallel context, so that each callback does not have to wait for the other to complete. However, the flow does not complete until all responses are received. An example of such request-response pattern is implemented in the purchase order course application where the fulfillment process sends a request to determine stock availability in two different stores, an internal and an online store. The process waits for both responses before it chooses the store that is used to acquire the stock to fulfill the order for shipment purposes. Another example is a loan broker process that requests and retrieves loan offers from multiple loan service providers. Note: If the invoked service interface definitions are identical, the pattern could be modified into a dynamic invocation pattern.

Oracle SOA Suite 12c: Build Composite Applications A - 15

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

Multiple Requests, First Response Multiple Requests

Pattern: Service client

Pick first response?

Service 1

SOA implementation: Service Client

BPEL Service 2

Flow

BPEL request

BPEL request

le

b a r e f

s n a r -t Invoke Receive Receive Invoke n o an s a eฺ h ) First m response uid Pick ฺco response G m Bent Invoke Invoke onMessage A ฺib onMessage d n u i t Service 1 Service 2 @ 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 licethe client sends multiple requests to different services and expects to K J type, In this R interaction NA multiple responses. However, to implement the first message response pattern, a Pick Oreceive

K activity is used to receive the first of many possible responses, because a Pick processes only the first message to be received for any of its onMessage branches.

As shown in the slide, the service client (which is a BPEL process) uses a parallel flow to initiate asynchronous requests for two different services. Instead of using two asynchronous callbacks in parallel flow, when the flow is completed, a Pick activity is used to wait for all possible responses, in this case, one of two responses. The first response to arrive is processed, from service 1 (as shown in the diagram), and the other response message is not processed because Pick has completed and the service client process continues without waiting for additional responses.

Oracle SOA Suite 12c: Build Composite Applications A - 16

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

BPEL Deployment Descriptor Properties Deployment properties are BPEL process component settings that are used at run time. The two types of properties are: • Configuration properties Updates properties at run time • Partner link binding properties Note: Properties are defined in the composite.xml file. Defines properties

JDeveloper

Packaged composite.xml

le

b a r e f

Deployed

SOA Archive

s n a r -t nFusion

no Middleware a s ฺ Control a ... h ) ideBPEL m u o ฺc nt G true m Engine 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 cBPEL i l K There are two types of deployment descriptor properties: R A N KO• Configuration properties, which are specific properties used by the BPEL Engine,

Enterprise Manager, or both. The server provides some predefined configuration properties. Refer to the Oracle Fusion Middleware Developer’s Guide for SOA Suite 12c for more information about configuration properties. • Partner link binding properties, which are used by BPEL process designers to externalize literal values from a process. For example, you may define a minimum credit rating that a customer must have before processing the order. You define partner link binding properties on the Properties tab of the Edit Partner Link window. The illustration shows a configuration property called inMemoryOptimization being defined at design time by using the JDeveloper BPEL Editor. Properties are saved as namevalue pairs in elements in the deployment descriptor, which is stored in the composite.xml file that is packaged in the SOA archive.

Oracle SOA Suite 12c: Build Composite Applications A - 17

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

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF