1e. working with mediator components

Upload: sanmaya-prakash-mishra

Post on 03-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 1E. Working With Mediator Components

    1/49

    1

    109

    207

    246

    Dark 1

    255

    255

    255

    Light 1

    131

    56

    155

    Dark 2

    0

    99

    190

    Light 2

    85

    165

    28

    Accent 1

    214

    73

    42

    Accent 2

    185

    175

    164

    Accent 3

    151

    75

    7

    Accent 4

    193

    187

    0

    Accent 5

    255

    221

    62

    Accent 6

    255

    255

    255

    Hyperlink

    236

    137

    29

    FollowedHyperlink

    127

    175

    221

    Tata Blue 50%

    203

    215

    238

    Tata Blue 25%

    179

    149

    197

    Purple 50 %

    212

    195

    223

    Purple 25 %

    255

    242

    171

    Yellow 50 %

    255

    249

    213

    Yellow 25 %

    229

    205

    186

    Brown 50 %

    248

    241

    235

    Brown 25 %

    180

    213

    154

    Green 50 %

    214

    231

    200

    Green 25 %

    241

    240

    202

    Light Green 50%

    251

    251

    241

    Light Green 25%

    Title and Content

    Working with Mediator Components

    August 2012

  • 8/12/2019 1E. Working With Mediator Components

    2/49

    22

    Objectives

    2

    After completing this lesson, you should be able to:

    Describe the Mediator component

    Create a Mediator component

    Add Routing Rules

    Create XSL Transformations with the XSLT Mapper

    Create content-based routing filters

  • 8/12/2019 1E. Working With Mediator Components

    3/49

    33

    Part 1: Core Mediator Functionality

    3

    This part of the lesson covers:

    Capabilities of the Mediator component

    Creating, deleting, and modifying Mediator components

    Creating Routing Rules and setting their properties

    Part 2 covers XSL Transformations in the context of Mediatorcomponents.

  • 8/12/2019 1E. Working With Mediator Components

    4/49

    44

    Introducing Mediator Components

    A Mediator component: Routes data between a service client and target services within a

    composite application

    Defines one or more routing rules that can:

    Filter data

    Transform data Validate data

    Manages events as a:

    Subscriber

    Publisher

  • 8/12/2019 1E. Working With Mediator Components

    5/49

    55

    Describing Features of Mediator Components

    To facilitate the integration between clients and target services,Mediator components provide the following features:

    Routing Rules

    Content-based and header-based routing

    Synchronous and asynchronous interactions

    Transformations Validations

    Error management

    Event Handling

    Integration patterns, such as service virtualization

  • 8/12/2019 1E. Working With Mediator Components

    6/49

    66

    Routing Rules

    Routing Rules implement the mediation logic executed to move datafrom a source to a target. Routing rules:

    Implement data interactions or exchanges

    Define properties that affect the data (validation, filters,

    transformations)

  • 8/12/2019 1E. Working With Mediator Components

    7/49

    77

    Synchronous and Asynchronous Interactions

    Mediator components supports:

    Synchronous (request-reply) interactions

    Asynchronous interactions

    One-way, no response

    Two-way, callback response

    Note: Events are one-way (fire-and-forget) asynchronous interactions

  • 8/12/2019 1E. Working With Mediator Components

    8/49

    88

    Content-Based and Header-Based Routing

    Mediator Routing Rules provides a filter mechanism that defines

    conditions based on message content (payload) and message headers.

  • 8/12/2019 1E. Working With Mediator Components

    9/49

    99

    Validations

    Mediator Routing Rules provides support for validating theincoming message payload using a schematron or an XSD file.

    Use an XSD file for structural validation.

    Use a schematron (.sch) file for semantic validation.

    Note: Enabling validation incurs some overhead.

  • 8/12/2019 1E. Working With Mediator Components

    10/49

    1010

    Error Management

    Mediator components make use of support for fault policybased error

    handling, provided by the Oracle SOA Suite 11gservice infrastructure.

  • 8/12/2019 1E. Working With Mediator Components

    11/49

    1111

    Event Handling

    Mediator components provide support for subscribing to or raising

    business events delivered through the Oracle SOA Suite 11g Event

    Delivery Network (EDN).

    An Event is a message structure defining an occurrence of a

    business event to be communicated to other applications.

    A Business Event defines the occurrence and structure of

    an event when it occurs.

  • 8/12/2019 1E. Working With Mediator Components

    12/49

    1212

    Quiz

    Which Mediator Component feature enables target services to receive data

    in their desired format?

    a. Filter expression

    b. XSL Transformation

    c. Validation

    d. Routing rule

  • 8/12/2019 1E. Working With Mediator Components

    13/49

    1313

    Service Virtualization

    Mediator components provide service virtualization within a composite

    application allowing you to separate a client from a physical

    implementation accessing a target service.

  • 8/12/2019 1E. Working With Mediator Components

    14/49

    1414

    Creating a Mediator Component

  • 8/12/2019 1E. Working With Mediator Components

    15/49

    1515

    Effects of Creating a Mediator Component

    1

    Adding a Mediator component to a composite creates:

    A element in the composite.xml The following files in the project:

    A .componentType file

    A .mplan file

    A .wsdl file, if defined

  • 8/12/2019 1E. Working With Mediator Components

    16/49

    1616

    Deleting a Mediator Component

    Delete a Mediator component by one of the following methods:

    Right-click the Mediator component and select Delete.

    Select the Mediator component and click the Delete Selected Items icon.

  • 8/12/2019 1E. Working With Mediator Components

    17/49

    1717

    Mediating Services and Events

    Creating the Mediator component implementation involves:

    Associating inbound service operations or event subscriptions to thecomponent

    Specifying the targets for outbound service operations or publishing of

    event through Routing Rules.

  • 8/12/2019 1E. Working With Mediator Components

    18/49

    1818

    Modifying a Mediator Component

    Modifying a Mediator component can be done: Explicitly by double-clicking the Mediator component icon

    (right-clicking and selecting Edit) in the Composite Editor window

    and making changes in the Mediator Editor

    Implicitly in the Composite Editor window, by wiring other

    components to the Mediator component, or wiring the Mediator

    component to other components

  • 8/12/2019 1E. Working With Mediator Components

    19/49

    1919

    Editing a Mediator Component

    After creating additional database connections, redeploy the

    database adapter to make configurations changes active.

  • 8/12/2019 1E. Working With Mediator Components

    20/49

    2020

    Types of Mediator Routing Rules

    Mediator provides the following types of routing rules:

    Static Routing Rules, for events, synchronous, andasynchronous interactions

    Dynamic Routing Rules, for asynchronous interactions

  • 8/12/2019 1E. Working With Mediator Components

    21/49

    2121

    Adding a Routing Rule for the Echo Option

  • 8/12/2019 1E. Working With Mediator Components

    22/49

    2222

    Adding a Routing Rule to Publish an Event

  • 8/12/2019 1E. Working With Mediator Components

    23/49

    2323

    Creating the Published Event

  • 8/12/2019 1E. Working With Mediator Components

    24/49

    2424

    Adding a Dynamic Routing Rule

  • 8/12/2019 1E. Working With Mediator Components

    25/49

    2525

    Configuring a Routing Rule

  • 8/12/2019 1E. Working With Mediator Components

    26/49

    2626

    Sett ing the Target Service

    One way to set the target of a Routing Rule is to click the

    Browse for target service operations icon for an existing Routing Rule,and select a new Target Type.

    Other ways to set the target are:

    Wiring a Mediator component to another component or service

    reference

    Adding a Routing Rule and selecting the Target Type

  • 8/12/2019 1E. Working With Mediator Components

    27/49

    2727

    Handling Synchronous and Asynchronous

    Responses and Faults

    Handling response and fault messages depends on whether the

    interactions are synchronous or asynchronous.Synchronous and asynchronous interactions can:

    Specify transformations and assignments for the request and response

    messages

    Return a fault or response to the caller, if one is expected

    Forward fault or response message to a service or event

    Note: Only asynchronous interactions can specify a timeout.

  • 8/12/2019 1E. Working With Mediator Components

    28/49

    2828

    Configuring Message Filters

    To create a message filter:

    1. Click the filter (Invoke Expression Builder) icon.

    2. In the Expression Builder window, build the conditional expression.

  • 8/12/2019 1E. Working With Mediator Components

    29/49

    2929

    Configuring Validation

    You can apply two types of message validation:

    Syntactic validation based on an XSD for all messages Semantic (Schematron) validation for selected messages

  • 8/12/2019 1E. Working With Mediator Components

    30/49

    3030

    Sequential and Parallel Routing Rules

    Sequential and parallel execution enables you to manage

    transactional semantics.

    Sequential Routing Rules execute in a single thread,

    before parallel rules. Exceptions roll back all transactions.

    Parallel Routing Rules execute in their own threads. Exceptions roll back

    transactions in their own thread.

  • 8/12/2019 1E. Working With Mediator Components

    31/49

    3131

    Part 2: XSL Transformations

    This section of the lesson covers using the XSLT Mapper to transform

    messages using: Simple mapping with and without functions

    Auto Map capabilities

  • 8/12/2019 1E. Working With Mediator Components

    32/49

    3232

    Configuring Transformations

    To apply a transformation:1. Click the Transformation icon.

    2. In the Request Transformation Map window, you can:

    Browse for an existing XSL file.

    Create a new XSL file.

    3. On the XSLT Mapper window, drag source element to target

    elements to define mappings.

  • 8/12/2019 1E. Working With Mediator Components

    33/49

    3333

    Editing with the XSLT Mapper

    The XSLT Mapper:

    Enables visual construction of XSL Transformations

    Provides tools and built-in functions to quickly create maps

  • 8/12/2019 1E. Working With Mediator Components

    34/49

    3434

    Mapping Types and Tools

    The XSLT Mapper enables:

    Defining simple mappings Defining more complex mappings that use and chain built-in or user-

    defined functions

    Mapping repeated elements with the for-each operation

    Defining conditional mapping by applying:

    The if operation

    The choose operation

    Mapping multiple elements with the Auto Map Tool that provides:

    Different Auto Map modes (basic and advanced)

    Dictionary-based mapping

  • 8/12/2019 1E. Working With Mediator Components

    35/49

    3535

    Adding a Function to a Transformation

    To apply a built-in function to a mapping rule:

    1. Drag a desired function from the Component Palette Into the middle column of the XSLT Mapper window

    Onto an existing mapping line

    2. Complete the function usage, by dragging source and

    target elements, and double-clicking the function icon.

  • 8/12/2019 1E. Working With Mediator Components

    36/49

    3636

    Modifying Function Parameters

    Double-click the function icon to edit its settings.

    In the Edit Function - window, edit parameter values

    as needed

  • 8/12/2019 1E. Working With Mediator Components

    37/49

    3737

    Chaining (Nesting) Functions

    Chaining functions is done by dragging another function:

    Onto a map line containing a function Before or after the existing function

    Note: Execution occurs from left to right.

  • 8/12/2019 1E. Working With Mediator Components

    38/49

    3838

    Mapping Nodes Automatically

    The Auto Map Preferences window:

    Appears when mappingnon-leaf (parent) nodes Attempts to map all nodesunder selected source and target

    Controls how the auto mappingis applied

    Saves settings in the XSL Map > Auto Map section in JDeveloper Tools >

    Preferences window

  • 8/12/2019 1E. Working With Mediator Components

    39/49

    3939

    Adding a For-Each Mapping Rule

    To manually insert a for-each element:

    1. Right-click a target element and select Add XSL Node > for-each

    2. Drag the repeating source element to the for-each node

    To automatically insert a for-each element, the Auto Map tool creates

    it when mapping a repeating source element to a repeating target.

  • 8/12/2019 1E. Working With Mediator Components

    40/49

    4040

    Adding an If Mapping Rule

    A simple conditional mapping rule is the if XSL node, whose

    rule is applied when its condition returns a true result

  • 8/12/2019 1E. Working With Mediator Components

    41/49

    4141

    Adding a choose Mapping Rule

    Another conditional mapping rule is the choose XSL node,

    which comprises:

    One or more when XSL nodes, whose rule is applied when its

    condition is true

    An optional otherwise XSL node, whose rule is applied if all related

    when XSL nodes are false

  • 8/12/2019 1E. Working With Mediator Components

    42/49

    4242

    Adding a Dictionary for Auto Mapping

    Dictionary files:

    Are XML files to associate words (elements) as synonyms

    Can enable mapping elements not automatically mapped by using

    default Auto Map Preferences

    Can be applied by clicking Show Dictionaries, and clicking Add

  • 8/12/2019 1E. Working With Mediator Components

    43/49

    4343

    Adding a Dictionary for Auto Mapping

    To create a dictionary XML file:

    1. Manually map elements in a source tree to their targets

    2. Right-click the middle column and select Generate Dictionary

  • 8/12/2019 1E. Working With Mediator Components

    44/49

    4444

    Quiz

    The XSLT Mapper enables defining conditional mapping by

    applying ______ and _______ XSL constructs.

    a. If

    b. Else

    c. Choose

    d. For-each

  • 8/12/2019 1E. Working With Mediator Components

    45/49

    4545

    Testing Transformation Maps

    The transformation test utility, in JDeveloper, enables:

    Generating advanced sample instances with support for arrays and

    recursive elements.

    Viewing the source XML instance and the target XML instance side by

    side, and validating them against their schemas.

    Modifying the XSL map and source instance, and rerunning the test

    without leaving JDeveloper

    Setting breakpoints and debugging XSLT by using the built-in XSLT

    debugger

  • 8/12/2019 1E. Working With Mediator Components

    46/49

    4646

    Initiating an XSL Transformation Test

  • 8/12/2019 1E. Working With Mediator Components

    47/49

    4747

    Viewing the Test Results

  • 8/12/2019 1E. Working With Mediator Components

    48/49

    4848

    Summary

    In this lesson, you should have learned how to:

    Describe the Mediator component

    Create a Mediator component

    Add Routing Rules

    Create XSL Transformations with the XSLT Mapper

    Create content-based routing filters

  • 8/12/2019 1E. Working With Mediator Components

    49/49

    4949

    Practice 6 Overview:

    Implementing Mediator Components

    This practice covers modifying POProcessing composite with a new

    Mediator component to receive the internal order and route it to theWritePOFileService enabling you to:

    Modify the XSL transformation between the Mediator components to

    calculate item totals

    Create a new XSL transformation for the routing rule to the

    WritePOFileService that calculates the order total