205
TIBCO ActiveMatrix ® Service Bus Mediation Design Guide Software Release 2.1 August 2008

Active Matrix Service Bus Design Guide

Embed Size (px)

Citation preview

Page 1: Active Matrix Service Bus Design Guide

TIBCO ActiveMatrix® Service BusMediation Design GuideSoftware Release 2.1August 2008

Page 2: Active Matrix Service Bus Design Guide

Important InformationSOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE.USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN TIBCO ACTIVEMATRIX SERVICE BUS INSTALLATION) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE BOUND BY THE SAME.This document contains confidential information that is subject to U.S. and international copyright laws and treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO Software Inc.TIB, TIBCO, TIBCO Software, TIBCO ActiveMatrix, TIBCO Adapter, Predictive Business, Information Bus, The Power of Now, TIBCO AutoMediate, AutoMediate, TIBCO Business Studio, and TIBCO ActiveMatrix BusinessWorks are either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries.All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only.THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME TIME. PLEASE SEE THE README.TXT FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM.THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.Copyright © 2005-2008 TIBCO Software Inc. ALL RIGHTS RESERVED.TIBCO Software Inc. Confidential Information

Page 3: Active Matrix Service Bus Design Guide

| iii

Contents

Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivTIBCO ActiveMatrix Service Bus Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivThird-Party Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv

Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

How to Contact TIBCO Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Overview of Mediation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Mediation Flows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Message Exchange Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Mediation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Mediation Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Designing Mediation Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Chapter 2 Working With Mediation Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Creating Mediation Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Creating a New Empty Mediation Flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Creating New Mediation Flows From Existing Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Editing Preferences of the Mediation Flow Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Mediation Flow Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Working With Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Adding Interfaces to Mediation Flows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Deleting Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Moving Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Creating Local WSDL Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Working With Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Working With Exchange Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 4: Active Matrix Service Bus Design Guide

iv | Contents

Defining Exchange Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Setting the Exchange Variable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Creating Simple Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Working With Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Adding Tasks to a Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Deleting a Task From a Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Cutting, Copying, and Pasting Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Mediation Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Working With Mediation Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Mediation Component Properties View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Working With Component Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Chapter 3 Invoke Operation Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Overview Invoke Operation Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

Configuring Invoke Operation tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Input Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Output Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Invoking Operations on Dynamic Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Chapter 4 Log Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Overview of Log Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Configuring a Log Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Configuring the Appenders and Loggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Using the bootStrap.xml File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Chapter 5 Route Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Overview of Route Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Paths and Route Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Defining a Route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

Routing Cases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Adding Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Modifying Case Names or Destinations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Moving Cases in the List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Deleting Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56Adding and Deleting Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56Mapping Data to Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Routing Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Conditions for Route Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Conditions for XPath Route Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

Changing Route Tasks to XPath Route Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 5: Active Matrix Service Bus Design Guide

Contents | v

Chapter 6 Transform Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Overview of Transform Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Example of Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Contributing Data to the Mediation Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Schema Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Qualifier Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Context Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Message Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Data/Function Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

Right-Click Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Choose Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81If Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82For Each Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Repairing Incorrect Mappings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

XPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Addressing Schema Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Evaluation Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Search Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Testing Boolean Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Chapter 7 Query Database Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

Overview of Query Database Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

JDBC Shared Resource Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

Configuring a Query Database Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Query Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Output Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Test Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Chapter 8 Dynamic Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Overview of Dynamic Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100Service Providers for Dynamic Composite References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101Configuring Dynamic Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

Configuring Dynamic Target Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 6: Active Matrix Service Bus Design Guide

vi | Contents

Marking a Target Interface as Dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Using Pattern Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Setting the Dynamic Reference Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Configuring the General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Specifying the Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

Configuring Dynamic References in Composite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Creating and Deploying Composites Used By Dynamic Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Chapter 9 Replying to Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Overview of Reply Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

Working With Reply Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Chapter 10 Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Overview of Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Throwing Faults in Mediation Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

Working With Fault Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125Catching Faults From the Target Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125Catching Faults From the Mediation Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Sending Faults to the Invoker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

Chapter 11 Custom Mediation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130Eclipse Plug-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Support Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Creating the Model Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Creating the UI Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

Writing Custom Mediation Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Accessing Information from Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Modifying the Mediation Task Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Defining a JDBC Shared Resource Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142Categorizing Custom Mediation Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144Thrown Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144Runtime Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

Creating the Runtime Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Packaging Custom Mediation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

Chapter 12 Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

Catch Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150Fault Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 7: Active Matrix Service Bus Design Guide

Contents | vii

Generate Reply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Handle Reply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Invoke Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Output Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155Log Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

Parse XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

Query Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160Query Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Output Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Test Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Render XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Decision Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Decision Input Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Send Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Fault Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Set Exchange Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Input Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Throw Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174Fault Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Mapper Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

XPath Route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176General Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176Decision Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Decision Input Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 8: Active Matrix Service Bus Design Guide

viii | Contents

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 9: Active Matrix Service Bus Design Guide

| ix

Figures

Figure 1 Mediation components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Figure 2 An example of mediation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Figure 3 The Mediation Flow Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Figure 4 Paths in a mediation flow for each message exchange pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Figure 5 Mediation exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Figure 6 Mediation Flow Editor preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Figure 7 The Properties tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Figure 8 Defining an exchange variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Figure 9 Setting the exchange variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Figure 10 The simplified schema editor dialog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Figure 11 Relationship between mediation flows and mediation composites . . . . . . . . . . . . . . . . . . . . . . . . 32

Figure 12 Configuring an Invoke Operation task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

Figure 13 The Input tab of an Invoke Operation task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Figure 14 Configuring a Log task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Figure 15 An example route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

Figure 16 Output path for a route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Figure 17 Fault path for a route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Figure 18 Adding a routing case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

Figure 19 Mapping values to variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Figure 20 Routing conditions for the Route task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Figure 21 Routing with more than one variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

Figure 22 The Input tab of a Transform task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Figure 23 A travel reservation mediation flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Figure 24 A basic mapping case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Figure 25 The XPath Editor window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Figure 26 Dragging a data element into a function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Figure 27 The completed transformation example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Figure 28 An example Choose statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 10: Active Matrix Service Bus Design Guide

x | Figures

Figure 29 Example of If statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Figure 30 Example of For Each statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

Figure 31 An example of adding a variable to a mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Figure 32 Static and dynamic binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

Figure 33 Service providers and pass-through composites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Figure 34 Locating the service name and service namespace of the service provider . . . . . . . . . . . . . . . . . 102

Figure 35 Dynamic and static target interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

Figure 36 An example of pattern variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Figure 37 Usage cases for Set Dynamic Reference task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Figure 38 Sending a reply message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Figure 39 Setting the reply message. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Figure 40 Setting the reply message. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Figure 41 Examples of where faults can occur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Figure 42 An example fault path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Figure 43 Example of configuring the Throw Fault task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

Figure 44 Configuring a Catch Fault task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

Figure 45 Removing specific faults from the target operation fault path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Figure 46 Catch Fault task for the mediation flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 11: Active Matrix Service Bus Design Guide

| xi

Tables

Table 1 General Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

Table 2 Syntax Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii

Table 3 Mediation Flow Editor preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Table 4 Buttons for creating schema elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Table 5 Icons for schema components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Table 6 Qualifier characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Table 7 Schema for message properties and message context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Table 8 Data/Function tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

Table 9 Mapper toolbar buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

Table 10 Right-click menu in the message panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Table 11 Supported SQL types and their mapping to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Table 12 Custom mediation task plug-ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Table 13 Icons for custom mediation tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

Table 14 Runtime exception handling for custom mediation tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

Table 15 Supported SQL types and their mapping to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 12: Active Matrix Service Bus Design Guide

xii | Tables

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 13: Active Matrix Service Bus Design Guide

| xiii

Preface

TIBCO ActiveMatrix is a scalable and extensible platform for developing, deploying, and managing applications that conform to a service-oriented architecture. Mediation within ActiveMatrix® allows your enterprise to easily adapt to changing requirements by providing an easy-to-use interface for managing mediation flows.

Topics

• Related Documentation, page xiv

• Typographical Conventions, page xvi

• How to Contact TIBCO Support, page xix

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 14: Active Matrix Service Bus Design Guide

xiv | Related Documentation

Related Documentation

This section lists documentation resources you may find useful.

TIBCO ActiveMatrix Service Bus DocumentationThe following documents form the ActiveMatrix Service Bus documentation set:

• TIBCO ActiveMatrix Service Bus Installation Read this manual for instructions on site preparation and installation.

• TIBCO ActiveMatrix Concepts Read this manual before reading any other manual in the documentation set. This manual describes terminology and concepts of the ActiveMatrix platform. The other manuals in the documentation set assume you are familiar with the information in this manual.

• TIBCO ActiveMatrix Administration Read this manual to learn how to manage the ActiveMatrix runtime and deploy and manage ActiveMatrix services.

• TIBCO ActiveMatrix Composite Editor User’s Guide Read this manual to learn how to develop, debug, and package ActiveMatrix composites.

• TIBCO ActiveMatrix Service Bus Getting Started Read this manual for a quick introduction to the product that walks you through a brief tutorial.

• TIBCO ActiveMatrix Service Bus Mediation Design Guide Read this manual to learn how to develop mediation flows using the Mediation Editor.

• TIBCO ActiveMatrix Service Bus Release Notes Read the release notes for a list of new and changed features. This document also contains lists of known issues and closed issues for this release.

Third-Party DocumentationTIBCO ActiveMatrix software supports the following standards:

• Service Component Architecturehttp://www.osoa.org/display/Main/Service+Component+Architecture+Specifications

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 15: Active Matrix Service Bus Design Guide

Preface | xv

• World Wide Web Consortium web services activityhttp://www.w3.org/2002/ws/

— Simple Object Access Protocol (SOAP) 1.1 W3C Notehttp://www.w3.org/TR/2000/NOTE-SOAP-20000508/

— WSDL 1.1 W3C Note http://www.w3.org/TR/wsdl

• OASIS http://www.oasis-open.org/committees/tc_cat.php?cat=ws

— UDDI Version 2 OASIS Standard http://www.oasis-open.org/specs/index.php#uddiv2

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 16: Active Matrix Service Bus Design Guide

xvi | Typographical Conventions

Typographical Conventions

The following typographical conventions are used in this manual.

Table 1 General Typographical Conventions

Convention Use

TIBCO_HOME

ENV_NAME

ENV_HOME

AMX_HOME

AMX_ADMIN_HOME

Many TIBCO products are installed within the same home directory. This directory is referenced in documentation as TIBCO_HOME. The value of TIBCO_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco.

Other TIBCO products are installed into an installation environment. A product installed into an installation environment does not access components in other installation environments. Incompatible products and multiple instances of the same product must be installed into different installation environments. An installation environment consists of the following properties:

• Name Identifies the installation environment. The name is appended to the name of Windows services created by the installer and is used in the path to the product in the Windows Start > All Programs menu. This directory is referenced in documentation as ENV_NAME.

• Description Provides information about what the environment contains or is used for.

• Path The directory into which the product is installed. This directory is referenced in documentation as ENV_HOME. The value of ENV_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco.

TIBCO ActiveMatrix installs into a directory inside ENV_HOME. This directory is referenced in documentation as AMX_HOME. The value of AMX_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco\amx\.

TIBCO ActiveMatrix Administrator installs into a directory inside ENV_HOME. This directory is referenced in documentation as AMX_ADMIN_HOME. The value of AMX_ADMIN_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco\amxadministrator\.

code font Code font identifies commands, code examples, filenames, pathnames, and output displayed in a command window. For example:

Use MyCommand to start the foo process.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 17: Active Matrix Service Bus Design Guide

Preface | xvii

bold code font Bold code font is used in the following ways:

• In procedures, to indicate what a user types. For example: Type admin.

• In large code samples, to indicate the parts of the sample that are of particular interest.

• In command syntax, to indicate the default parameter for a command. For example, if no parameter is specified, MyCommand is enabled: MyCommand [enable | disable]

italic font Italic font is used in the following ways:

• To indicate a document title. For example: See TIBCO ActiveMatrix BusinessWorks Concepts.

• To introduce new terms For example: A portal page may contain several portlets. Portlets are mini-applications that run in a portal.

• To indicate a variable in a command or code syntax that you must replace. For example: MyCommand pathname

Key combinations Key name separated by a plus sign indicate keys pressed simultaneously. For example: Ctrl+C.

Key names separated by a comma and space indicate keys pressed one after the other. For example: Esc, Ctrl+Q.

The note icon indicates information that is of special interest or importance, for example, an additional action required only in certain circumstances.

The tip icon indicates an idea that could be useful, for example, a way to apply the information provided in the current section to achieve a specific result.

The warning icon indicates the potential for a damaging situation, for example, data loss or corruption if certain steps are taken or not taken.

Table 1 General Typographical Conventions (Cont’d)

Convention Use

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 18: Active Matrix Service Bus Design Guide

xviii | Typographical Conventions

Table 2 Syntax Typographical Conventions

Convention Use

[ ] An optional item in a command or code syntax.

For example:

MyCommand [optional_parameter] required_parameter

| A logical ’OR’ that separates multiple items of which only one may be chosen.

For example, you can select only one of the following parameters:

MyCommand para1 | param2 | param3

{ } A logical group of items in a command. Other syntax notations may appear within each logical group.

For example, the following command requires two parameters, which can be either the pair param1 and param2, or the pair param3 and param4.

MyCommand {param1 param2} | {param3 param4}

In the next example, the command requires two parameters. The first parameter can be either param1 or param2 and the second can be either param3 or param4:

MyCommand {param1 | param2} {param3 | param4}

In the next example, the command can accept either two or three parameters. The first parameter must be param1. You can optionally include param2 as the second parameter. And the last parameter is either param3 or param4.

MyCommand param1 [param2] {param3 | param4}

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 19: Active Matrix Service Bus Design Guide

Preface | xix

How to Contact TIBCO Support

For comments or problems with this manual or the software it addresses, please contact TIBCO Support as follows.

• For an overview of TIBCO Support, and information about getting started with TIBCO Support, visit this site:

http://www.tibco.com/services/support

• If you already have a valid maintenance or support contract, visit this site:

https://support.tibco.com

Entry to this site requires a user name and password. If you do not have a user name, you can request one.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 20: Active Matrix Service Bus Design Guide

xx | How to Contact TIBCO Support

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 21: Active Matrix Service Bus Design Guide

| 1

Chapter 1 Introduction

TIBCO ActiveMatrix provides service mediation to aid your enterprise in adapting to a rapidly changing environment. This chapter describes service mediation.

Topics

• Overview of Mediation, page 2

• Mediation Flows, page 4

• Designing Mediation Flows, page 12

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 22: Active Matrix Service Bus Design Guide

2 | Chapter 1 Introduction

Overview of Mediation

Mediation is part of a Service Oriented Architecture (SOA) for applications. Mediation involves virtualizing and managing service interactions between communicating participants. TIBCO ActiveMatrix implements a component-based platform to implement SOA within an enterprise.

A mediation component shields service consumers from the service provider’s physical location from both the design and runtime perspective. A mediation component is responsible for delivering requests to a service provider that offers the required functionality and quality of service. Service providers can respond to requests delivered by mediation components without concern or awareness of the point of origin of the message.

Figure 1 illustrates mediation components.

Figure 1 Mediation components

One important benefit of mediation components is that these components provide a mechanism for handling changing service requirements. Mediation components allow you to provide functionality that uses and enhances existing services without changing the underlying service description. Figure 2 illustrates an example mediation component.

Service Consumers

Service

Service ProvidersMediation Components

Software Applications Component

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 23: Active Matrix Service Bus Design Guide

Overview of Mediation | 3

Figure 2 An example of mediation

The example illustrates a component that provides approvals for loan applications. The existing loan service may require credit scores, loan amount, employment history, and so on. To address the need for quick turnaround for smaller loans, you may want to provide a new service that approves loan requests for under $50,000 for all applicants with credit scores above 700. Instead of rewriting your existing service to handle new types of requests, a mediation component can accept requests that contain the appropriate information from the loan requestor and then submit the request to the appropriate service for approval.

TIBCO ActiveMatrix provides a Mediation Flow Editor that allows you to easily create mediation components that operate within the SOA-based TIBCO ActiveMatrix platform.

Loan requestor

Existing Loan Approval ServiceRequires:Loan AmountCredit ScoreEmployment HistoryInvestment Information

New Loan Approval ServiceRequires:Loan AmountCredit Score

Mediation Component

Routes all loan requests under $50K with credit score above 700 to New Loan Service. All other loan requests are routed to Existing Loan Service.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 24: Active Matrix Service Bus Design Guide

4 | Chapter 1 Introduction

Mediation Flows

A mediation flow is a graphical representation of the business logic for a mediation component. Mediation flows are created and managed within the Mediation Flow Editor in TIBCO Business Studio. Mediation flow resources are stored in the Mediation Flows special folder within a TIBCO ActiveMatrix SOA project. See TIBCO ActiveMatrix Composite Editor User’s Guide for more information about creating and managing TIBCO ActiveMatrix SOA Projects.

Figure 3 illustrates the Mediation Flow Editor.

Figure 3 The Mediation Flow Editor

A mediation flow has these parts:

• Mediation interfaces One or more mediation interfaces provide the interface for the mediation components that you expose to consumers of your applications.

• Mediation paths Depending upon the message exchange pattern of the mediation interface, there can be an input, output, and fault path from each operation in the mediation interface to operations in the target interfaces.

• Target interfaces Target interfaces are the interfaces to existing services in your enterprise that provide the implementation of the operations for the associated mediation operations.

mediation interfaces mediation paths target interfaces mediation tasks

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 25: Active Matrix Service Bus Design Guide

Mediation Flows | 5

• Mediation tasks You can place business logic on the mediation path by using mediation tasks, such as Log, Transform, or Route.

Message Exchange PatternsMediation flows support these web service message exchange patterns for mediation and target operations:

• One-way (in-only) A message consumer sends a message to a provider. In this exchange, the mediation flow only allows an input path from the mediation operation to the target operation. No output or fault paths are permitted.

• Request-response (in-out) A message consumer sends a message to a provider, and the provider sends a response message back to the consumer. In this exchange, the mediation flow has an input path for the message from the consumer to the provider, an output path for the reply message, and a fault path for any faults that are encountered during processing.

The message-exchange pattern of the mediation operation must match the message-exchange pattern of the target operation.

InterfacesWeb Service Description Language (WSDL) files define the interface to a web service. WSDL is a standard maintained by the World Wide Web Consortium, and it is beyond the scope of this manual to describe WSDL syntax and functionality in detail. You can learn more about WSDL from http://www.w3.org/TR/wsdl; there are also commercial publications about Web Services and WSDL files.

Mediation flows have two types of interfaces:

• target interfaces are interfaces to the actual services that make up your enterprise application. These interfaces are displayed on the right-hand side of a mediation flow.

To mediate different operations with a target operation of a different message exchange pattern, use the Invoke Operation and Generate Reply mediation tasks.

See Invoke Operation on page 153 and Generate Reply on page 151 for more information.

The ActiveMatrix platform imposes certain limitations on WSDL files. For information about these limitations, see the discussion about WSDL File Limitations in the TIBCO ActiveMatrix Composite Editor User’s Guide.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 26: Active Matrix Service Bus Design Guide

6 | Chapter 1 Introduction

• mediation interfaces are interfaces that you expose to the consumers of your services. Mediation interfaces can have the same number and type of operations as target operations, or they can be different from the target interfaces. These interfaces are displayed on the left-hand side of a mediation flow.

Interfaces in a mediation flow are named references to abstract web services (that is, port types) defined in a WSDL file. That is, interfaces in a mediation flow do not have a binding to a port. The WSDL files you use in a mediation flow may have concrete bindings, but the mediation flow is only concerned with receiving the message from the mediation operation, processing the message, and forwarding it to its target operation. Binding occurs when a mediation flow is placed into an ActiveMatrix mediation component using the Composite Editor. See Mediation Components on page 32 for more information about components.

You can add the same interface more than once to either the mediation or target interface list. Adding the same interface multiple times to the mediation interfaces list enables you to offer the same interface to consumers with different mediation implementations. This functionality can be used to offer different qualities of service to different consumers of the service. Adding the same interface multiple times to the target interfaces list allows you to bind the same interface to different providers, if you have more than one provider of the same service.

Planning Target and Mediation Interfaces

Designing a mediation flow requires that you plan how your services will be exposed by mediation interfaces. You may have a one-to-one mapping of target and mediation interfaces, or you may expose mediation interfaces that are very different from your target interfaces. The requirements of your application will drive the design of your mediation flows.

For example, you may have target services that are purchased from a third-party and therefore you cannot alter the target interfaces. In this case, if you want to offer a service that uses the third-party services but has different operations and message schemas, you must create your own interface/WSDL file describing the service you want to offer and use that interface file as the mediation interface.

Before starting your project, you should consider the requirements of your application, plan and develop the required interfaces, and determine how the mediation interfaces will use the target interfaces.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 27: Active Matrix Service Bus Design Guide

Mediation Flows | 7

PathsEach incoming message for an operation in a mediation interface follows an input path to a target operation or a task that terminates the input path. Depending on the message exchange pattern, there could also be an output path for reply messages and a fault path for fault messages.

Figure 4 illustrates the paths in a mediation flow. For operations that use the one-way message exchange pattern, there is only an input path from the mediation operation to the target operation. For operations that use the request-response message exchange pattern, there is an input path, an output path and a fault path. Fault paths handle faults wherever they occur in a mediation flow — either during processing within the mediation flow or during processing by the target operation.

Figure 4 Paths in a mediation flow for each message exchange pattern

The Mediation Flow Editor allows you to view the input, output, and fault paths for an operation by selecting the mediation operation, and then clicking on the appropriate button in the mediation paths area of the editor. Only the path for the currently selected mediation operation is displayed in the mediation paths area.

When the input path for a mediation operation is defined or altered, the output and fault paths are automatically changed to reflect the input path. Output or fault messages must be returned to the original invoker, so the input, output, and fault paths are automatically kept compatible.

Target Interface

OperationA Mediation Interface

Operation1

Request-Response Message Exchange Pattern

Input Path

Output Path

Target Interface

OperationA Mediation Interface

Operation1

One-Way Message Exchange Pattern

Input Path

Fault Path

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 28: Active Matrix Service Bus Design Guide

8 | Chapter 1 Introduction

Route tasks allow the mediation path to be split into multiple sub-paths to potential target operations. While the path displays multiple potential destinations, each message is only ever sent to one destination. The path displayed in the Mediation Flow Editor is like a map that describes the potential places where a message can go. However, when the mediation flow is executed, each message travels to only one target operation—or, if the Generate Reply task is used, to no destination.

Mediation Tasks Mediation tasks can be placed on input, output, or fault paths to perform business logic required by your application. For example, if the schema of the input message of your mediation operation does not match the schema of the input message of the target operation, you can use a Transform task to alter the schema to the desired format.

These mediation tasks are available in the Mediation Flow Editor:

• Set Exchange Variable The Set Exchange Variable task sets the value of the items within the exchange variable. The Input tab of the Set Exchange Variable task is a mapper panel that allows you to set the exchange variable for the currently selected operation. See Setting the Exchange Variable on page 25, and Set Exchange Variable on page 172 for more information.

• Invoke Operation The Invoke Operation task allows you to invoke an operation of an interface in the target interface list during processing of an input, output, or fault path. For example, you can invoke an operation on the input mediation path and use the data in the reply message in subsequent tasks in the input path before the mediation flow invokes the specified target operation. See Chapter 3, Invoke Operation Task, on page 39.

• Log The Log task writes information to the log file. You can use this task for auditing, security, or other purposes. See Chapter 4, Log Task, on page 43 for more information about the Log task.

• Transform The Transform task takes information from the mediation exchange (described in Mediation Exchange on page 10) and alters it to the desired format. See Chapter 6, Transform Tasks, on page 63 for more information about the Transform task.

• Route and XPath Route Route tasks allow you to specify more than one potential destination for messages sent by a mediation operation. The message is sent to the appropriate target operation based on criteria you specify. In Route tasks, the criteria for routing conditions are simple comparison operations. XPath Route tasks are similar to Route tasks, but you can specify more complex criteria for routing conditions. See Chapter 5, Route Tasks, on page 49 for more information on the Route or XPath Route task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 29: Active Matrix Service Bus Design Guide

Mediation Flows | 9

• Query Database The Query Database task performs a SQL SELECT statement on a database. The task can specify one or more tables in the FROM clause of the SELECT statement, one or more columns to return in the SELECT list, and one or more conditions in the WHERE clause. You can also optionally specify the maximum number of rows to return. See Chapter 7, Query Database Tasks, on page 91 for more information.

• Set Dynamic Reference The Set Dynamic Reference task provides the values needed for resolving a service provider in a dynamic target interface. Each Set Dynamic Reference task sets the value of the service provider for the specified dynamic target interface. The value is then used by the next service invocation that refers to that dynamic target interface. See Setting the Dynamic Reference Task on page 106 for more information.

• Generate Reply and Handle Reply In some situations, you might want to send a reply message to a consumer without invoking the target operation. The Generate Reply and Handle Reply tasks allow you to bypass the target operation and send reply messages to the consumer directly from the mediation flow. See Chapter 9, Replying to Messages, on page 113 for more information on Generate Reply and Handle Reply tasks.

• Throw Fault The Throw Fault task halts processing in the current mediation flow and transfers control to the fault path. This task is useful if a mediation operation is deprecated and you want to return a fault to the requestors of the operation. This task is also useful if you want to specify fault conditions for Route or XPath route tasks. See Chapter 10, Faults, on page 119 for more information about faults and the Throw Fault task.

• Parse XML The Parse XML task is used when you have an XML document stored in a string or binary field. This task produces a tree representation of the XML that can be used by subsequent tasks in the mediation flow. This task can be paired with the Render XML task to convert the parsed XML back into a string or binary field for transmission within a message. See Parse XML on page 157 for more information.

• Render XML The Render XML task takes an XML tree for a specified schema and converts it to a string or binary element that contains the XML document. This task can be paired with the Parse XML task to convert the parsed XML back into a string or binary field for transmission within a message. See Render XML on page 164 for more information.

You can extend the functionality of mediation flows by creating your own Custom tasks. See Chapter 11, Custom Mediation Tasks, on page 129 for more information about Custom tasks.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 30: Active Matrix Service Bus Design Guide

10 | Chapter 1 Introduction

Mediation ExchangeWhen a message is received by a mediation operation, a mediation exchange is created to hold information related to the message and the mediation flow. The information in the mediation exchange is available to tasks within the mediation flow. Figure 5 illustrates the mediation exchange.

Figure 5 Mediation exchange

The mediation exchange consists of these items:

• Mediation flow properties You can define properties on a mediation flow to store information used within the flow. For example, you may create a property to store currency exchange rates or calendar holidays for system down time.

• Message context Context of the message sent to the mediation operation. Message context includes information about the message transport (for example, HTTP or JMS message headers) and security context information about the message.

• Message data Content of the message. The content of this item depends upon the processing within a mediation flow. For example, during processing of the input path, this item is the message received by the mediation operation, and the message that will be sent to the target operation. During processing of an

Mediation Exchange

Contributed data ...

Exchange variable

Message data

Message context

Mediation flow properties

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 31: Active Matrix Service Bus Design Guide

Mediation Flows | 11

output path, this item is the reply message sent by the target operation, and the message that will be sent to the client that invoked the mediation operation. During processing of a fault path, this item is the fault message. Some mediation tasks, such as Transform, can alter the contents of the message data.

• Exchange variable A defined schema to hold data that persists through all paths of a mediation operation (input, output, and fault paths). You can use any schema stored in the project to define the structure of the exchange variable. The value of the variable is set during execution of the mediation path with the Set Exchange Variable task. See Working With Exchange Variables on page 24 for more information about the exchange variable.

• Contributed data Mediation tasks, such as the Transform task or a custom mediation task, can add or contribute data to the mediation exchange. When the data is added, subsequent tasks can access each task’s contributed data. An option on some mediation tasks allows you to specify whether you want the task to alter the existing message data in the mediation exchange or place the results of the task into a new data item in the mediation exchange.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 32: Active Matrix Service Bus Design Guide

12 | Chapter 1 Introduction

Designing Mediation Flows

Designing a mediation flow generally follows this procedure:

1. Create a TIBCO ActiveMatrix SOA project and import the WSDL files.

2. Virtualize interfaces.

a. Create a mediation flow.

b. Specify the mediation and target interfaces.

c. Create mediation paths.

3. Implement mediation tasks.

a. Add/remove tasks.

b. Configure task properties.

c. Handle faults.

4. Binding and deployment.

a. Create composite and components.

b. Specify bindings.

c. Assemble and run.

You can either approach this procedure from the top down or from the bottom up. That is, you can either start with interfaces and mediation flows, or you can start by designing composites and components. If you start with interfaces, you can create mediation flows from the interfaces. If you start with components, you can assign a mediation flow as the implementation of the component after specifying the services and references in the Composite editor.

TIBCO ActiveMatrix Composite Editor User’s Guide describes the first step in the process above to create the project and obtain the interfaces. That manual also describes how to create service assemblies for deployment and execution in step 4c of the process.

Chapter 2, Working With Mediation Flows, on page 13 describes step 2 through step 4a in more detail.

TIBCO ActiveMatrix Administration describes how to deploy and run your project.

Before you package and deploy your project, make sure all validation errors are handled. For mediation interfaces that have errors, an error icon is displayed on the operation name. Errors occur because of an invalid configuration and each error is logged on the Problems tab of the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 33: Active Matrix Service Bus Design Guide

| 13

Chapter 2 Working With Mediation Flows

This chapter describes how to create and manipulate mediation flows. This chapter also describes how to work with mediation components in the Component Editor.

Topics

• Creating Mediation Flows, page 14

• Mediation Flow Properties, page 19

• Working With Interfaces, page 20

• Working With Paths, page 23

• Working With Exchange Variables, page 24

• Working With Tasks, page 30

• Mediation Components, page 32

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 34: Active Matrix Service Bus Design Guide

14 | Chapter 2 Working With Mediation Flows

Creating Mediation Flows

You create mediation flows using the mediation flow wizard. To access the wizard, select the Mediation Flows special folder in the project explorer, then right-click and choose New > Mediation Flow from the popup menu. See TIBCO ActiveMatrix Composite Editor User’s Guide for more information about folders in TIBCO ActiveMatrix SOA projects.

Before creating mediation flows, you should have at least one WSDL file that defines the target interface that you intend to mediate. The following sections describe the options for creating new mediation flows.

Creating a New Empty Mediation FlowCreating a new empty mediation flow allows you to start a mediation flow from scratch. You should at least have one WSDL file that describes the interface that you intend to mediate, but you can have zero or more target interfaces.

To create a new empty mediation flow:

1. Start the mediation flow wizard by right-clicking on the Mediation Flows special folder in the project explorer, then choose New > Mediation Flow from the popup menu.

The Create Mediation Flow dialog appears.

The default option is to create an empty mediation flow. You can also select the Create Composite checkbox if you want to create a corresponding composite for this mediation flow. See Mediation Components on page 32 for more information about working with components and composites.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 35: Active Matrix Service Bus Design Guide

Creating Mediation Flows | 15

2. Click Next.

3. Supply a name in the Mediation Flow Name field. If you chose to create a composite to correspond to the mediation flow, you can also name the composite in the Composite Name field.

You can also specify a different folder in the project for the mediation flow (and composite if one is created), if desired.

4. Click Finish.

5. At this point, the Mediation Flow Editor is displayed and you can begin to add interfaces and configure your mediation flow.

Creating New Mediation Flows From Existing Web ServicesIf you have existing web services that you would like to mediate, you can create new mediation flows for each interface. This is particularly useful if you have a large number of services and you want to create one mediation flow for each service. Before creating mediation flows, make certain your WSDL files that describe the interfaces have been imported into the project. See TIBCO ActiveMatrix Composite Editor User’s Guide for more information about importing WSDL files into projects.

To create mediation flows from existing services:

1. Start the mediation flow wizard by right-clicking on the Mediation Flows special folder in the project explorer, then choose New > Mediation Flow from the popup menu.

2. Select the option labeled Multiple mediation flows using existing web services.

You can also select the Create Composite checkbox if you want to create a corresponding composite for the mediation flow(s). See Mediation Components on page 32 for more information about working with components and composites.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 36: Active Matrix Service Bus Design Guide

16 | Chapter 2 Working With Mediation Flows

3. Click Next to select the interfaces.

4. Select the WSDL files that you want to use to create mediation flows. You can select and add WSDL files individually, or you can select a folder, then click the Add All>> button to add all WSDL files in that folder. You can also remove one or more WSDL files using the <Remove and <<Remove All buttons.

A mediation flow is created for each WSDL file. The target interface(s) and mediation interface(s) are the same, and a path is automatically created between operations of the same name. TIBCO AutoMediate™ automatically creates identical target and mediation interfaces with corresponding mediation paths for each operation. If a WSDL file includes more than one interface, each interface is added to the mediation flow created for the file.

The name of the each mediation flow is based on the name of the WSDL file. If there are conflicts in mediation flow names, a numbering scheme is used to ensure that each newly created mediation flow has a unique name.

5. If you checked the option to create a composite, click Next. Otherwise, click Finish.

6. If you checked the option to create a composite, you can configure the composite at this point. The Configure Composite Service Binding Details dialog allows you to specify whether you want a JMS or SOAP binding (or

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 37: Active Matrix Service Bus Design Guide

Creating Mediation Flows | 17

both bindings) and you can also specify the name and location of the composite.

7. Click Finish to create the mediation flows and composite.

Editing Preferences of the Mediation Flow EditorThere are some preferences in the Mediation Flow Editor that you can alter. Choose Window > Preferences to access the preferences dialog. Figure 6 illustrates the Mediation Flow Editor preferences.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 38: Active Matrix Service Bus Design Guide

18 | Chapter 2 Working With Mediation Flows

Figure 6 Mediation Flow Editor preferences

Table 3 describes each of the preferences you can set.

Table 3 Mediation Flow Editor preferences

Preference Description

Mediation Flow Name in Wizard

Specifies the default name of mediation flows that you create with the "Single empty mediation flow" option in the wizard.

Mediation Flow Folder Name Specifies the name of the folder in which to store mediation flows.

Mediation Task Icon Size You can specify whether you would like small icons or large icons to be used in mediation flows and in the palette.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 39: Active Matrix Service Bus Design Guide

Mediation Flow Properties | 19

Mediation Flow Properties

You can define properties on mediation flows to store information. For example, you may want to store values for current price markups, or currency rates, or user names. The properties you create are stored within the mediation exchange, and they can be used by tasks within a mediation flow. Properties are defined on the Properties tab of the mediation flow.

Figure 7 illustrates the Properties tab.

Figure 7 The Properties tab

To add a property, click the ellipsis (...) in the Name field, or click the Add button to the right of the table. Then specify a name, datatype, and value for the property. Properties can be one of these types:

• String

• Integer

• Boolean

To delete a property, select the property row in the table and either press the Delete key or click the Delete button to the right of the table.

Properties can also be specified when you create a mediation component. Component-level properties override the values of properties with the same name specified on the mediation flow. See Working With Component Properties on page 37 for more information about working with properties at the component level.

add a property

delete a property

click to specify the property name

use the drop-down Type list to specify the property type

type a value for the property

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 40: Active Matrix Service Bus Design Guide

20 | Chapter 2 Working With Mediation Flows

Working With Interfaces

Interfaces are defined in WSDL files. WSDL files are typically contained in the Service Descriptors special folder in a project. You can obtain interfaces in a variety of ways. Typically interfaces are obtained by importing WSDL files into a project or by using a UDDI registry service.

TIBCO ActiveMatrix Composite Editor User’s Guide describes the folders in an ActiveMatrix SOA project and how to obtain WSDL files and use UDDI registry services.

Adding Interfaces to Mediation FlowsBefore you add interfaces to your mediation flow, you should plan the needs of your application and determine which target and mediation interfaces you will need. Some planning considerations are discussed in Planning Target and Mediation Interfaces on page 6.

There are a variety of ways to add interfaces to a mediation flow, and the method you use depends upon the requirements of your application. If you plan on having a one-to-one relationship between target and mediation interfaces, you may use the technique described in Creating New Mediation Flows From Existing Web Services on page 15.

If a WSDL file contains more than one interface, you can expand the WSDL file in the project tree and drag and drop only the specific interface that you want to use into the mediation flow. You can also drag and drop the top-level WSDL file to add all interfaces within the WSDL file to the mediation flow.

If your target interfaces and mediation interfaces have different operations and schemas, drag and drop each interface from the project explorer into the appropriate area of the mediation flow.

Dragging and dropping an interface onto the mediation side creates an untargeted flow for each operation. When you select the mediation operation for an untargeted flow, the flow appears as a line ending in a question mark. You can then use a Generate Reply or Throw Fault task on the flow without having to add a target interface. You can also drag and drop an untargeted flow to a target interface and mediate that interface.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 41: Active Matrix Service Bus Design Guide

Working With Interfaces | 21

Another way to add an interface to the target or mediation interface list is to use the menu icon at the top of the Mediation Interfaces area and Target Interfaces area of the mediation flow. The menu contains an Add Mediation Interface or Add Target Endpoint item, depending upon which side of the mediation flow you use. The Add menu brings up a Select WSDL Port Type dialog where you can choose an interface to add.

AutoMediate™

The Mediation Flow Editor provides mechanisms for quickly adding identical interfaces to both the target and mediation interface sides of the mediation flow with corresponding mediation paths between operations of the same name. These mechanisms are known as AutoMediate. If you want to AutoMediate an interface, you can do one of three things:

• Drag and drop an interface to either the target or mediation interface area. Select the interface you have added to the mediation flow, then click and drag it to the opposite side of the mediation flow.

• Drag and drop an interface to the target interface area. Then, click the projection icon in the title bar of the interface.

• Drag and drop an interface onto the mediation paths area (the center area) of a mediation flow.

All the mediation operations are connected to their corresponding target operations.

Deleting InterfacesYou can delete interfaces from either side of the mediation flow by clicking the interface menu icon in the title bar of each interface and selecting Delete from the popup menu.

You can add more than one copy of the same interface to the mediation interfaces side of the mediation flow. This allows you to specify different business logic for the same interface. You can then expose each implementation of the interface to different clients. For example, you could use this functionality to offer different qualities of service to different clients.

Deleting a target interface that has one or more operations for which there are paths from mediation operations results in undefined destinations for the paths. It is necessary to fix the destinations by directing them to other operations or to Throw Fault tasks.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 42: Active Matrix Service Bus Design Guide

22 | Chapter 2 Working With Mediation Flows

Moving InterfacesYou can move interfaces within the target and mediation interface list by performing these steps:

1. Click the header of the interface you want to move.

2. Drag and drop the interface to the new location in the list of interfaces.

Creating Local WSDL FilesIf you automatically create mediation interfaces, you might want to create local copies of the WSDL files—this enables you to make changes to the copies without affecting other services or clients that might use those WSDL files.

To create a local copy of the WSDL file for your mediation interfaces:

1. In your mediation flow, locate the mediation interface you want to include in the local WSDL file.

2. Click the menu icon in the title bar of the interface and choose Copy Interface from the pop-up menu. The Mediation Flow Editor creates a local WSDL file, placing it in the same folder as the mediation flow. The name of the file is the same as the name of the mediation flow, with the file extension .wsdl.

3. To include additional mediation interfaces in the local WSDL file. Repeat step 2 for each interface. Each interface you copy is placed into the same local WSDL file. You can then edit the file using the standard WSDL editor.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 43: Active Matrix Service Bus Design Guide

Working With Paths | 23

Working With Paths

Paths are created by dragging and dropping a mediation operation onto a target operation. Paths may be automatically created in mediation flows, as described in Adding Interfaces to Mediation Flows on page 20.

Creating an input path also creates the corresponding output and fault paths. You can click on the Input, Output, and Fault icons at the top of the mediation paths area to view the corresponding path for each mediation operation.

The path for only one mediation operation is displayed in the mediation paths area. Select the mediation operation you want to view to display its path.

On the input path, there is a small circle next to the directional arrow of the path . To modify the target operation, click and drag this circle to move the path

to a different target operation. You can also change the target operation on an output path by clicking and dragging the circle next to the target operation , and the input and fault paths are automatically updated.

To delete a path, select the path then either press the Delete key, or right-click while hovering over the path and choose Delete from the popup menu.

Route tasks create sub-paths and have some additional characteristics. See Chapter 5, Route Tasks, on page 49 for more information about working with route tasks.

Mediation operations must have an input path. The input path can lead to either a Generate Reply or to a Throw Fault task. Typically the input path leads to a target operation, but there can also be a route task that splits the path into more than one destination, or the path can lead to a Throw Fault task or a Generate Reply task. If a mediation operation is not implemented—that is, if it does not have an input path—an error icon is placed in the bottom left corner of the operation’s icon. You must implement all mediation operations in a mediation flow before deploying the project.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 44: Active Matrix Service Bus Design Guide

24 | Chapter 2 Working With Mediation Flows

Working With Exchange Variables

You can define an exchange variable for each mediation operation in your mediation flow. An exchange variable provides a location that stores data for use in all paths for a particular mediation operation. For example, you might want to store a field from an incoming message, such as a correlation ID in a JMS header for the message. Once stored, this data is available for all tasks in the input, output, or fault paths of a mediation operation.

There is one exchange variable for each mediation operation, but the exchange variable can have any structure. For example, the exchange variable can have repeating elements, if it is necessary to hold multiple instances of the same element.

Once defined, the exchange variable is available for all tasks that can access the meditation exchange in the input, output, and fault paths of your mediation flow. The values of the fields of the exchange variable are empty until they are explicitly set using the Set Exchange Variable mediation task. Setting the Exchange Variable on page 25 describes this task.

Defining Exchange VariablesExchange variables are defined on the General Tab of the properties view of a mediation operation.

To define an exchange variable:

1. Select a mediation operation in the mediation editor

2. Check the box next to the Use Exchange Variable field on the General tab of the operation.

If you create the Set Exchange Variable task directly on the input path, this check box is automatically checked.

3. Specify a schema for the exchange variable in the Exchange Schema field.

Set Exchange Variable only supports XSD elements, so the schema definition for the exchange variable must be stored in an XSD within your workspace. You can locate an existing XSD with the Browse button, use the simple XSD editor to create a basic XSD with the Create button, create an XSD with the XSD editor within TIBCO Business Studio, or you can use your own XSD editor plug-in.

See Creating Simple Schemas on page 26 for more information about the Simplified Schema Editor that appears when clicking the Create button.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 45: Active Matrix Service Bus Design Guide

Working With Exchange Variables | 25

See the Eclipse documentation, XSD Developer Guide, for more information about the XSD editor within TIBCO Business Studio.

Figure 8 illustrates defining an exchange variable.

Figure 8 Defining an exchange variable

Setting the Exchange VariableThe Set Exchange Variable task sets the value of the items within the exchange variable. The Input tab of the Set Exchange Variable task is a mapper panel that allows you to set any portion of the exchange variable for the currently selected operation. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapper panel.

Each Set Exchange Variable task that attempts to set a previously set portion of the exchange variable resets the value of the entire exchange variable. You can have any number of Set Exchange Variable tasks in the input, output, or fault paths of your mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 46: Active Matrix Service Bus Design Guide

26 | Chapter 2 Working With Mediation Flows

See Set Exchange Variable on page 172 for a description of the tabs on the properties view of task.

Figure 9 illustrates the Input tab of the Set Exchange Variable task.

Figure 9 Setting the exchange variable

Creating Simple SchemasYou might need a schema for an exchange variable that is not currently stored in the project. The Create button in the Exchange Schema field brings up a simplified schema editor dialog that you can use to create basic schemas. The simplified schema editor creates and stores the XSD file for the schema you create in the desired location in the project. Figure 10 illustrates the simplified schema editor dialog.

If you are creating a complex schema, you should use the XSD editor in TIBCO Business Studio. See the Eclipse documentation, XSD Developer Guide, for more information about the XSD editor within TIBCO Business Studio.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 47: Active Matrix Service Bus Design Guide

Working With Exchange Variables | 27

Figure 10 The simplified schema editor dialog

The simplified schema editor has three fields:

• Schema — the structure of the schema. Use the buttons to the left of the field to add, move, and delete schema elements. Only elements can be created using this editor. If you must add attributes or create types, you can use the XSD editor in TIBCO Business Studio. Table 4 describes each of the buttons in the Schema field.

• Resource Name — name of the schema to create.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 48: Active Matrix Service Bus Design Guide

28 | Chapter 2 Working With Mediation Flows

• Workspace Location — the location in the current workspace where the schema will be stored. Use the Browse button to locate a folder in the current workspace.

Table 4 Buttons for creating schema elements

Button Description

Adds a group to the schema. You can specify a name for the group and the type of group from one of these options:

• sequence in order — the elements in the group must appear in the order that they are specified in the schema.

• choice of one — the group is a choice group where only one of the elements in the group can appear at a time.

• all in any order — all elements contained in the group can appear in any order.

Adds a complex element to the schema that can contain other elements. You can specify a name for the complex element, a type (from another stored schema), the minimum number of occurrences, and the maximum number of occurrences of the element.

Adds a primitive element to the schema. You can specify a name for the primitive element, a primitive type (string, integer, and so on), the minimum number of occurrences, and the maximum number of occurrences of the element.

Adds a reference element. A reference element refers to a top-level element, allowing elements to be reused by reference. References in other schema resources are automatically maintained using imports.

Note: The assumption is that a given namespace is only imported once, and is associated with a single prefix. Support for duplicate namespaces is not provided by the Simplified Schema Editor.

Move the currently selected element up one position in the schema.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 49: Active Matrix Service Bus Design Guide

Working With Exchange Variables | 29

After creating a schema, click OK to save the schema to the project. If a schema with the same name exists, a message asks for permission to overwrite it.

Move the currently selected element down one position in the schema.

Delete the currently selected element.

Table 4 Buttons for creating schema elements

Button Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 50: Active Matrix Service Bus Design Guide

30 | Chapter 2 Working With Mediation Flows

Working With Tasks

There are several operations that are the same for all tasks within a mediation flow. Most operations described in this section can be undone by using the Edit > Undo menu item. This section describes the operations that are common to all tasks.

See these chapters for more detail on how to work with each task in a mediation flow:

• Chapter 3, Invoke Operation Task, on page 39

• Chapter 4, Log Task, on page 43

• Chapter 5, Route Tasks, on page 49

• Chapter 6, Transform Tasks, on page 63

• Chapter 9, Replying to Messages, on page 113

• Chapter 10, Faults, on page 119

Also, see Chapter 12, Reference, on page 149 for more information about any tasks not mentioned in the chapters in the list above.

Adding Tasks to a PathBefore adding tasks, expand the palette on the Mediation Flow Editor to show the list of tasks available. See Figure 3 on page 4 for an illustration of the Mediation Flow Editor and the palette containing mediation tasks.

To add a task to a path, use one of these methods:

• Select the task in the palette, then click on the path line where you want to add the task.

• Drag and drop a task from the palette to a path—be sure to continue holding the mouse button down until the cursor is over the path.

When a task can be added to the path, the path line becomes bold and the cursor changes to this icon to indicate the task can be added. If the task cannot be added to the path, the cursor changes to this icon to indicate the task cannot be added. Not all tasks can be added to all paths. See the description of each task in Chapter 12, Reference, on page 149 for more information about the type of path where you can use the task.

If there are already tasks along the current path, a vertical line appears on the path to indicate where the task will be added. Move the cursor before or after the existing task to add the task to a specific location.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 51: Active Matrix Service Bus Design Guide

Working With Tasks | 31

You can add multiple tasks of the same type to the path by selecting the task in the palette then holding down the Control key on the keyboard while clicking on the path.

Route tasks cause the path to split into sub-paths. If your mediation flow requires routing, it is a good idea to add the route tasks to the path first, because it may be difficult to add a route task to a specific location once there are other tasks on the path.

Deleting a Task From a PathTasks can be deleted from paths by selecting the task in the path then right-clicking while hovering over the task and choosing Delete from the pop-up menu. Most tasks can also be deleted by selecting the task, then pressing the Delete key on your keyboard.

Deleting a route task deletes all sub-paths and tasks after the route task. See Chapter 5, Route Tasks, on page 49 for more information about manipulating route tasks.

Catch Fault, Handle Reply, and Send Fault tasks are automatically placed onto fault paths and cannot be deleted.

You can delete Throw Fault and Generate Reply tasks, but the flow will become untargeted—if you delete these tasks, you’ll need to retarget them as necessary.

Cutting, Copying, and Pasting TasksSome tasks can be copied and pasted onto the same or other paths. To cut or copy and then paste a task:

1. Select the task in the mediation flow and either press the Control and c keys on the keyboard simultaneously, or right-click over the task and select Copy from the popup menu.

If you want to cut the task from the path instead of copying, press the Control and x keys on the keyboard simultaneously, or right-click over the task and select Cut from the popup menu.

2. Select the path where you want to paste the task. The path should become bold.

3. Either press the Control and v keys on the keyboard simultaneously, or right click while hovering over the path and select Paste from the popup menu.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 52: Active Matrix Service Bus Design Guide

32 | Chapter 2 Working With Mediation Flows

Mediation Components

TIBCO ActiveMatrix Composite Editor User’s Guide gives a complete description of composites and components and how they operate within the TIBCO ActiveMatrix architecture. You should be familiar with the procedures in that manual before attempting to work with mediation components. This section describes the specific configuration options for mediation components within a TIBCO ActiveMatrix composite.

Figure 11 illustrates the relationship between elements of a mediation flow and elements of a composite.

Figure 11 Relationship between mediation flows and mediation composites

Composite

Mediation Component

Composite ReferenceComposite

Service

Composite Properties

Component Properties

ComponentService

ComponentReference

Mediation Flow

Mediation Flow Properties

Composite Reference

ComponentReference

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 53: Active Matrix Service Bus Design Guide

Mediation Components | 33

Mediation flows provide implementations for mediation components:

• Each mediation interface becomes a component service of the mediation component.

• Each target interface becomes a component reference of the mediation component.

• Each mediation flow property becomes a component property. You can override the values specified for mediation properties at the component or composite level.

• Each mediation flow’s shared resource profile becomes a component shared resource profile.

You can create wires between composite services and component services to provide bindings for mediation service consumers. You can also create wires between component references and composite references to provide bindings to actual service providers for target interfaces. You can also create wires from other component services and references to and from the component services and references for a mediation component.

Working With Mediation ComponentsWhen you develop your application, you can either begin by creating mediation flows, or you can begin by creating mediation components. You can easily add a mediation flow to a new mediation component, or you can easily generate a mediation flow from a mediation component.

To add a mediation flow to a mediation component:

• Specify the mediation flow on the Implementation tab of the component. Use the Browse button on the tab to locate the correct mediation flow.

To create a mediation flow from a component, perform one of these actions:

• Create a mediation component, then click the Generate Implementation icon on the toolbar of the properties view of the component. A new mediation flow is created in the Mediation Flows special folder for the component.

• Create a mediation component, then add either a component service or component reference to the component. A dialog appears asking you to

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 54: Active Matrix Service Bus Design Guide

34 | Chapter 2 Working With Mediation Flows

provide a name for a new mediation flow that will be added to the Mediation Flows special folder.

To create a new composite from an existing mediation flow:

• Right-click on the mediation flow in the project explorer panel then choose Mediation Flow > Generate Composite from the popup menu. A composite is created with the same name as the mediation flow.

Mediation Component Properties ViewThis section describes the tabs on the Properties view of mediation components.

General

This table lists the fields on a component’s General tab:

Services

The Services tab allows you to add component services to a component. You can use the Add and Remove buttons to add or remove component services from the list. When you select a component service, these fields describe the service:

Field Read-only? Description

Name N The name of the component.

Description N Short description of the component.

Version N The version of the component.

Type Y The component implementation type. For mediation components, this field is always set to Mediation.

Field Description

Name The name of the interface.

Description Short description of the interface.

Port Type The port type referenced by the service.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 55: Active Matrix Service Bus Design Guide

Mediation Components | 35

You can also expand each component service to view the operations within the service. When you select an operation, these fields describe the operation:

Implementation

These are the fields on a component’s Implementation tab:

References

Use the References tab to add component references to a component. You can use the Add and Remove buttons to add or remove component references from the list. When you select a component reference, these fields describe the reference:

WSDL Location The location of the WSDL file containing the port type referenced by the service. The field label is a link to the WSDL file.

Field Description

Operation Name The name of the operation.

Description Short description of the operation.

Field Description

Field Description

Mediation Flow Use the Browse button to select the mediation flow in the project that provides the implementation for this component.

Field Description

Name The name of the interface.

Port Type The port type referenced by the service.

WSDL Location The location of the WSDL file containing the port type referenced by the service. The field label is a link to the WSDL file.

Wire A link between a reference and either a component service or a composite reference. A wire is visually represented with an arrow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 56: Active Matrix Service Bus Design Guide

36 | Chapter 2 Working With Mediation Flows

Shared Resource Profiles

Shared resource profiles are defined on the mediation flow. They specify an abstract name that can be used by one or more tasks in a mediation flow to refer to a type of shared resource. The abstract name is bound to a physical resource when the SOA application is deployed. See JDBC Shared Resource Profiles on page 93 for more information about defining shared resource profiles.

You use the Shared Resource Profiles tab on the Properties view to define shared resource profiles, and to bind each shared resource profile to a shared resource configuration. Binding the profiles to a configuration makes the abstract profile concrete, so that you can test the links to the shared resources before configuring the resources for production.

Properties

See Working With Component Properties on page 37 for more information about this tab. These are the fields on a component’s Properties tab:

Field Description

Profile Name The name of the profile.

Type JDBC

Note: Only JDBC is supported in the current release.

Shared Resource for Design Testing

Type the link to the shared resource configuration.

Field Description

Name The name of the property.

Type The datatype of the property.

Binding Type The binding type of the property: Inline, Composite, or SVar.

Value The property value.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 57: Active Matrix Service Bus Design Guide

Mediation Components | 37

Appearance

These are the fields and buttons on a component’s Appearance tab.

Working With Component PropertiesA component implementation may need certain configuration properties at runtime. To add a property to a component, follow the procedures described in Mediation Flow Properties on page 19.

Displaying a Component’s Properties

To view a component’s properties, ensure that the Properties view is open and then do one of these actions:

• Double-click the Properties icon on the component.

• Click the component. In the Properties view, click the Properties tab.

Field/Button Description

Fonts and Colors Under this heading, there are two drop-down lists. The list on the left allows you to select the font used for the label of the component. The list on the right allows you to select the size of the font.

This button causes the text label of the component to be toggled between bold and non-bold.

This button causes the text label of the component to be toggled between italic and non-italic.

This button causes a popup to appear to select the color of the text label for the component.

This button causes a popup to appear to select the color of the outline of the component.

This button causes a popup to appear to select the fill color of the component.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 58: Active Matrix Service Bus Design Guide

38 | Chapter 2 Working With Mediation Flows

Binding a Property to a Value

The value of a property may be bound directly in a component configuration either inline or from a composite property or it may come from a substitution variable, which may be set at configuration time or deployment time. For information on substitution variables, see TIBCO ActiveMatrix Composite Editor User’s Guide. To bind the property value:

1. Click the component.

2. Display the component’s properties as described in the preceding section.

3. Select the row of the property to set.

4. In the Binding Type column, select the type of binding: Inline, Composite, or SVar.

5. When the binding type is Inline, enter a value in the Value column.

When the binding type is Composite or SVar, click the Ellipsis icon in the Value column to bind the property to a composite property or substitution variable. A picker appears.

a. Click the row containing the composite property or substitution variable to bind as the property value.

b. Click OK.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 59: Active Matrix Service Bus Design Guide

| 39

Chapter 3 Invoke Operation Task

The Invoke Operation task allows you call or invoke another operation and receive a reply within a mediation path. This chapter describes the Invoke Operation task.

Topics

• Overview Invoke Operation Tasks, page 40

• Configuring Invoke Operation tasks, page 41

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 60: Active Matrix Service Bus Design Guide

40 | Chapter 3 Invoke Operation Task

Overview Invoke Operation Tasks

The Invoke Operation task allows you to invoke an operation of an interface in the target interface list during processing of an input, output, or fault path. For example, you can invoke an operation on the input mediation path and use the data in the reply message in subsequent tasks in the input path before the mediation flow invokes the specified target operation.

These are examples of use cases for the Invoke Operation task:

• Invoking a service to retrieve information, such as item price for a purchase order, a zip code for a specified city, or a shipping quote from a shipping service.

• Coordination with non-automated processes, such as invoking a service to send an email message after the target operation returns a reply message.

• Basic orchestration with other services, such as invoking an approval service before invoking a target operation to allow a merchandise return.

The Invoke activity can choose any operation from any interface in the target interface list.

An invoked operation can be either one-way or request-response. If the invoked operation uses the request-response message exchange pattern, the mediation flow suspends execution until a reply is received from the invoked operation. The reply message from an invoked operation is placed in the mediation exchange in an element corresponding to the name of the Invoke Operation task. Subsequent tasks in the current path can then access the reply message.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 61: Active Matrix Service Bus Design Guide

Configuring Invoke Operation tasks | 41

Configuring Invoke Operation tasks

Invoke Operation tasks require an operation to invoke. The operation must be contained in an interface in the target interface list. The General tab of the Invoke Operation task allows you to select any of the operations of the target interfaces in your mediation flow.

Figure 12 illustrates configuring an Invoke Operation task.

Figure 12 Configuring an Invoke Operation task

After adding an Invoke task to a path, use the drop-down list in the Target Operation field on the General tab of the properties view to select an operation to invoke. You can also hold down the Shift key, then drag and drop the task onto the desired operation in one of the target interfaces.

When the Target Operation is selected for the Invoke Operation task, a green hint line appears, to illustrate the operation that the task will invoke. The line is not visible when the Invoke Operation task is not selected.

Dragging a task without the Shift key is used to arrange the tasks on a path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 62: Active Matrix Service Bus Design Guide

42 | Chapter 3 Invoke Operation Task

Input TabThe Invoke Operation task requires an input message for the invoked operation. The Input tab of the Invoke tab allows you to construct the input message. The Input tab is a mapper panel, similar to the mapper available in the Transform task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapper panel.

Figure 13 illustrates the Input tab of the Invoke Operation task.

Figure 13 The Input tab of an Invoke Operation task

Output TabWhen the message exchange pattern of the invoked operation is request-reply, the Output tab displays a static schema tree that represents the output message of the invoked operation. If the message exchange pattern of the invoked operation is one-way, the Output tab is empty.

Invoking Operations on Dynamic InterfacesYou can use the Invoke task to invoke operations contained in a dynamic target interface. Dynamic target interfaces require a Set Dynamic Reference task that specifies the actual service to invoke. See Chapter 8, Dynamic Binding, on page 99 for more information about dynamic target interfaces.

If the Invoke Operation receives a fault from the target service, the fault flow of the mediation is activated. The Catch Fault task has all target faults that might be generated by all of the invoke tasks, so you can mediate the faults that are returned.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 63: Active Matrix Service Bus Design Guide

| 43

Chapter 4 Log Task

Log tasks send information from the mediation exchange to the log file. See Mediation Exchange on page 10 for more information about the mediation exchange. This chapter describes the Log task.

Topics

• Overview of Log Tasks, page 44

• Configuring a Log Task, page 45

• Configuring the Appenders and Loggers, page 46

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 64: Active Matrix Service Bus Design Guide

44 | Chapter 4 Log Task

Overview of Log Tasks

Log tasks allow mediation flows to send data to the log file.

By default, all log entries are written to a file named AMX_HOME\data\envName\nodeName\logs\amsb_mediation_logTask.log, where envName is the name chosen for the ActiveMatrix environment during the creation of the node, and nodeName is the name of the node. The location of the log is controlled by the log4j mechanism.

You can place a log task on any input, output, or fault path. You can configure the log task to send any or all of these items to the log file:

• Mediation flow properties the properties defined for the mediation flow. These properties can be defined either on the Properties tab of the mediation flow, or in the composite or component containing the mediation flow. You can select all mediation flow properties, or you can select individual properties to log.

• Message context information about the transport or security details of the message.

• Message data the content of the message. Some tasks, such as Custom tasks or Transform tasks, can alter the content of the message. The Log task can be used to output the message content at any point in the mediation flow. You can use this information for debugging, auditing, or other purposes.

• Contributed data Mediation tasks, such as the Transform task or Custom tasks, can add or contribute data to the mediation exchange. The Log task can be used to output any data contributed to the mediation exchange by previously executed mediation tasks.

• Exchange Variable If the mediation operation has an exchange variable set, the exchange variable appears as one of the items to log. If Log All Items is selected, the Exchange Variable is automatically logged if it is being used.

See the Managing Logging section in TIBCO ActiveMatrix Administration for complete information about logging. That book includes information on how to create log services, create logging configurations, use the Log Viewer to query for and display log entries, and view server logs.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 65: Active Matrix Service Bus Design Guide

Configuring a Log Task | 45

Configuring a Log Task

After you have added a log task to a path within a mediation flow, you must specify the type of information you want to log. The Log tab of the Log task configures the information to send to the log file. Figure 14 illustrates the Log tab.

Figure 14 Configuring a Log task

Check the box next to the item you want to send to the log file. You can check the box next to Log All Items, if you want to send all of the available information to the log file.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 66: Active Matrix Service Bus Design Guide

46 | Chapter 4 Log Task

Configuring the Appenders and Loggers

Appenders describe locations to append log entries. Loggers describe the items that you want to log and the associated appender to use to write the log entry.

This section describes how to configure appenders and loggers for the Log tasks in your mediation components. For a complete explanation of appenders and loggers, see the Managing Logging section in TIBCO ActiveMatrix Administration.

Using the bootStrap.xml FileTIBCO ActiveMatrix allows you to configure logging at the node level. Each node has a configuration file named bootStrap.xml for specifying the appenders and loggers. The file is located in AMX_HOME\data\envName\nodeName\config\bootStrap.xml, where envName is the name chosen for the ActiveMatrix environment during the creation of the node, and nodeName is the name of the node.

You can edit the bootStrap.xml file with your choice of text or XML editors. Edit only this section:

<!-- START AMSB SECTION --><appender name="AMSBLogTaskFileAppender"

class="com.tibco.commonlogging.appender.CommonRollingFileAppender"><param name="File" value="amsb_mediation_logTask.log"/><param name="MaxFileSize" value="2048KB"/><param name="MaxBackupIndex" value="9"/><layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="%d [%t] %-5p - %m%n"/></layout>

</appender><logger name="com.tibco.amsb.container.mediation.logTask" additivity="false" >

<level value ="INFO"/><appender-ref ref="AMSBLogTaskFileAppender"/>

</logger>

<!-- END AMSB SECTION -->

The appender is defined in the <appender> element and the logger is defined in the <logger> element. You can add appenders or loggers as needed.

Configuring Appenders

The default appender is configured to write to a file named amsb_mediation_logTask.log stored in the AMX_HOME\data\envName\nodeName\logs directory. You can add other appenders or change the properties of the default appender as needed.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 67: Active Matrix Service Bus Design Guide

Configuring the Appenders and Loggers | 47

Configuring Loggers

The default logger is named com.tibco.amsb.container.mediation.logTask and is associated with the default appender. This default logger specifies that all entries for Log tasks within the node are written to the default appender.

You can specify the following for logger names:

• com.tibco.amsb.container.mediation.logTask — This logger name specifies that all entries for Log tasks within the node are written to the appender specified in the <appender-ref> element. Loggers defined with logger names at the component, mediation interface, or mediation operation levels override this logger.

• com.tibco.amsb.container.mediation.logTask.componentName — This logger name specifies that all entries for Log tasks within the specified mediation component are written to the appender specified in the <appender-ref> element. Loggers defined with logger names at the mediation interface or mediation operation levels override this logger.

• com.tibco.amsb.container.mediation.logTask.componentName.mediationInterfaceName — This logger name specifies that all entries for Log tasks within the specified mediation interface are written to the appender specified in the <appender-ref> element. Loggers defined with logger names at the mediation operation level override this logger.

• com.tibco.amsb.container.mediation.logTask.componentName.mediationInterfaceName.mediaitonOperationName — This logger name specifies that all entries for Log tasks within the specified mediation operation are written to the appender specified in the <appender-ref> element.

Example Configuration

The following example configuration uses the default appender and logger to handle most log entries for the node. There is a second appender added to this configuration that writes log entries to a different file. A second logger is also added to specify that entries for Log tasks for a the mediation interface named MyInterface are to use the second appender.

<!-- START AMSB SECTION --><appender name="AMSBLogTaskFileAppender"

class="org.apache.log4j.RollingFileAppender"><param name="File" value="amsb_mediation_logTask.log"/><param name="MaxFileSize" value="2048KB"/><param name="MaxBackupIndex" value="9"/>

The <level> element of a logger is set to capture entries that are defined at the INFO level. Typically, entries can be set to the DEBUG, INFO, WARN, or ERROR level. The Log Task creates entries only at the INFO level, so keep the <level> element defined as INFO for all loggers that you create or modify.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 68: Active Matrix Service Bus Design Guide

48 | Chapter 4 Log Task

<layout class="org.apache.log4j.PatternLayout"><param name="ConversionPattern" value="%d [%t] %-5p - %m%n"/>

</layout></appender>

<!-- Second File Appender --> <appender name="AMSBLogTaskFileAppender2"

class="org.apache.log4j.RollingFileAppender"><param name="File" value="amsb_mediation_MyInterface_logTask.log"/><param name="MaxFileSize" value="2048KB"/><param name="MaxBackupIndex" value="9"/><layout class="org.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="%d [%t] %-5p - %m%n"/></layout>

</appender><logger name="com.tibco.amsb.container.mediation.logTask" additivity="false" >

<level value ="INFO"/><appender-ref ref="AMSBLogTaskFileAppender"/>

</logger><!-- Logger to send entries from MyInterface to Email Appender -->

<logger name="com.tibco.amsb.container.mediation.logTask.myComponent.MyInterface" additivity="false" >

<level value ="INFO"/><appender-ref ref="AMSBLogTaskFileAppender2"/>

</logger>

<!-- END AMSB SECTION -->

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 69: Active Matrix Service Bus Design Guide

| 49

Chapter 5 Route Tasks

Route tasks are used to specify that messages can be delivered to different destinations based on values within the message data or within other data in the mediation exchange, such as the security context. This chapter describes how to use route tasks within a mediation flow.

Topics

• Overview of Route Tasks, page 50

• Routing Cases, page 54

• Variables, page 56

• Routing Conditions, page 58

• Changing Route Tasks to XPath Route Tasks, page 61

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 70: Active Matrix Service Bus Design Guide

50 | Chapter 5 Route Tasks

Overview of Route Tasks

Route tasks allow you to send messages to a specific destination based on conditions that you specify. Data from the mediation exchange, such as the message context or the message body, can be used to construct the routing conditions. For example, you may route incoming messages to a local server from 9AM to 5PM, but outside of those times, the messages should be routed to a different server. Figure 15 illustrates an example route.

Figure 15 An example route

The example in Figure 15 illustrates a system that searches for travel reservations. For the searchHotel mediation operation, incoming messages are routed to the appropriate service based on the city specified in the search request. If the city is the local city of the requestor, the message is sent to the QueryGDS service. If the city is in Asia, the message is sent to the QueryGDS_Asia service. Likewise, if the city is in Europe or the United States, the message is sent to the appropriate service. If the city specified is not the local city, or in Asia, Europe, or the United States, a fault is thrown.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 71: Active Matrix Service Bus Design Guide

Overview of Route Tasks | 51

There are two types of route tasks: Route and XPath Route. The Route task allows you to define basic route conditions and the XPath Route task allows more flexibility in the expressions you can use to define a route condition. The type of condition that you must define determines which route task is appropriate for your application. See Routing Conditions on page 58 for more information on the types of conditions that can be used by each route task.

Paths and Route TasksRoute tasks send each incoming message to a single destination based on which route case evaluates to true, or to a single destination designated as otherwise if none of the cases evaluate to true.

Case paths on the input flow to a given target operation correspond to paths on the output and fault flow that originate from that target operation. Case paths ending in Throw Fault have a corresponding mediation fault path on the Fault flow. Case paths ending in a Generate Reply task have a single, common Handle Reply path on the Output flow.

Figure 16 illustrates the output path and Figure 17 illustrates the fault path of the route show in Figure 15.

If you create Route tasks and later decide that a more complex routing condition is required, you can easily convert the Route task to an XPath Route task. See Changing Route Tasks to XPath Route Tasks on page 61 for more information.

You can only introduce the route in the input path, and the response (output or fault) always returns to the original requester, which invoked the same mediation operation.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 72: Active Matrix Service Bus Design Guide

52 | Chapter 5 Route Tasks

Figure 16 Output path for a route

Figure 17 Fault path for a route

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 73: Active Matrix Service Bus Design Guide

Overview of Route Tasks | 53

Mediation tasks can be added to the sub-paths after a route activity. Typically, you use a Transform task when the input, output, or fault message schema does not match the mediation operation message schema. See Chapter 6, Transform Tasks, on page 63 for more information about Transform tasks.

Defining a RouteThe steps to defining a route task are the same regardless of the type of route task you are using. Before creating a route, your mediation operation must contain the mediation interface and one or more target interfaces that contain operations between which you will be routing messages.

To define a route:

1. Add a Route or XPath Route task to an existing input path. If you have not yet created any input paths in your mediation flow, draw the path between your mediation operation and one of the target operations that you want for the destination for the route.

Once a route task is added to an input path, a default case and an "otherwise" case are created. Cases are the conditions that are evaluated to determine which sub-path a message takes. The "otherwise" case is always present and this case is used when all other cases evaluate to false.

2. Create more cases for the route, if necessary, to create sub-paths to other target operations in your mediation flow.

3. Add variables to hold the value of data from the message content or message context. These variables will be used in the routing conditions you specify in each routing case.

4. Use the Decision Input tab on the route task to map data from the message context or message content to the variables defined in step 3.

5. Specify the routing conditions for each case using the variables that you have defined for the route.

The details of performing each of these steps is discussed in the subsequent sections of this chapter.

Route tasks can only be added to an input path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 74: Active Matrix Service Bus Design Guide

54 | Chapter 5 Route Tasks

Routing Cases

Routing cases define the potential destination for the route. Each case leads to a different potential target operation. You must specify two things for each routing case: a name for the case and the destination to which the case leads. The following sections describe how to work with routing cases.

Adding CasesYou can define routing cases in either of these ways:

• Click on the route task in the input path of the mediation flow and drag the cursor to the desired destination. When you use this method, the sub-path is automatically drawn and a case with a default name is added to the Decision tab.

• Use the Add Case icon on the tool bar of the Decision tab for the route task.

If you use the Add Case button, a case is created, but it does not lead to a specific target operation. Figure 18 illustrates the sub-path that is displayed in this situation. The sub-path leads to an error icon. See Modifying Case Names or Destinations on page 55 for details on how to change the destination of the routing case to a valid target operation.

Figure 18 Adding a routing case

Each routing case leads to one potential target operation. Target operations cannot be shared among routing cases. That is, there is a one-to-one relationship between routing cases and target operations.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 75: Active Matrix Service Bus Design Guide

Routing Cases | 55

Modifying Case Names or DestinationsUse the Decision tab on the route task to change the name of the routing case to the desired name. To change the routing case name, click on the name in the Case column and edit the name in the text box.

You can change the destination of the routing case in either of these ways:

• Use the drop-down list in the Target Service/Operation field on the Decision tab to select a new target operation.

• For newly created routing cases that point to an error icon, click on the error icon and drag the cursor to the desired target operation.

• For routing cases that point to a valid target operation, click on the round ball at the end of the input path and drag the cursor to the desired target operation.

Moving Cases in the ListCases are evaluated in the order they appear in the list and the first case whose condition evaluates to true is taken. Therefore, you may need to move cases up or down in the list.

To move a case up the list, select the row of the case and click the Move Up icon on the toolbar.

To more a case down the list, select the row of the case and click the Move Down icon on the toolbar.

Deleting CasesYou can delete a routing case in either of these ways:

• Select the sub-path of the routing case in the mediation flow, then either right-click and select Delete from the popup menu or press the Delete key on your keyboard.

• Select the row of the routing case on the Decision tab of the route task and click the Delete Case icon on the tool bar.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 76: Active Matrix Service Bus Design Guide

56 | Chapter 5 Route Tasks

Variables

Variables hold the data that you use in expressions for each routing case. The following sections describe how to work with variables.

Adding and Deleting VariablesVariables are managed on the Decision tab of the route task. To add a variable, click the Add Variable icon on the tool bar. A dialog appears that allows you to specify the variable name and datatype. These datatypes are available:

• string

• integer

• boolean

• float

• double

• decimal

To delete a variable, click the Delete Variable icon on the tool bar. A dialog appears that allows you to select the variable you want to delete.

Mapping Data to VariablesOnce you create a variable, you must map data from the mediation operation to provide a value for the variable. The mapping is performed on the Decision Input tab of the route task. This tab is very similar to the Mapper tab of a Transform task. For a complete description of how to perform mapping, see Chapter 6, Transform Tasks, on page 63.

In the Decision Input tab of a route task, the right-hand panel is labeled Rule Variables. The schema in the right-hand panel contains a list of the variables that you have defined for the route task. Use XPath expressions to provide a value for each variable in this schema.

Once a variable is created, you cannot change its name or datatype. You must delete the variable and create a new one if you must alter a variable.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 77: Active Matrix Service Bus Design Guide

Variables | 57

In the example illustrated in Figure 15 on page 50, one variable named city is used to determine the destination of the message. In this example, the city specified in the search request is mapped to the variable named city. The value of the variable is then used in routing conditions to determine which target operation should receive the message. Figure 19 illustrates the mapping for this example.

Figure 19 Mapping values to variables

The section Schema Components on page 71 describes the fact that schema components on the left-hand side of the mapper are not validated against the message schema, and therefore their datatypes are not guaranteed. Therefore, data used within XPath expressions on the right-hand side of the mapper is treated as untyped strings. Simple drag-and drop mappings are not affected, but if you want to perform data type-dependent comparisons or operations, you must use the Constructor Functions on the Functions tab (for example, xsd:int()) to correctly specify the data type. For example, if you want to add two integers, the XPath expression would be:

xsd:int($MessageData/int1) + xsd:int($MessageData/int2)

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 78: Active Matrix Service Bus Design Guide

58 | Chapter 5 Route Tasks

Routing Conditions

Routing conditions determine which sub-path a message takes. Routing conditions are specified in order, and the message is sent along the sub-path corresponding to the first condition that evaluates to true. The Decision tab of the route tab contains the routing conditions for the route.

Routing conditions are XPath expressions, but each type of route task has a different method of specifying routing conditions. The Route task allows you to specify basic comparison expressions for each variable you have defined. The XPath Route task allows you to use more complex XPath expressions. The type of route you would use depends upon the complexity of the routing conditions you must define.

The following sections describe routing conditions for each of the routing tasks.

Conditions for Route TasksRoute tasks create a simple comparison condition for each variable you have defined. For example, Figure 20 illustrates the routing conditions defined for the example show in Figure 15 on page 50.

Figure 20 Routing conditions for the Route task

In this example, basic equality comparisons are performed for each case. When the city variable is equal to "Palo Alto", the case named CaseMyCity evaluates to true, and its corresponding sub-path is taken. If none of the routing conditions evaluate to true, the sub-path for the Otherwise case is taken.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 79: Active Matrix Service Bus Design Guide

Routing Conditions | 59

Clicking on the cell for each variable and each case allows you to edit the condition. You must specify a comparison operator and a constant value for comparison. These basic comparison operators are available in a drop-down list in the condition:

• = (equal)

• != (not equal)

• < (less than)

• <= (less than or equal)

• > (greater than)

• >= (greater than or equal)

• =True (only for variables of type boolean)

• =False (only for variables of type boolean)

All of the conditions for each case must evaluate to true for the condition to be true. Therefore, the Route task is useful in some situations where a basic comparison of a few variables can be specified. Figure 21 illustrates an example of using more than one variable in routing cases.

Figure 21 Routing with more than one variable

Figure 21 illustrates a loan application. The SimpleLoanPortType/SimpleRequestLoan operation can be used for loans less than or equal to $50,000 and when the applicant has a credit score above 700. If neither of these conditions is true, then the LoanPortType/RequestLoan operation that requires more information from the applicant must be used.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 80: Active Matrix Service Bus Design Guide

60 | Chapter 5 Route Tasks

Conditions for XPath Route TasksXPath Route tasks allow more complex comparisons for each case. You can specify an XPath expression for each case that examines the value of one or more of the variables that you have defined. For example, you can create an expression that specifies a range of time (such as 9AM to 5PM), or you can create an expression that compares two or more variables. Your expressions are not limited to simple comparisons, and you do not have to use any of the variables you have defined in the expressions.

XPath route tasks are more flexible than Route tasks, but specifying the expression is more complex. You must type the XPath expression in the condition field next to each routing case.

Variables are referenced in the XPath expressions for each routing case by their names. Unlike XPath expressions in the Transform task, you do not need to use a dollar sign to specify the root of the path to the variable. For example, the expression to determine if the city variable is equal to "Palo Alto" would be:

city = "Palo Alto"

The Transform task has a graphical XPath editor that you can use as a reference for creating XPath functions for the route task. See XPath on page 88 and Data/Function Tabs on page 78 for more information about XPath.

As noted in Mapping Data to Variables on page 56, data type-dependent comparisons and operations should use constructor functions to typecast the data.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 81: Active Matrix Service Bus Design Guide

Changing Route Tasks to XPath Route Tasks | 61

Changing Route Tasks to XPath Route Tasks

You may create Route tasks and later realize that a more complex routing condition is required. Instead of removing the existing Route task, you can convert a Route task into an XPath Route task.

To convert a Route task to an XPath Route task:

1. Select the Route task you want to convert in a mediation flow diagram.

2. Right-click on the Route task and select Convert to XPath Route from the popup menu.

3. All variables and cases are maintained, and the routing conditions are converted to the correct XPath syntax. You can alter the condition for each case, as desired.

Converting a Route task to an XPath Route task is a one-way operation. You cannot convert an XPath Route task into a Route task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 82: Active Matrix Service Bus Design Guide

62 | Chapter 5 Route Tasks

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 83: Active Matrix Service Bus Design Guide

| 63

Chapter 6 Transform Tasks

Transform tasks are used to manipulate data within the mediation exchange. This chapter describes using Transform tasks in a mediation flow.

Topics

• Overview of Transform Tasks, page 64

• Example of Transformation, page 66

• Contributing Data to the Mediation Exchange, page 70

• Schema Components, page 71

• Context Panel, page 73

• Message Panel, page 77

• Data/Function Tabs, page 78

• Toolbar, page 79

• Right-Click Menu, page 80

• Mappings, page 86

• XPath, page 88

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 84: Active Matrix Service Bus Design Guide

64 | Chapter 6 Transform Tasks

Overview of Transform Tasks

Transform tasks are used to manipulate the data available in a mediation exchange. Transform tasks have an Input tab that contains the expected schema of the recipient’s message and the data available in the mediation flow. Figure 22 illustrates the Input tab of a Transform task.

Figure 22 The Input tab of a Transform task

Transform tasks are necessary when the schema of the input, output, or fault message does not match the schema of the message of the expected recipient. For example, Transform tasks allow you to create a mediation operation that allows new clients to use legacy services with different schemas. That is, your new client may need a service that returns an integer for salary information, but the legacy service returns a string.

Transform tasks also allow you to contribute data to the mediation exchange for use in subsequent mediation tasks. For example, you might want to take the time a message was sent, the sender of the message, and the value of one of the elements within a message and place that information into a string. You can then use a log task to write the contents of that constructed string to the log file. The Transform task allows you to manipulate and store data in the mediation exchange without altering the actual message content.

The message panel contains an XSLT stylesheet that creates the message that the recipient expects. The message panel initially displays the expected schema of the recipient’s message to provide you with hints to construct the message. The context panel contains the data available from the message sender. You can drag

toolbarmessage panelmappingsContext panel

data/function tabs

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 85: Active Matrix Service Bus Design Guide

Overview of Transform Tasks | 65

and drop items from the context panel to the message panel to perform simple mappings. More complex mappings are also possible through the XPath expression field and by using the right-click menu in the message panel to add XSLT statements.

XPath and XSLT are standard tools for data transformation. Extensive knowledge of XPath or XSLT is not necessary to effectively use the mapper. Most of the transformation usage cases can be accomplished with information available in this chapter and in the help text available for each XPath function in the product. If you are performing more complex transformations, it would be helpful to have some detailed references on XPath and XSLT. It is beyond the scope of this manual to provide a complete reference for these tools. You can find the complete XPath and XSLT specification at www.w3.org, and there are several third-party commercial books available on both XPath and XSLT.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 86: Active Matrix Service Bus Design Guide

66 | Chapter 6 Transform Tasks

Example of Transformation

This section uses an example to illustrate how to use the Transform task. The mediation flow exposes a travel reservation service. The mediation operation exposes the service as a single interface, but the mediation flow routes incoming requests to the appropriate local service based on the location of the hotel. Different continents have different target services that perform the actual hotel reservation. The schemas for different locations are slightly different, and therefore, some transformation may be necessary. Figure 23 illustrates the input path of the mediation flow for this example.

Figure 23 A travel reservation mediation flow

Transform tasks are required when requests come in for any city other than the local city because the schemas for the other target operations are different from the mediation operation. Figure 24 illustrates the transform task for the case when a reservation is requested for an Asian city.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 87: Active Matrix Service Bus Design Guide

Example of Transformation | 67

Figure 24 A basic mapping case

Figure 24 illustrates that the schemas for the mediation operation and the target operation are very similar, except the mediation operation has an element named nearAddress and the corresponding element in the target operation is named landmark. For all other elements, you can drag and drop the data component in the mediation operation to the corresponding data component in the target operation, and the appropriate XPath expression is placed in the XPath field.

For the nearAddress and landmark elements, you may need to do some manipulation of the data to transform it to the expected format. In this case, the nearAddress element contains the name of the location separated by a comma followed by the actual address. The landmark element is expecting only the name of the location. Therefore, to make the data match the target operation’s expectations, you need to take the substring of the nearAddress element up to the comma that separates the name of the location from the address.

To accomplish this goal, perform the following procedure:

1. Click the XPath Expression field next to the landmark element in the target operation message schema. The field expands to a larger text box to allow you to edit the expression more easily.

2. Click the Functions tab on the at the top of the context panel.

3. Expand the String functions folder in the functions list and locate the subtring-before function.

4. Drag and drop the substring-before function into the XPath Expression window.

Figure 25 illustrates the results of adding the substring-before function to the XPath expression.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 88: Active Matrix Service Bus Design Guide

68 | Chapter 6 Transform Tasks

Figure 25 The XPath Editor window

When you drag functions from the Functions tab to the XPath Expression window, the function has markers in double angle brackets (for example, <<string>>) for completing the function. You can drag and drop data components and constants from the Data Source or Constants tab to complete the function. You can also type in the XPath Expression window to replace the markers manually. In this example, you would replace the <<before-string>> marker with a comma and then drag the nearAddress element onto the <<string>> marker. Figure 26 illustrates dragging the data components into an XPath function.

Figure 26 Dragging a data element into a function

Figure 27 illustrates the completed XPath function for this example.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 89: Active Matrix Service Bus Design Guide

Example of Transformation | 69

Figure 27 The completed transformation example

More complex transformations are possible with the features available in the Input tab. The following sections in this chapter describe the different parts of the Input tab in further detail.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 90: Active Matrix Service Bus Design Guide

70 | Chapter 6 Transform Tasks

Contributing Data to the Mediation Exchange

The Transform task can either modify the message data within the mediation exchange or the Transform task can contribute new data to the mediation exchange. The General tab of the Transform task has a checkbox labeled Contribute Output to Mediation Exchange. This field is unchecked by default, signifying that the results of the transformation should be used to construct a new message. If you check the box next to this field, the results of the Transform task are added to the mediation exchange as a new data element. The new data element is available to subsequent mediation tasks along the same path, and the name of the data element is the same as the name assigned to the Transform task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 91: Active Matrix Service Bus Design Guide

Schema Components | 71

Schema Components

The message panel and context panel each contain schemas that contain data components. Table 5 describes the icons used within these schemas

The icons in Table 5 represent the general data type of the component. When you hover the cursor over any component, a popup appears that provides the exact data type of the component.

Table 5 Icons for schema components

Icon Description

Complex element that is a container for other datatypes. This is also called a parent in the schema tree.

String or character value.

Integer value.

Decimal (floating point) value.

Boolean value.

Date value.

Time value.

Binary (base 64()) value.

Choice of multiple values. The actual data value can be one of a specified set of datatypes.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 92: Active Matrix Service Bus Design Guide

72 | Chapter 6 Transform Tasks

Qualifier CharactersSchema data components can have additional characters to the right of the element name that specify additional information. If there is no qualifier, the schema component is required and you must provide a mapping that results in a value for the schema component.

Table 6 describes the qualifiers that can appear to the right of the names of schema components.

To improve performance, the data contained within the schema components in the left-hand side of the mapper are not validated against the message schema for the operation. Therefore, data used within XPath expressions on the right-hand side of the mapper is treated as untyped strings. If you want to perform datatype-dependent comparisons or operations, you must use the Constructor Functions on the Functions tab (for example, xsd:int()) to correctly specify the datatype. For example, if you want to add two integers, the XPath expression would be:

xsd:int($MessageData/int1) + xsd:int($MessageData/int2)

Table 6 Qualifier characters

Qualifier Description

none Element is required

? Element is optional.

* Element repeats zero or more times.

+ Element repeats one or more times.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 93: Active Matrix Service Bus Design Guide

Context Panel | 73

Context Panel

The context panel is named according to where the Transform task appears. The following table describes the label on this panel depending upon the type of path containing the task:

The context panel always displays the schemas that define the data for the current mediation properties, message context, and message data. Regardless of the type of path, the schema of the mediation properties and message context are always the same. The schema for the message data varies depending upon the schema of the recipient’s expected message. Table 7 describes the schema for message properties and message context.

Table 7 describes the schemas in the context panel.

Type of Path Name of Context Panel

Input Mediation Operation Context

Output Target Operation Context

Fault Mediation Fault Context

Table 7 Schema for message properties and message context

Schema Component Description

MediationFlowProperties This schema component contains an element named properties that is of type complex that contains the properties defined on the Properties tab of the mediation flow. See Mediation Flow Properties on page 19 for more information about mediation flow properties.

MessageContext This schema component contains an element named MessageContext of type complex that contains the sub-components transport and security described below.

transport This schema component contains a sub-component that is of type choice. The sub-component can either contain the complex type http or jms described below.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 94: Active Matrix Service Bus Design Guide

74 | Chapter 6 Transform Tasks

http This schema component is present when the message is sent over the http protocol. This component contains a headers element with several sub-components:

• contentType — the media type of the message. For example,text/html; charset=ISO-8850-4. See the HTTP specification for a more complete description of media types.

• contentTransferEncoding — the content-encoding values that are acceptable for messages. For example, compress, gzip. See the HTTP specification for more information about this header element.

• contentId — ID of the message.

• header — a repeating complex element containing name/value pairs for each additional header element of the message.

Table 7 Schema for message properties and message context

Schema Component Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 95: Active Matrix Service Bus Design Guide

Context Panel | 75

jms This schema component is present when the message is sent over the JMS protocol. This component contains two complex sub-components named headers and properties. The headers sub-component contains these sub-components:

• jmsCorrelationID — this ID is used to link response messages to corresponding request messages.

• jmsDeliveryMode — the delivery mode for the message.

• jmsExpires — the expiration time and date for the message.

• jmsMessageID — the message ID.

• jmsPriority — the priority value of the message.

• jmsReplyTo —the destination to use for replies for the message.

• header — a repeating complex element containing name/value pairs for each additional header element of the message.

The properties sub-component contains a repeating sub-component named property that contains name/value pairs for each JMS message property contained in the message.

Table 7 Schema for message properties and message context

Schema Component Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 96: Active Matrix Service Bus Design Guide

76 | Chapter 6 Transform Tasks

security This schema component contains an element named SecurityEnvelope.

The SecurityEnvelope element contains both transport-level (HTTPS or HTTP Basic Authentication) and message-level (WS-Security) security information.

The SecurltyEnvelope element contains single or multiple SAML sessions, depending on whether one or both security mechanisms (transport-level and message-level) are used.

Each item in this repeating component contains a named SAML security assertion element. The name and properties for each security assertion are provided.

For more information about SAML, see http://www.oasis-open.org/committees/security/.

Note: The security schema component is visible on the input, output, and fault paths, but it is only populated on the input path. You can only use information stored in this component within tasks on the input path.

Message Data The MessageData component contains the message of the expected recipient. For input paths, this component contains the schema of the input message of the target operation. For output paths, this component contains the schema of the output message of the mediation operation. For fault paths, this component contains a choice element that contains either one of the faults returned by the target operation or a generic TargetOperationRuntime fault message

Table 7 Schema for message properties and message context

Schema Component Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 97: Active Matrix Service Bus Design Guide

Message Panel | 77

Message Panel

The message panel contains the schema of the message that the recipient expects. The message panel is named according to where the Transform task appears. The following table describes the label on this panel depending upon the type of path containing the task:

You can use the data in the schemas from the context panel to construct the content of the message expected by the receiver. The message panel is actually an Extensible Stylesheet Language Transformation (XSLT) template that specifies how data should be transformed to produce the expected message. You do not need detailed knowledge of XSLT to create the mappings for the message. Most mappings can be accomplished by simple dragging and dropping from the context panel to the message panel, and also possibly using a few XPath functions for simple data manipulation. However, if you want to see the XSLT template that is created from your mappings, click the Show Edit Tab icon on the toolbar, then click the XSLT Source tab on the bottom of the XPath editor dialog.

See Data/Function Tabs on page 78 and Mappings on page 86 for more information about using XPath functions and creating mappings.

Type of Path Name of Context Panel

Input Target Operation Context

Output Mediation Operation Context

Fault Mediation Fault Context

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 98: Active Matrix Service Bus Design Guide

78 | Chapter 6 Transform Tasks

Data/Function Tabs

The tabs at the top of the context panel allow you to select different items to drag and drop into the message panel. describes the contents of these tabs.

When you drag data, a function, or a constant to the right-hand panel and hover over an existing expression in an XPath editing window, the background color of the text underneath the cursor changes to indicate the result of dropping the item at that point. If the background text is light turquoise, the highlighted text will become the first parameter of the dropped function, if the background color is light pink, the dropped item will replace the existing text.

Table 8 Data/Function tabs

Tab Description

Data Source This tab contains the schemas for the mediation flow properties, message context, and message data. This is the default tab selected when you view the Input tab. See Context Panel on page 73 for more information.

Functions This tab contains a set of XPath functions organized into related functional groups. XPath (XML Path Language) is an expression language developed by the World Wide Web Consortium (W3C). XPath functions perform data manipulation, such as mathematical functions, string manipulation, or logic operators.

You can select and drag XPath functions in this tab to the XPath expression field or Show Edit Tab dialog in the message panel.

Each function has help text to describe the function’s use and syntax. The help for the function is displayed below the function list in the Functions tab.

Constants This tab contains constants such as whitespace or symbol characters that can be used in XPath expressions.

As noted in Schema Components on page 71, data in schema components on the Data Source tab are not validated and checked against the types in the message schema. Therefore, the data is coerced into an untyped string. The Constructor Functions on the Functions tab must be used on data to correctly evaluate most functions and operators.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 99: Active Matrix Service Bus Design Guide

Toolbar | 79

Toolbar

The toolbar contains icons to perform various functions in the mapper. Table 9 describes the buttons in the toolbar.

Table 9 Mapper toolbar buttons

Button Description

This button removes the selected mapping. It is only available when a mapping is selected in the message panel. If you remove the mapping when a parent node in the schema tree is selected, all mappings for child nodes of the parent are also removed.

This button deletes XSLT statements that you have added using the right-click menu, such as variables, comments, or choose statements. This button is only available when an statement you have added is selected.

This button causes the Show Check and Repairs dialog to appear.

See Repairing Incorrect Mappings on page 86 for more information.

This button causes a larger Show Edit Tab XPath editing window to appear for the selected element in the message panel. The window gives you access to a larger XPath viewer, the XSLT source, and controls that will allow you to further edit the XSLT statements.

Click this icon a second time to make the Show Edit Tab XPath editing window disappear.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 100: Active Matrix Service Bus Design Guide

80 | Chapter 6 Transform Tasks

Right-Click Menu

Right-clicking on a data component in the message panel displays a popup menu with several choices. Table 10 describes the right-click menu.

Table 10 Right-click menu in the message panel

Menu Item Description

Show Mappings Expands the selected component to show all sub-components with mappings. Also expands any data components in the left-hand panel that correspond to mappings so that all mapping lines are shown.

If no component is selected, the operation is performed on the root of the schema tree.

Show Errors Expands the selected data component to show all sub-components that have errors.

If no component is selected, the operation is performed on the root of the schema tree.

Expand All Expands all sub-components of the selected data component.

If no component is selected, the operation is performed on the root of the schema tree.

Surround With > Surround with Choose

Surrounds the selected data component with a Choose statement. See Choose Statements on page 81 for more information.

Surround With > Surround with If

Surrounds the selected data component with an If statement. See If Statements on page 82 for more information.

Surround With > Surround with ForEach

Surrounds the selected data component with a For Each statement. See For Each Statements on page 83 for more information.

Add Child > Variable

Adds a sub-component to the selected data component. The child component will be a variable. Variables can be set to a constant value and used in other mappings in the message panel. See Variables on page 84 for more information.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 101: Active Matrix Service Bus Design Guide

Right-Click Menu | 81

Choose StatementsChoose statements allow you to conditionally specify the mapping based on an expression. Choose statements consist of a When clause to specify the condition you want to test, the mapping you want to perform if the condition is true, and an Otherwise clause to contain a mapping to perform if no conditions evaluate to true.

To surround a component with a Choose statement:

1. Select the component you want to surround, right-click, and choose Surround > Surround with Choose... from the menu.

2. In the Surround With Choose dialog, enter the number of When conditions you want to test against, and also specify whether you want to include an Otherwise clause for any unhandled conditions.

3. For each When clause, create an XPath expression that evaluates to a boolean.

4. Under each When clause, provide the XPath expression for the mapping that should occur if the When condition evaluates to true.

5. If an Otherwise clause is specified, provide an XPath expression for the mapping that should occur if no When conditions evaluate to true.

Add Child > Comment

Adds a sub-component to the selected data component. The child component will be a comment. See Comments on page 85 for more information.

Add Sibling > Variable

Adds a data component at the same level as the selected component. The new component will be a variable. Variables can be set to a constant value and used in other mappings in the message panel. See Variables on page 84 for more information.

Add Child > Comment

Adds a data component to the same level as the selected component. The new component will be a comment. See Comments on page 85 for more information.

Toolbar icons The selections from the toolbar are also available in the right-click menu. See Toolbar on page 79for more information about these options.

Table 10 Right-click menu in the message panel

Menu Item Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 102: Active Matrix Service Bus Design Guide

82 | Chapter 6 Transform Tasks

An example of using a Choose statement is when more than one fault message is handled by the same Catch Fault task. Figure 28 illustrates a Transform task on a fault path that handles two faults. The Choose statement specifies that when the searchHotel_faultMsg is returned, send the value of the searchHotel_fault element. Otherwise, send the value of the message element.

Figure 28 An example Choose statement

If StatementsIf statements allows you to specify a condition, and if the condition is met, then the specified mapping is output. When you chose this option, an If statement appears before the selected element, and you must place an XPath expression in the If statement that evaluates to a boolean. If the expression evaluates to true, the specified mapping is performed. If the expression evaluates to false, the mapping is not performed and no value is set for the item. You should not place an If statement around schema data components that are marked as required.

Figure 29 illustrates an If statement. In this example, the returnDate schema element is optional. The returnDate element is surrounded by an If statement that evaluates whether the roundTrip element is true. If roundTrip is true, then the element is output, if roundTirp is false, the returnDate element is not output. The expression in the If statement is:

string($MessageData/ns:searchAirlineRequest/ns:parameters/ns0:searchAirline/roundTrip) = "true"

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 103: Active Matrix Service Bus Design Guide

Right-Click Menu | 83

Figure 29 Example of If statement

For Each StatementsFor Each statements allow you to execute one or more statements once for each data element in a list. When you choose this option, a For Each statement appears before the selected data component, and you must place an XPath expression in the For Each statement that evaluates to a list of zero or more items. This is useful when you want to manipulate sequences or repeating elements.

Figure 30 illustrates a For Each statement. In this example, the requestor sends a list of ticker symbols and the stock exchanges on which they are traded. The mediation flow routes the request to different services for each stock exchange. The For Each statement takes the list of ticker symbols and executes the remaining statements once for each symbol in the list. The If statement examines the exchange element and outputs only the ticker symbols for the "NYSE" stock exchange.

The example requires a comparison of the value of a boolean element. To obtain the value of the element, the element is coerced into a string using the string() function and then compared to the value of the string "true". See Testing Boolean Values on page 90 for more information about comparing the value of boolean data components.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 104: Active Matrix Service Bus Design Guide

84 | Chapter 6 Transform Tasks

Figure 30 Example of For Each statement

VariablesVariables can be used in any XPath expression within your message panel. When this option is chosen, a dialog appears that allows you to specify the name of the variable. You can change the name of the variable at a later time by selecting the variable and clicking the Show Edit Tab button in the toolbar. The Variable Name field can be used to alter the variable’s name.

The value of the variable is specified by supplying an XPath expression, either by mapping data from the context panel or by using XPath functions or constants. Once the variable’s contents have been supplied, the variable can be referenced within the scope that it has been defined. That is, you can reference a variable from within the same component or within sub-components of the component in which the variable is defined.

Adding a variable is useful if you perform the same computation repeatedly. You can refer to the results of the computation in several message elements instead of recreating the computation for each item.

Figure 31 illustrates adding a variable named currPlusMarkup. In this example, the variable uses the mediation flow property USDtoYenXChangeRate to get the value of the current exchange rate. That value is then multiplied by 1.02 to add a 2% markup. The variable can then be referenced in subsequent statements in the mapping.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 105: Active Matrix Service Bus Design Guide

Right-Click Menu | 85

Figure 31 An example of adding a variable to a mapping

CommentsComments are used to supply information about your mappings. Comments are ignored by the software, but you may want to use comments as reminders or documentation for your application.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 106: Active Matrix Service Bus Design Guide

86 | Chapter 6 Transform Tasks

Mappings

A mapping correlates data from the schema in the context panel with a data component in the message panel. Lines appear between data components that are mapped to each other. The lines are blue when both components are visible, but the lines turn into a dashed green line when one or more mapped component is collapsed into its parent in the schema tree.

To create a mapping, drag and drop data components from the left-hand panel to the right-hand panel. The appropriate XPath expression is displayed in the XPath Expression field. There are tabs at the bottom of the context panel (described in Data/Function Tabs on page 78) that you can use to add functions or constants to the XPath expression in a mapping.

You can click on and expression in the XPath Expression field or click on the Show Edit Tab button on the tool bar to bring up a larger window in which to view or edit the XPath statement.

Data components in the message panel are initially displayed in italics. Italic text indicates that the components are hints to the potential mappings you can create. Once you create a mapping for a data component, the hint changes from italics to non-italic font. Non-italic font indicates that the mapping is now an XSLT statement that transforms the data into the specified component. You can change a hint into a statement without performing a mapping by selecting a component in a message schema and dragging it past the dividing line between the left and right panels.

Data components on the right-hand side of a mapping can be either black or red. If the component is black, the XSLT statement for the component is valid and complete. If the component is red, that indicates the statement for the component is an error and must be repaired as described in the next section.

Repairing Incorrect MappingsAny incorrect statements are displayed in red in the message panel. Errors can occur for a number of reasons. For example,

• a required component has no statement, and therefore must be specified

• the message schema has changed and existing statements may no longer be valid

• the XPath formula for a component may contain an error

You should correct any errors before attempting to execute your mediation flow. If you hover the cursor over any red component name in the message panel, a popup appears that describes the error.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 107: Active Matrix Service Bus Design Guide

Mappings | 87

To help find potential problems in your mappings, click the Show Check and Repairs button on the toolbar. This button displays a dialog with all potential problems in the specified mappings. You can select the Fix checkbox for potential errors, and the software will attempt to automatically fix the problem.

Some potential problems in the Show Check and Repairs dialog cannot be fixed easily, and therefore there is no checkbox in the Fix column for these items. For example, if a component expects a string and you supply a complex type, the corrective action to fix the problem is not clear, and therefore the problem cannot be automatically fixed. You must repair these items manually.

You can delete mappings by selecting the desired parent or child component and clicking the Remove Mappings button in the toolbar. If a child component is selected, the component is returned to its original state and no mapping is specified. If a parent component is selected, mappings for all child components are also removed.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 108: Active Matrix Service Bus Design Guide

88 | Chapter 6 Transform Tasks

XPath

The Input tab uses XPath as the language for locating and manipulating data. XPath (XML Path Language) is an expression language developed by the World Wide Web Consortium (W3C) for addressing parts of XML documents. XPath also has basic manipulation functions for strings, numbers, and booleans. To use XPath in the Input tab, you need only be familiar with the basic XPath concepts, but you might want to learn more about XPath when building complex expressions. For a complete description of XPath, refer to the XPath specification (which can be obtained from www.w3.org).

Addressing Schema ComponentsAll data in the context and message panel is represented as an XML schema. The data can be simple (strings, numbers, booleans, and so on), or it can be a complex component. Complex components are structures that contain other schema components, either simple components or other complex components. Both simple and complex components can also repeat. That is, they can be lists that store more than one component of the given type.

XPath is used to specify which schema component you would like to refer to. For example, this schema may be available in the context panel:

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 109: Active Matrix Service Bus Design Guide

XPath | 89

The context panel of the example illustrates the schema available for a mediation operation. There are three top-level items, each a root node in the context panel: MediationFlowProperties, MessageContext, and MessageData. Each of these nodes has its own associated structure, for example, MediationFlowProperties has a complex component named properties and MesageData has a complex component named searchHotelRequest.

References to a particular data item in any of these schema start with the root node and then slashes (/) indicate a path to the desired data component. For example, the country element in the SearchHotel complex component that is in the paramenters component would look like this in an XPath mapping field:

$MessageData/searchHotelRequest/parameters/searchHotel/country

The path starts with a dollar sign, then continues with node names using slashes, like a file or directory structure, until the desired location is named.

Some schema components must be prefixed with their namespace prefix. The prefix is automatically added to components that require this when dragging and dropping data in the XPath Expression field.

Evaluation ContextXPath also has a method for referencing relative paths from a particular node. If you have an evaluation context, or a particular starting node in a schema tree, you can specify the relative path to other elements in the tree.

For example, if your evaluation context is $MessageData/searchHotelRequest/parameters/searchHotel, then you can reference the sub-items of ShipName without specifying the entire path. If you want to reference $MessageData/searchHotelRequest/parameters/searchHotel/country, the relative path would be ./country. The path is relative to the evaluation context — country is at the same level in the schema tree as the evaluation context.

Search PredicatesAn XPath expression can have a search predicate. The search predicate is used to locate a specific element of a repeating schema item. For example, consider a schema where the $MessageData/searchReservations/todaysReservations item is a repeating element. If you want to select only the first item in the repeating element, you would specify this:

$MessageData/searchReservations/todaysReservations[1]

The [1] specifies the first element of a repeating item.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 110: Active Matrix Service Bus Design Guide

90 | Chapter 6 Transform Tasks

Sub-items can also be examined and used in a search predicate. For example, to select the element whose reservationId is equal to "3A54", you would specify:

$MessageData/searchReservations/todaysReservations[reservationId="3A54"]

In the example above, the evaluation context of a predicate is set to the item containing the predicate. Therefore, reservationId is assumed to be within the todaysReservations component.

You can also use functions and expressions in the search predicate. For example, if you want to find all elements after the first, you would specify:

$MessageData/searchReservations/todaysReservations[position()>1]

Testing Boolean ValuesTo test the value of a boolean node, you can use the data() function to obtain the value of the node. A common error in XPath functions is to supply a boolean node in a condition and expect that the condition will evaluate to true or false based on the value in the node. For example:

if ($MessgeData/searchHotelRequest/parameters/searchHotel/nonSmoking) then ...

The condition in the if statement above would return true when the nonSmoking component is present, regardless of whether the value of the component is true or false. To evaluate the value of a boolean element, use this expression:

if (data($MessageData/searchHotelRequest/parameters/searchHotel/nonSmoking)) then ...

You can also use the string() function to coerce the comparison to the string value of the boolean node and then compare to the value of "true" or "false". For example:

string($MessageData/searchHotelRequest/parameters/searchHotel/nonSmoking) = "true"

CommentsYou can add comments to XPath expressions using the XPath 2.0 syntax for comments. The syntax is:

{-- <comment here> --}

For example, this XPath expression contains a comment:

$MessageData/searchHotelRequest/parameters/searchHotel/country {-- returns the country --}

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 111: Active Matrix Service Bus Design Guide

| 91

Chapter 7 Query Database Tasks

The Query Database task can be used to look up information in a database by performing a SQL SELECT statement. This chapter describes the Query Database task.

Topics

• Overview of Query Database Tasks, page 92

• JDBC Shared Resource Profiles, page 93

• Configuring a Query Database Task, page 94

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 112: Active Matrix Service Bus Design Guide

92 | Chapter 7 Query Database Tasks

Overview of Query Database Tasks

The Query Database task performs a SQL SELECT statement on a database. The task can specify one or more tables in the FROM clause of the SELECT statement, one or more columns to return in the SELECT list, and one or more conditions in the WHERE clause. You can also optionally specify the maximum number of rows to return.

The Query Database task can be used to lookup data in a database table to enrich the data available in a mediation flow. One particular usage scenario is to store service names and namespaces for dynamically bound service references in a database table. You can then update the database table when a new service becomes available, and the mediation flow does not need to be altered to obtain the information about the new service. Another usage scenario is using a database query to add information to an incoming request. For example, an incoming request may specify a US postal zip code, and a database query can be used to look up the city and state to add this information to the request.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 113: Active Matrix Service Bus Design Guide

JDBC Shared Resource Profiles | 93

JDBC Shared Resource Profiles

Shared resource profiles are defined on the mediation flow and are used to specify a shared resource (such as a database connection) that can be used by one or more tasks in a mediation flow.

The database connection used for each Query Database task is provided by a shared resource profile specified on the Shared Resource Profiles property tab of the mediation flow.

If you want to connect to more than one database or use different user accounts, create one shared resource profile for each database connection. Query Database tasks that use the same shared resource profile will use the same database connection.

To define a shared resource profile:

1. Navigate to the Properties tab of a mediation flow by clicking on the canvas of a mediation flow in the editor window.

2. Click the Shared Resource Profiles tab in the Properties view.

3. In the Profile Name column, click the ellipsis (...) to add a new profile to the list.

4. By default, the profile name is specified as profilen (where n is incremented for each newly added profile). Specify a new name for the profile, if desired.

The value in the Type column must be JDBC (this value is read-only).

5. In the Shared Resource for Design Testing column, click the ellipsis (...) button to choose a JDBC shared resource.

6. You can optionally specify a JDBC Shared Resource for use while creating Query Database tasks. JDBC Shared Resources define connections to databases. You can find a complete description of JDBC Resources in Chapter 3, Creating and Configuring Shared Resources in TIBCO ActiveMatrix Composite Editor User’s Guide.

A JDBC shared resource specified in the shared resource profile can be used to establish a connection to a database and obtain table and column information to complete the SELECT statement. This shared resource is only used during design, it is ignored when the mediation flow is used in a composite and deployed. Shared resource profiles must be associated with JDBC shared resources at the component or composite level, and you can also override JDBC resources at deployment time in the ActiveMatrix Administrator interface. See TIBCO ActiveMatrix Composite Editor User’s Guide for more information about shared resources and the Administrator interface.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 114: Active Matrix Service Bus Design Guide

94 | Chapter 7 Query Database Tasks

Configuring a Query Database Task

The following sections describe the configuration tabs of the Query Database task.

General TabOn the General properties tab, you can specify a name and description. You must also select one of the shared resource profiles defined for the meditation flow. See JDBC Shared Resource Profiles on page 93 for more information about shared resource profiles.

The Max Row Count field allows you to specify the maximum number of rows to accept from the query results. For example, you can specify a positive integer, such as 1, to return only one row. You can also select Unlimited from the drop-down list to allow an unlimited number of rows in the result set.

Use the Query Timeout field to specify the timeout, in seconds, for a query statement to execute before an exception is thrown.

Query TabYou use the Query tab to define the SELECT statement for the query.

Clicking the connection button opens a connection, if you have specified a shared resource in the mediation flow Shared Resources Profile tab, and compares the table and column data with the metadata from the database. If the connection is not successful, an error notifies you of the reason.

Three lists enable you to select tables, input data, and output columns for use in the WHERE clause of your SELECT statement.

Clicking the connection button tests the connection and verifies table and column data.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 115: Active Matrix Service Bus Design Guide

Configuring a Query Database Task | 95

Input data is used in the WHERE clause of your SELECT statement. Use the add (+) and delete (x) buttons to the right of each list to add and delete items from each list:

• When a database connection is present and valid, the + buttons display information from the database for selecting tables and output columns.

• When no database connection is present, the + buttons allow you to add items to each list, but you must name each item and specify a type if necessary.

Clicking the + and x buttons on the Input table attempt an automatic update of the WHERE condition. If you have modified the WHERE condition, the delete might not update it and you must fix it manually.

Use the Where Condition field on the Query tab to edit the WHERE clause of the query. You can add an input variable to a condition by typing a question mark (?) in the condition. Each input variable appears in the mapper panel on the Input tab, and you can supply data from the mediation exchange for the input variable. For example, if you want to create a condition where you look up a zip code supplied in the input message, you can add the condition table.ZIP = ?. When you add a question mark into the WHERE clause, an input variable appears in the Input Data list. Supply a name for the input variable, then data from the mediation exchange can be mapped to the input variable.

Table join conditions are never automatically added to the WHERE clause, so you must manually edit the WHERE clause to specify any join conditions for your query.

The SQL Statement field displays a read-only version of the query you have specified. Table 11 lists the supported SQL types and how they map to XML. Note that length parameters are stripped from the SQP Type, and only the base type is used in the mapping—for example, char(12) becomes char.

Table 11 Supported SQL types and their mapping to XML

SQL/92 Data Type XML Type Equivalent

TINYINT short

SMALLINT short

INTEGER int

BIGINT long

REAL float

FLOAT float

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 116: Active Matrix Service Bus Design Guide

96 | Chapter 7 Query Database Tasks

Vendor-specific types are cast to string. You can enable the mapper to automatically recognize these types in one of these ways:

• Force vendor-specific types to a compatible XML type using the mapper cast.

• Override the type that is retrieved from the database for the column to a similar SQL/92 type.

Input TabThe Input tab displays a mapper panel containing any input variables you defined on the Query tab. Use the mapper panel to supply the data from the mediation exchange for the input variables. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapper panel.

Output TabThe Output tab is a read-only display of the output schema for this task. The output schema is determined by the output columns selected on the Query tab.

DOUBLE double

CHAR string

VARCHAR string

NCHAR string (multi-byte)

NVARCHAR2 string (multi-byte)

DATE date

TIME time

TIMESTAMP dateTime

Table 11 Supported SQL types and their mapping to XML

SQL/92 Data Type XML Type Equivalent

Binary or other complex data types such as JAVA_OBJECT are not supported.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 117: Active Matrix Service Bus Design Guide

Configuring a Query Database Task | 97

Test TabUse the Test tab to supply test data for values of input variables and test the query against the database associated with the specified shared resource profile. There must be a valid database connection present to test the statement.

You must have a valid JDBC shared resource associated with the shared resource profile used by this task. The JDBC shared resource is used only in the design environment.

It is important for you to ensure that the JDBC shared resource you use for testing in the design environment connects to a database that is similar to the database used when the project is put into production.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 118: Active Matrix Service Bus Design Guide

98 | Chapter 7 Query Database Tasks

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 119: Active Matrix Service Bus Design Guide

| 99

Chapter 8 Dynamic Binding

Dynamic binding allows you to dynamically route requests to target services at runtime. This chapter describes dynamic binding.

Topics

• Overview of Dynamic Binding, page 100

• Configuring Dynamic Target Interfaces, page 104

• Setting the Dynamic Reference Task, page 106

• Configuring Dynamic References in Composite, page 111

• Creating and Deploying Composites Used By Dynamic Binding, page 112

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 120: Active Matrix Service Bus Design Guide

100 | Chapter 8 Dynamic Binding

Overview of Dynamic Binding

Dynamic binding allows you to dynamically route incoming requests to target services at runtime. As described in Mediation Components on page 32, target interfaces in a mediation flow correspond to component references in an ActiveMatrix composite. Typically, a component reference is wired to a composite reference that points to a service provider. This static binding is specified when the mediation component and composite are designed, and the service binding is hard-coded into the composite. Dynamic binding allows components to supply a reference to the service provider when the service assembly created from the composite is running.

Figure 32 illustrates the differences between static and dynamic binding in composite references.

Figure 32 Static and dynamic binding

The composite reference is statically bound to Service A. However, the dynamic composite reference can invoke Service B, Service C, or Service X without having to specify a static configuration at design time. Dynamic references allow the component to specify which service to invoke. Therefore, new services can be started and a component can invoke those services without redesigning the composite and restarting the service assembly created from the composite.

Composite

Mediation Component

Composite ReferenceComposite

ServiceComponent

Service

ComponentReference

DynamicCompositeReference

Dynamic

ReferenceComponent

Service A

Service B

Sevice C

Service X

Service Providers

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 121: Active Matrix Service Bus Design Guide

Overview of Dynamic Binding | 101

One example of using dynamic references is a set of services that return information for United States postal zip codes. The consumer sends a message to a mediation component containing the zip code. The service provider can implement a number of services for particular zip codes. Often, new zip codes are introduced. Dynamic binding allows the service provider to create and start a new service for a new zip code without changing any existing composites. Requests for information about the new zip code can be gracefully handled without any system downtime.

Service Providers for Dynamic Composite ReferencesIn this release, dynamic composite references can only refer to AMX services. That is, the service type in the provider composite cannot be JMS or SOAP. If your service provider uses the SOAP or JMS protocol, you can create a simple pass-through composite that passes the message to the ultimate service provider.

Figure 33 illustrates a dynamic composite reference using a composite that implements a service and also using a pass-through composite for referencing a SOAP service.

Figure 33 Service providers and pass-through composites

Service providers must be deployed in the same node as the composite containing the dynamic composite reference. Service providers, however, can invoke services that execute outside of the current node, if necessary.

Composite

Mediation Component

ComponentService

Dynamic

ReferenceComponent Service B

Pass- ThroughComposite

Composite Service

AMX

ReferenceCompositeSOAPAMX Dynamic

CompositeReference

Composite Implementing a Service

Composite Service

AMXJava Component

Composite Service

Service Providers

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 122: Active Matrix Service Bus Design Guide

102 | Chapter 8 Dynamic Binding

Referring to Service Providers

The component implementation determines the service that should be invoked for a dynamic reference. To specify the service, the implementation supplies the service name and service namespace. ActiveMatrix resolves the service name and service namespace to the correct running service within the node.

The service name is the name specified for the AMX service in the composite (either a composite implementing a service or a pass-through composite). The service namespace is the namespace specified on the General tab of the Properties view of the composite that provides or passes-through to the service.

Figure 34 illustrates the location of the service name and service namespace in the service provider composite.

Figure 34 Locating the service name and service namespace of the service provider

Configuring Dynamic BindingTo configure your application to use dynamic binding, perform the following general procedure:

Composite NamespaceServiceName

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 123: Active Matrix Service Bus Design Guide

Overview of Dynamic Binding | 103

1. Configuring Dynamic Target Interfaces — add target interfaces to a mediation component and specify that the interfaces are dynamic.

2. Setting the Dynamic Reference Task — add the Set Dynamic reference task to your mediation path.

3. Configuring Dynamic References in Composite — create a component reference, specify that it is dynamic, then wire the dynamic component reference of the mediation component to the dynamic composite reference.

4. Creating and Deploying Composites Used By Dynamic Binding — create composites with AMX services that either implement the desired service or pass-through to a SOAP or JMS service.

The remaining sections in this chapter describe how to perform each of the steps to configure dynamic binding.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 124: Active Matrix Service Bus Design Guide

104 | Chapter 8 Dynamic Binding

Configuring Dynamic Target Interfaces

Target interfaces in a mediation flow can be specified as either static or dynamic. By default, a target interface is static and the target interface corresponds to a component reference that is wired to a composite reference in a composite. Dynamic target interfaces correspond to dynamic component references that are wired to dynamic composite references.

Marking a Target Interface as DynamicThe Dynamic Target field on the General tab of the Properties view of a target interface specifies whether the interface is static or dynamic. By default, this field is unchecked, signifying the interface is static. When the Dynamic Target field is checked, the target interface is dynamic. The title bars of dynamic target interfaces are shaded yellow and a lightning bolt icon is added to distinguish dynamic interfaces from static target interfaces.

Figure 35 illustrates setting the Dynamic Target field for a target interface and shows the color and icon of the title bars of dynamic interfaces.

Figure 35 Dynamic and static target interfaces

The lightning bolt icon and yellow shading show that this target is dynamic...

...as specified by the Dynamic Target setting.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 125: Active Matrix Service Bus Design Guide

Configuring Dynamic Target Interfaces | 105

Using Pattern VariablesOnce a target interface is marked as dynamic, the service name and service namespace must be supplied in the mediation flow. You can optionally specify pattern variables to aid in the mapping of data in the mediation exchange to create the appropriate service name and service namespace.

For example, you may have six operations in your dynamic target interface. All service providers that will be referenced use the same namespace and the service name follows the pattern servicedata, where data is a variable portion of the service name. The value of data is supplied in an incoming message. Instead of providing a mapping for each of the six operations, you can specify one pattern variable to represent the variable portion of the service name, and then create one mapping for all operations on the Pattern Map tab of the Properties view of the target interface. Figure 36 illustrates the Pattern Map tab of this example.

Figure 36 An example of pattern variables

In Figure 36, a constant is used in the serviceNamespace element because all referenced services use the same namespace. To supply the value of the pattern variable, you can perform one simple mapping in a Set Dynamic Reference task on the path for each mediation operation. See Setting the Dynamic Reference Task on page 106 for more information about the Set Dynamic Reference task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 126: Active Matrix Service Bus Design Guide

106 | Chapter 8 Dynamic Binding

Setting the Dynamic Reference Task

The Set Dynamic Reference task provides the values needed for resolving a service provider in a dynamic target interface. Each Set Dynamic Reference task sets the value of the service provider for the specified dynamic target interface. The value is then used by the next item that refers to a dynamic target interface — either the end of the mediation path points to a dynamic target interface, or an Invoke task invokes an operation on a dynamic target interface.

You might need more than one Set Dynamic Reference task along a mediation path in these situations:

• The target interface is marked as dynamic and there is an Invoke task on the path configured invoke a different dynamic target interface.

• There are more than one Invoke tasks on a path, and each task invokes a different dynamic target interface.

• You want to Invoke the same operation on a dynamic target interface more than once, and each time you want to set the dynamic reference to a different value.

Figure 37 illustrates the usage cases of the Set Dynamic Reference task.

A grey hint line appears between the Set Dynamic Reference task and the corresponding dynamic target interface. A yellow hint line appears between a Set Dynamic Reference task and the corresponding Invoke task when you select a Set Dynamic Reference task in the mediation flow. In Figure 37, the diagrams have been altered to show all hint lines, even though only the hint lines for the selected task can be viewed in the mediation editor.

The Set Dynamic Reference task is typically used on input mediation paths, but it can be used on output or fault paths when an Invoke task that invokes an operation on a dynamic target interface appears on an output or fault path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 127: Active Matrix Service Bus Design Guide

Setting the Dynamic Reference Task | 107

Figure 37 Usage cases for Set Dynamic Reference task

Configuring the General TabThe General tab allows you to specify the name and description of the Set Dynamic Reference task. There two additional fields on the General tab:

• Dynamic Target Interface specifies the name of the dynamic target interface for which this task is supplying the service name and namespace. By default, this

One dynamic target interface and one Set Dynamic Reference task.

Two dynamic target interfaces and twoSet Dynamic Reference task. The first Set Dynamic Reference task sets the reference for the target operation. The second Set Dynamic Reference task sets the reference for the Invoke task.

Two Invoke tasks, each executing different operations on the same interface. The first Set Dynamic Reference task sets the reference for the first Invoke task. The second Set Dynamic Reference task sets the reference for the second Invoke task. A different service provider can be

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 128: Active Matrix Service Bus Design Guide

108 | Chapter 8 Dynamic Binding

field is automatically set to the dynamic target interface at the other end of the path. If there is an Invoke task on the path, this field may be set by default to the first dynamic target interface in the target interface list. You might need to set this field when the default choice does not match the dynamic target interface that you want to set.

• Endpoint Reference Mechanism select one of the following for the mechanism to use for setting the service name and service namespace:

— Service & Namespace select this option when you want to supply the service name and service namespace. The serviceName and serviceNamespace elements appear in the Input tab for mapping. Any values you supply in the Input tab override any pattern variables specified on the dynamic target interface.

— Pattern Variables select this option when you want to use pattern variables from the dynamic target interface. This is useful if several operations in a dynamic target interface use a similar pattern for the service name and service namespace. You can specify the mapping once on the dynamic target interface and use variables to supply the variable portion. The variables you create on the dynamic target interface appear in the Input tab when this option is selected. You can then provide simpler mappings of data from the mediation exchange to the value of each variable instead of providing the same mapping for each operation.

By default, the Endpoint Mechanism field is set to Service & Namespace when the dynamic target interface has no pattern variables. If the dynamic target interface has pattern variables, the Endpoint Mechanism field is set to Pattern Variables by default.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 129: Active Matrix Service Bus Design Guide

Setting the Dynamic Reference Task | 109

Specifying the InputWhen the Endpoint Reference Mechanism field on the General tab is set to Service & Namespace, the input elements for this task are serviceName and serviceNamespace. Any value you specify for these input elements override the value specified on the Pattern Map tab of the specified dynamic target interface.

When the Endpoint Reference Mechanism field on the General tab is set to Pattern Variables, then the pattern variables defined on the specified dynamic target interface are the input elements. This allows you to specify simple mappings of data from the mediation exchange to the variable values. The variable values are then passed to the mapping supplied on the Pattern Map tab of the dynamic target interface.

The Service & Namespace setting.

Input elements defined for this task.

The Pattern Variables setting.

Pattern mapping on the dynamic target interface.

Input elements on the dynamic target interface.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 130: Active Matrix Service Bus Design Guide

110 | Chapter 8 Dynamic Binding

Use any data available in the mediation exchange on the left side of the mapper panel to provide data to the input values. See Chapter 6, Transform Tasks, on page 63 for more information about mapping data in the Input tag.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 131: Active Matrix Service Bus Design Guide

Configuring Dynamic References in Composite | 111

Configuring Dynamic References in Composite

Dynamic target interfaces in a mediation flow correspond to dynamic component references in mediation components that use the mediation flow as an implementation. Dynamic component references must be wired to dynamic composite references in an ActiveMatrix composite.

Composite references of type ActiveMatrix can be configured to be dynamic references by checking the Dynamic Binding field on the General tab of the Properties view of the ActiveMatrix composite reference. Once the Dynamic Binding field is checked, the Endpoint specification on the Binding tab of the composite reference becomes disabled because the endpoint must be supplied by the implementation of the mediation component.

See TIBCO ActiveMatrix Composite Editor User’s Guide for more information about creating and configuring composite references.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 132: Active Matrix Service Bus Design Guide

112 | Chapter 8 Dynamic Binding

Creating and Deploying Composites Used By Dynamic Binding

TIBCO ActiveMatrix resolves the service name and service namespace provided by a component to a running service assembly that contains the corresponding AMX service. The composite with the corresponding AMX service can implement a service or it can pass-through to another service using the SOAP or JMS protocol as described in Service Providers for Dynamic Composite References on page 101.

You can create composites using the Composite Editor, or you can use the automatic mechanism in the Mediation Editor to create composite services that a dynamic target interface can use.

To use the automatic mechanism:

1. Click the down-arrow menu icon in the title bar of a dynamic target interface in a mediation flow and select Create Dynamic Provider from the pop-up menu.

2. This dialog appears for configuring your composite:

3. Specify the service name and namespace in the fields provided.

4. Click the Browse button next to the Workspace location field to locate the project and folder in your workspace where you would like to place the composite.

5. Click OK.

The provider composite created with the wizard is configured with an AMX service with the specified name and namespace. The port type and WSDL location for the service are set to the target interface in the mediation flow. You can then configure the remainder of your service provider.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 133: Active Matrix Service Bus Design Guide

| 113

Chapter 9 Replying to Messages

In certain situations, your mediation flow may need to send a reply message without invoking the target operation. This chapter describes using the Generate Reply and Handle Reply tasks.

Topics

• Overview of Reply Messages, page 114

• Working With Reply Messages, page 116

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 134: Active Matrix Service Bus Design Guide

114 | Chapter 9 Replying to Messages

Overview of Reply Messages

In a typical mediation flow for an operation with an in-out message exchange pattern, incoming messages travel along the input path until the message is delivered to the target operation or a fault is encountered. In some situations, you might want to send a reply message to the consumer without invoking the target operation.

For example, an operation might return the name of the target service. The mediation flow already has the target service name, so you can improve performance and return that information without additional network traffic to the target service. Another example is a mediation flow with a route task for processing incoming requests. Your mediation flow might return an unchangeable message for one or more routing cases. In that case, you can reply to the consumer without invoking the target service.

The Generate Reply task can be placed on an input path to terminate the path and pass control to the output path of the mediation flow. You must map the output message in the Generate Reply Input tab, so that the output message is created in the task.

On the output path, the Handle Reply task intercepts messages from any Generate Reply tasks on the input path and starts the mediation reply path for processing the reply message before it is sent to the consumer.

Figure 38 illustrates the operation of the Generate Reply and Handle Reply tasks. In this example, a mediation flow for the createUser operation first invokes the queryUser operation to determine if the user exists. If the user does not exist, the message is delivered to the createUser target operation. If the user already exists, the Generate Reply task is used to return a message notifying the consumer that the user already exists.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 135: Active Matrix Service Bus Design Guide

Overview of Reply Messages | 115

Figure 38 Sending a reply message

Placing a Generate Reply task in the Input path automatically creates a mediation reply path with a Handle Reply task. All Generate Reply tasks in the Input path are handled by the same Handle Reply task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 136: Active Matrix Service Bus Design Guide

116 | Chapter 9 Replying to Messages

Working With Reply Messages

The Generate Reply task terminates an input path before reaching a target operation. However, you can have more than one Generate Reply task on an input path when a route task splits the input path into multiple sub-paths. One or more sub-paths can end in a Generate Reply task. However, only one Generate Reply task is executed for each incoming message for the mediation flow.

Figure 39 illustrates setting the reply message.

Figure 39 Setting the reply message

After a Generate Reply task is executed, control is passed to the Handle Reply task on the output path. There is one Handle Reply task that accepts reply messages from any Generate Reply task on the input path. The Handle Reply task starts the mediation reply path. Optionally, you can place tasks on the mediation reply path to perform additional processing before the reply message is sent to the consumer. The Handle Reply task and the mediation reply path are automatically placed into the mediation flow when a Generate Reply task is placed on the input path.

Figure 40 illustrates the output path containing a Handle Reply task and the mediation reply path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 137: Active Matrix Service Bus Design Guide

Working With Reply Messages | 117

Figure 40 Setting the reply message

One Handle Reply task handles reply messages from any Generate Reply task. The Handle Reply task starts the mediation reply path. Optionally, you can place other tasks on the mediation reply task to execute before the reply is set to the consumer.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 138: Active Matrix Service Bus Design Guide

118 | Chapter 9 Replying to Messages

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 139: Active Matrix Service Bus Design Guide

| 119

Chapter 10 Faults

Faults are errors that occur during processing. The Mediation Flow Editor allows you to specify a fault path for processing to occur when a fault is encountered. This chapter describes fault processing.

Topics

• Overview of Faults, page 120

• Throwing Faults in Mediation Flows, page 123

• Working With Fault Paths, page 125

• Sending Faults to the Invoker, page 128

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 140: Active Matrix Service Bus Design Guide

120 | Chapter 10 Faults

Overview of Faults

Faults are errors that can occur at any point along the mediation path. Faults can also be thrown by the target service while processing messages. Faults can also be explicitly thrown during a mediation flow to specify that an unhandled case has occurred.

Invoke tasks, like any other task, can generate faults. If an operation referenced by an Invoke activity declares faults, those faults can be caught and processed in the fault path. For example, if the operation declares that it can throw FaultA and FaultB, these faults appear in the Fault Path as faults that can be caught and processed.

Figure 41 illustrates the points along the mediation path where faults can occur.

Figure 41 Examples of where faults can occur

When a fault is encountered, processing of the current path is immediately halted and control is passed to the fault path. The fault path allows you to catch explicitly declared faults or unhandled faults. However, if a fault is encountered when receiving the message, the mediation flow has not yet started, so the fault is immediately returned to the sender and no fault processing can be done in the mediation flow.

Figure 42 illustrates a fault path.

faults can occur when receiving the message and creating the mediation flow context

faults can occur when executing tasks in input or output or fault paths of the mediation flow

faults can occur when executing the target operation

faults can be explicitly thrown with the Throw Fault activity

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 141: Active Matrix Service Bus Design Guide

Overview of Faults | 121

Figure 42 An example fault path

By default, each target operation has one Catch Fault task that has a sub-path for each declared fault that can be thrown by the operation and one sub-path to handle any undeclared faults. There is also one Catch Fault task for faults that occur during processing of the mediation flow. You can configure each Catch Fault task to have fewer sub-paths, if desired. When you remove sub-paths from a Catch Fault task, the Catch All path is automatically added to catch any faults where there is no specific sub-path for fault handling.

Each sub-path from each Catch Fault task leads to a Send Fault task that sends a fault back to the original sender of the message. By default, the Send Fault task is configured to send the specific fault caught by the sub-path. You can configure the Send Fault task on a either a target or mediation fault sub-path to send either a generic UndeclaredFault or one of the specific fault messages defined on the mediation operation. When the fault sent by the Send Fault task does not match the fault caught by the sub-path, a Transform activity is required to transform the fault message into the required format. For faults on the mediation fault path, the Transform activities are added by default, but if you alter the configuration of the Send Fault or Catch Fault tasks, you must provide the correct Transform task as well.

Catch Target Fault task, which catches faults that occur in the searchHotel target operation

Catch Mediation Task Fault, which catches faults that occur in the mediation

Target declared fault path

Mediation task fault path

Target undeclared fault path

Mediation task runtime fault path

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 142: Active Matrix Service Bus Design Guide

122 | Chapter 10 Faults

You can place mediation tasks along the sub-paths between the Catch Fault activities and Send Fault activities to perform post-fault processing before the fault is returned to the original message sender.

See Working With Fault Paths on page 125 for more information about how to configure the Catch Fault and Send Fault tasks.

All faults encountered when processing tasks in a mediation flow halt processing and send control to the mediation fault path. This includes any faults that occur when processing tasks on a target fault path. If a fault is encountered in a task on the mediation fault path, processing of the mediation fault path is halted and an EngineFault is returned to the original invoker of the mediation operation.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 143: Active Matrix Service Bus Design Guide

Throwing Faults in Mediation Flows | 123

Throwing Faults in Mediation Flows

The Throw Fault mediation task allows you to explicitly throw a fault during processing on the input path of a mediation flow. This is useful in these situations:

• You want to deprecate a mediation operation, and therefore a fault is sent to all clients that request that operation.

• You want to specify routing cases where a fault should be sent.

For example, if a loan processing application cannot process loans over $5,000,000, then you would configure a routing case for the loan request operation to examine the loan amount and place a Throw Fault task on the sub-path for the case where the loan amount was over $5,000,000.

The Throw Fault task allows you to browse through the available service descriptors and select messages from the service to send as the fault message. You can also select the MediationTaskFault message to send. If you have more than one Throw Fault task and you want to perform specific processing for each task, configure each task to send a specific message.

Figure 43 illustrates how to configure the Throw Fault task to send a specific message.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 144: Active Matrix Service Bus Design Guide

124 | Chapter 10 Faults

Figure 43 Example of configuring the Throw Fault task

On the Select WSDL Message dialog: a. Select the WSDL file in the Matching Resources field.b. Select the container holding the service descriptor in the Container field.c. Select the message in the Available Notes field.

1

2

3

On the Fault tab, click Browse to select a service descriptor containing the fault message to send:

The Throw Fault activity is configured to throw the desired message, and you can navigate to the WSDL by clicking the WSDL Location field label:

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 145: Active Matrix Service Bus Design Guide

Working With Fault Paths | 125

Working With Fault Paths

Fault paths allow you to specify tasks to perform when a fault is thrown. The Show Fault Direction button at the top of the mediation paths area of the mediation flow editor allows you to view the fault path for the currently selected mediation operation. There is one Catch Fault task for each target operation in the mediation flow and one Catch Fault task for faults encountered while processing the mediation flow.

Catching Faults From the Target Operation Each target operation in a mediation flow has a Catch Fault task that catches faults thrown by the target operation. The faults can be either explicitly defined faults in the target operation’s service description, or they can be unhandled exceptions encountered during processing (for example, a NullPointerException).

The default Catch Fault task for a target operation has sub-paths for each declared fault in the target operation and one sub-path for any undeclared faults. You can place mediation tasks on each sub-path to perform any post-fault processing for each fault. If you want to specify the same processing for multiple faults, you can configure the Catch Fault task to have fewer sub-paths by unchecking the Catch and Handle field for the fault. When you eliminate one or more sub-paths, the Catch All sub-path is required and it is automatically enabled. Any faults that do not have a defined sub-path are sent to the Catch All sub-path.

Figure 44 illustrates the Fault tab of the Catch Fault task that allows you to configure the sub-paths for the faults to catch.

Figure 44 Configuring a Catch Fault task

In the example Catch fault task, there is one fault message defined on the target operation named searchHotel_faultMsg. The Catch Fault task also has the following faults listed for all target operations:

• UndeclaredFault Catches any undeclared faults encountered while executing the target operation.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 146: Active Matrix Service Bus Design Guide

126 | Chapter 10 Faults

• Catch All Catches all remaining faults that are not explicitly defined. By default, this option is unchecked. This option becomes required and is automatically checked if you uncheck the Catch and Handle field for any other faults.

When you uncheck the box in the Catch and Handle column for a fault, the Catch All sub-path is automatically added. Figure 45 illustrates the fault path that results when the Catch and Handle box is unchecked for the searchHotel_faultMsg.

Figure 45 Removing specific faults from the target operation fault path

Catching Faults From the Mediation FlowThere is one Catch Fault task that catches faults encountered while processing the mediation flow. Faults in a mediation flow can occur in these situations:

• An explicit fault is thrown with the Throw Fault task. This task can either throw the MediationTaskFault message or it can be configured to throw a different message defined in a service descriptor in the project.

• A mediation task throws the declared MediationTaskFault fault during processing (this also applies to tasks on target fault paths).

• An undeclared exception occurs during mediation processing. In this case, the MediatinTaskRuntimeFault is thrown.

Figure 46 illustrates the Catch Fault task for the mediation flow. In this example, the mediation flow has a Throw Fault task that throws the searchHotel_faultMsg fault, and the MediationTaskFault, MediationTaskRuntimeFault, and catch all options are present in all Catch Fault tasks for mediation flows.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 147: Active Matrix Service Bus Design Guide

Working With Fault Paths | 127

Figure 46 Catch Fault task for the mediation flow

By default, the MediationTaskFault and MediationTaskRuntimeFault sub-paths are configured with Transform tasks that transform the caught fault into an UndeclaredFault message. If you check the Catch and Handle field for any faults declared on the target operation, you must configure the corresponding Send Fault task and provide any required transformations by adding a Transform task to the sub-path, if necessary.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 148: Active Matrix Service Bus Design Guide

128 | Chapter 10 Faults

Sending Faults to the Invoker

The Send Fault task sends a fault message back to the original process that invoked the mediation operation. You can configure the Send Fault task to send either of the following:

• one of the fault messages declared on the mediation operation

• the UndeclaredFault message

Use the drop-down list in the Fault to Send field on the Fault tab of the Send Fault task to specify the fault message to send.

Once you specify the fault message to return, you may need to place a Transform task on the fault path to convert the message sent by the Catch Fault task to the format of the fault message you are returning. The message panel of the Transform task on a fault path is labeled Mediation Fault Message, and the schema of the fault message matches the schema of the message specified in the Send Fault task on the path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 149: Active Matrix Service Bus Design Guide

| 129

Chapter 11 Custom Mediation Tasks

This chapter explains how to create and deploy custom mediation tasks.

Topics

• Overview, page 130

• Support Files, page 132

• Creating the Model Plug-in, page 133

• Creating the UI Plug-in, page 138

• Writing Custom Mediation Code, page 141

• Creating the Runtime Plug-in, page 145

• Packaging Custom Mediation Tasks, page 147

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 150: Active Matrix Service Bus Design Guide

130 | Chapter 11 Custom Mediation Tasks

Overview

Custom mediation tasks are user-defined mediation tasks written to perform specific mediation functions.

Eclipse Plug-insA custom mediation task consists of three Eclipse plug-ins as described in Table 12.

If you created and deployed custom mediation tasks in previous versions of ActiveMatrix ServiceBus, you must migrate them to ActiveMatrix Service Bus 2.1:

1. Import plug-ins in the Service Bus 2.1 design-time environment.

2. Rebuild your old custom mediation tasks.

Table 12 Custom mediation task plug-ins

Plug-in Description

Model Contains the model, which consists of metadata based on the Eclipse Modeling Framework (EMF). The model forms the basis of automatic code generation for the design and runtime environments, and contains attribute-value pairs that can be used in both environments.

This plug-in is used in both the design and runtime environments.

For more information, see Creating the Model Plug-in on page 133.

UI Contains user-interface code and icons. It has extension points for the Properties view and the Mediation Palette in the Mediation Flow Editor.

This plug-in refers to the model and is used in the design environment.

For more information, see Creating the UI Plug-in on page 138.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 151: Active Matrix Service Bus Design Guide

Overview | 131

Runtime Contains Java code that performs the mediation logic

This plug-in refers to the model and is used in the runtime environment.

For more information, see Creating the Runtime Plug-in on page 145.

Table 12 Custom mediation task plug-ins (Cont’d)

Plug-in Description

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 152: Active Matrix Service Bus Design Guide

132 | Chapter 11 Custom Mediation Tasks

Support Files

A custom mediation task might depend on support files such as:

• Schema files that describe the schemas of messages.

• Graphics files that are used as icons for the custom mediation task. Table 13 describes the icons that can be used. The icons can be in either GIF, JPEG, or PNG formats.

Table 13 Icons for custom mediation tasks

Icon Where Displayed Recommended Dimensions

Small Mediation Palette: When the Use Large Icons option is not checked

Paths: When Small Icons is selected in the preferences

16 x 16 pixels

Default icon:

Large Mediation Palette: When the Use Large Icons option is checked

Paths: When Large Icons is selected in the preferences

32 x 32 pixels

Default icon:

In the palette, icons are displayed on a light gray background. On the canvas, icons are displayed on a yellow gradient. For this reason, consider using a combination of hard edges (rather than anti-aliasing) and transparency when designing icons.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 153: Active Matrix Service Bus Design Guide

Creating the Model Plug-in | 133

Creating the Model Plug-in

To create the model plug-in for the custom mediation task:

1. Run Business Studio from the Start menu. For example, select Start > All Programs > TIBCO_HOME > TIBCO Business Studio N.N > TIBCO Business Studio.

2. Select File > New > Project....

3. In the New Project dialog box under Plug-in Development, select Plug-in Project and click Next.

4. Specify a name for the project that reflects the mediation task name and that this is the model plug-in, for example, LookupTaskModel.

Accept all other defaults and click Next.

5. On the Plug-in Content page, uncheck the check boxes for the following options located in the Plug-in Options group:

— Generate an activator, a Java class that controls the plug-in’s life cycle, and

— This plug-in will make contributions to the UI.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 154: Active Matrix Service Bus Design Guide

134 | Chapter 11 Custom Mediation Tasks

Accept all other defaults and click Next.

6. On the Templates page, select Mediation Task Model Wizard and click Next.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 155: Active Matrix Service Bus Design Guide

Creating the Model Plug-in | 135

7. On the Mediation Task Model page, for the Mediation Task Model Name replace the string within the brackets with another of your choice. This prefix will be used for the Mediation Task Names for the UI and Runtime plug-ins.

This figure highlights the string that should be replaced:

For this example, the prefix chosen is Demo.

8. Specify the Java Package Name that will be used for the model plug-in for the custom mediation task. Click Next.

By default, the Java package name will be the same as the project name.

9. (Optional) Select a schema element for the custom mediation task input/output in the Input/Output Schema Selection dialog.

Type the name of the schema, click Browse to see all the schemas in the workspace, or click Create to create a new schema:

Clicking Create opens the Simplified Schema Editor. See Creating Simple Schemas on page 26 for information about using the Simplified Schema Editor.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 156: Active Matrix Service Bus Design Guide

136 | Chapter 11 Custom Mediation Tasks

10. Specify model attributes that the custom mediation task will use. Model attributes can be given values for each instance of the task, by specifying the values on the General tab in the Properties view for the task.

— To add an attribute, click Add. Edit the attribute name and add default values for the attribute. Click the Types cell to display a drop-down list of types and select the attribute type from the list.

— To remove an attribute, highlight the row for the attribute by clicking in one of the cells on the row, and click Remove.

This figure shows an example of a new model attribute:

11. Click Finish.

12. Business Studio displays the Open Associated Perspective dialog box, which asks whether you want to open the Plug-in Development perspective.

Optionally, check the check box Remember my decision. Click Yes. Business Studio opens the model plug-in and the Plug-in Development perspective.

13. In the Project Explorer, expand the tree for the model plug-in for the custom mediation task.

14. Under the META-INF folder, double-click the manifest file, MANIFEST.MF, to open it.

15. Click the Dependencies tab.

16. Select the org.eclipse.ui plug-in and click Remove.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 157: Active Matrix Service Bus Design Guide

Creating the Model Plug-in | 137

17. Click the Runtime tab.

18. Click Add....

19. Select all packages and click OK.

This figure shows the packages listed in the Package Selection window:

20. Select File > Save to save the manifest file.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 158: Active Matrix Service Bus Design Guide

138 | Chapter 11 Custom Mediation Tasks

Creating the UI Plug-in

To create the UI plug-in for the custom mediation task:

1. Run Business Studio. Select Start > All Programs > TIBCO_HOME > TIBCO Business Studio N.N > TIBCO Business Studio.

2. Select File > New > Project....

3. In the New Project dialog box under Plug-in Development, select Plug-in Project and click Next.

4. Specify a name for the project that reflects the mediation task name and that this is the UI plug-in, for example, LookupTaskUI.

Accept default values for all other fields and click Next.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 159: Active Matrix Service Bus Design Guide

Creating the UI Plug-in | 139

5. On the Plug-in Content page, accept all defaults and click Next.

6. On the Templates page, select Mediation Task UI Wizard.

7. Click Next.

8. On the Mediation Task Model Selection Section, choose the mediation task model plug-in and click Next.

9. On the mediation Task UI page, the prefix that was chosen when for the Mediation Task Name for the Model is displayed. You can either retain this or specify a new one.

10. Specify the Java Package Name that will be used for the UI plug-in for the custom mediation task or accept the default value. Click Next.

By default, the Java package name will be the same as the project name.

11. Specify the location of the small icon for the custom mediation task. The location should be the complete path to the file on your local hard drive. You can click Browse to browse to and select the file.

12. Specify the location of the large icon for the custom mediation task. The location should be the complete path to the file on your local hard drive. You can click Browse to browse to and select the file.

13. Click Finish.

14. Business Studio displays the Open Associated Perspective dialog box, which asks whether you want to open the Plug-in Development perspective.

Optionally, check the check box Remember my decision. Click Yes. Business Studio opens the UI plug-in and the Plug-in Development perspective.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 160: Active Matrix Service Bus Design Guide

140 | Chapter 11 Custom Mediation Tasks

15. In the META-INF folder, double-click the manifest file, MANIFEST.MF, to open it.

16. Click the Build tab.

17. Select the plugin.properties file in the Binary Build section.

18. Save the manifest file.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 161: Active Matrix Service Bus Design Guide

Writing Custom Mediation Code | 141

Writing Custom Mediation Code

Custom mediation code performs operations on MediationExchange in paths, and on specific elements of the message and path contexts.

Accessing Information from SchemasTo access the output element schema at runtime, you must initialize a mediation task report object MediationTaskNameReport. This object has the accessor methods to get the output element schema as XSDElementDeclaration. This code illustrates how to get the output element schemas:

public class <MediationTaskName> extends MediationTaskRT{

public void execute(MediationExchange mediationExchange) throws MediationTaskException {

com.mycompany.mediation.task.model.mymediationtaskmodel.MyMediationTask taskConfig = (com.mycompany.mediation.task.model.mymediationtaskmodel.MyMediationTask) super.getConfig();

MediationTaskNameReport taskReport = new MediationTaskNameReport(taskConfig);

XSDElementDeclaration outputSchemaElementDeclaration = taskReport.getCustomOutputType();}

Modifying the Mediation Task DataThe execute method of mediation task runtime class has MediationExchange as its only argument. The mediation exchange holds the mediation message and mediation flow properties; both of these have DOM document representation. Mediation Properties can also be extracted by using the helper methods provided on the mediation exchange. The mediation message and properties constitute mediation task data.

The message data can be processed in two modes:

• With input type defined: the user can modify the message data using DOM API or can pass it as such.

• Without input type defined: the user can use XSL transformation API to get the transformed input data. User can process it further or can transform into a different output type if the output type is specified.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 162: Active Matrix Service Bus Design Guide

142 | Chapter 11 Custom Mediation Tasks

The following code illustrates processing message data:

public class <MediationTaskName> extends MediationTaskRT{public org.w3.dom.Node execute(MediationExchangemediationExchange) throws MediationTaskFault {

MediationTaskContext mediationTaskContext = this.getMediationTaskContext();

MyMediationTask model =(MyMediationTask) mediationTaskContext.getMediationTaskConfig();

MediationMessage mediationMessage =mediationExchange.getMediationMessage();

//If task input type is not defined //User can do XML operation on this DOM node

//If task input type is defined

// Code to get input mapping XSL stylesheet as string. Query query = model.getInputDataBinding(); String styleSheet = query.getValue()

//XSL Transformation utility to get task input as DOM Node. Node taskInput = TransformerUtils.transform(mediationExchange);}

Defining a JDBC Shared Resource ProfileUser-defined mediation task can support attributes that refer to a JDBC shared resource profile. Developers of the mediation task can use a JDBC shared resource profile to access JDBC connections using the mediation task API provided.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 163: Active Matrix Service Bus Design Guide

Writing Custom Mediation Code | 143

To create such a task, define a JDBC attribute type during the model generation phase, using the model creation page in the mediation task model wizard:

This attribute type is projected by the mediation task's user interface as a combination box that holds references to JDBC shared resource profiles defined at the mediation flow level:

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 164: Active Matrix Service Bus Design Guide

144 | Chapter 11 Custom Mediation Tasks

Categorizing Custom Mediation TasksTo create categories of custom mediation tasks, add the methodgetPaletteGroup method to the MediationTask UI factory class as shown in this example:

public String getPaletteGroup(){

return "Samples";}

In this example, a category Samples is created.

Thrown FaultsThe runtime class for a custom mediation task has an execute method that throws the fault MediationTaskFault. A developer of a custom mediation task can throw this fault explicitly.

Runtime ExceptionsTable 14 explains how runtime exceptions in a custom mediation task are handled.

Table 14 Runtime exception handling for custom mediation tasks

Path Exception Handling

Input Path control is transferred to the Catch Mediation Fault task in the fault path. A Send Fault task in that path sends a message to the service consumer.

Output Path control is transferred to the Catch Mediation Fault task in the fault path. A Send Fault task in that path sends a message to the service consumer.

Fault A fault message is sent to the service consumer.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 165: Active Matrix Service Bus Design Guide

Creating the Runtime Plug-in | 145

Creating the Runtime Plug-in

To create the runtime plug-in for the custom mediation task:

1. Run Business Studio. Select Start > All Programs > TIBCO_HOME > TIBCO Business Studio N.N > TIBCO Business Studio.

2. Select File > New > Project....

3. In the New Project dialog box under Plug-in Development, select Plug-in Project and click Next.

4. Specify a name for the project that reflects the mediation task name and that this is the runtime plug-in, for example, LookupTaskRuntime, as shown in the following figure.

Accept all other defaults and click Next.

5. On the Plug-in Content page, uncheck the check boxes for these options, which are located in the Plug-in Options group:

— Generate an activator, a Java class that controls the plug-in’s life cycle, and

— This plug-in will make contributions to the UI.

6. Accept all other defaults and click Next.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 166: Active Matrix Service Bus Design Guide

146 | Chapter 11 Custom Mediation Tasks

7. On the Templates page of the wizard, select Mediation Task Runtime Wizard.

8. Click Next.

9. On the Mediation Task Model Selection Section, choose the mediation task model plug-in and click Next.

10. Specify the Mediation Task Name. This is a unique name that reflects the nature of the custom mediation task, for example, LookupTask.

11. Specify the Java Package Name that will be used for the runtime plug-in for the custom mediation task. Click Next.

By default, the Java package name will be the same as the project name.

12. Click Next.

13. Select the model plug-in to associate with this runtime plug-in.

14. Click Finish.

15. Business Studio displays the Open Associated Perspective dialog box, which asks whether you want to open the Plug-in Development perspective.

Optionally, check the check box Remember my decision. Click Yes. Business Studio opens the runtime plug-in and the Plug-in Development perspective.

16. In the Project Explorer, expand the tree for the runtime plug-in for the custom mediation task.

17. Under the META-INF folder, double-click the manifest file, MANIFEST.MF, to open it.

18. Click the Dependencies tab.

19. Select the org.eclipse.ui and com.tibco.tpcl.org.slf4j.log4j12 plug-ins listed under Required Plug-ins and click Remove.

20. Click Add... to the right of the Imported Packages list.

21. Select org.slf4j from the Plug-in Selection window and click OK.

22. Save the plug-in.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 167: Active Matrix Service Bus Design Guide

Packaging Custom Mediation Tasks | 147

Packaging Custom Mediation Tasks

Before the Custom mediation tasks are available in the Mediation Flow Editor, you must export the plug-ins to the extension locations that you create for them.

1. Select the Model, UI, and Runtime plug-in projects, right-click, and select Export.

2. Under Plug-in development, select Deployable plug-ins and fragments.

3. Click Next.

4. Specify the destination directory and click Finish to export the plug-ins to the folder plugins.

5. Click Finish.

To create extension locations for the plug-ins:

1. Before creating the extensions

— Create a folder features at the same level as the plugins folder.

— Create an empty file .eclipseextension in the eclipse folder. This file indicates the presence of the extension locations.

2. Click Help> Software Updates> Manage Configuration.

3. Click Add an Extension Location.

4. Select the extension location. Typically this is a folder names eclipse and contains the folders features and plugins and the file .eclipseextension

5. Click OK.

6. Restart Business Studio.

Do not put your plug-ins in the folder ENV_HOME\components\eclipse.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 168: Active Matrix Service Bus Design Guide

148 | Chapter 11 Custom Mediation Tasks

The custom mediations tasks are now available in the palette of the Mediation Flow Editor as shown in this figure:

Deploying

When mediation flows that contain custom mediation tasks are packaged into a service assembly, the JAR files for the custom mediation tasks are included automatically.

For more information about creating the service assembly and deployment, refer to TIBCO ActiveMatrix Administration.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 169: Active Matrix Service Bus Design Guide

| 149

Chapter 12 Reference

This chapter describes the configuration tabs for tasks and resources used in mediation flows.

Topics

• Catch Fault, page 150

• Generate Reply, page 151

• Handle Reply, page 152

• Invoke Operation, page 153

• Log, page 155

• Parse XML, page 157

• Query Database, page 160

• Render XML, page 164

• Route, page 167

• Send Fault, page 171

• Set Exchange Variable, page 172

• Throw Fault, page 174

• Transform, page 175

• XPath Route, page 176

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 170: Active Matrix Service Bus Design Guide

150 | Chapter 12 Reference

Catch FaultTask

The Catch Fault task specifies the faults that you want to catch from a target operation or a mediation flow.

Catch Fault tasks appear automatically in Fault paths. Catch Fault tasks do not appear in the palette, and you cannot add these tasks

manually.

See Chapter 10, Faults, on page 119 for more information about fault processing.

Fault TabThe Fault tab allows you to select or unselect specific faults to catch and handle. Selecting specific faults to catch creates a sub-path for each selected fault so that you can specify processing to perform for that fault before the fault is returned to the original environment. Check the box in the Catch and Handle column for the fault you want to catch. These are the types of faults you will see in the Fault column on this tab:

Item in Fault Column Description

declared fault message The target operation, the Throw Fault task, and the Invoke Operation task can throw a declared fault message. The content and structure of the message varies, depending upon its declaration in the WSDL file.

UndeclaredFault An undeclared fault that occurs while invoking the target operation returns this fault message.

MediationTaskFault A declared fault that is thrown by one of the tasks in the mediation operation.

MediationTaskRuntimeFault An undeclared fault that is thrown by one of the tasks in the mediation operation.

catch all This item is always present and is selected when one or more other faults in the list are unselected. This item corresponds to the path for any faults that are not explicitly handled by other fault paths.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 171: Active Matrix Service Bus Design Guide

Generate Reply | 151

Generate ReplyTask

The Generate Reply task terminates an input path and passes control to the Handle Reply task on the output path.

See Chapter 9, Replying to Messages, on page 113 for more information about the Generate Reply task.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows.

The General tab has these fields:

Input TabThe Input tab is a mapper panel that you use to map the mediation exchange to the output message of the operation. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapper panel.

The Generate Reply task is defined in the context of the flow, and can’t be shared across sub-flows. There can be only one Generate Reply task per flow.

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 172: Active Matrix Service Bus Design Guide

152 | Chapter 12 Reference

Handle Reply Task

The Handle Reply is the start of the mediation reply path for handling reply messages created by any Generate Reply task on the input path.

A Handle Reply task appears automatically in the output path when a Generate Reply task is placed on the input path. Handle Reply tasks

do not appear in the palette, and you cannot add these tasks manually.

See Chapter 9, Replying to Messages, on page 113 for more information about the Handle Reply task.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Handle Reply Task Name

Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 173: Active Matrix Service Bus Design Guide

Invoke Operation | 153

Invoke OperationTask

The Invoke Operation task allows you to invoke an operation of an interface in the target interface list during processing of an input, output, or fault path. The operation can be one-way or request-reply. If the operation is request-reply, the reply message is stored in the

mediation exchange for use by subsequent tasks in the mediation path.

See Chapter 3, Invoke Operation Task, on page 39 for more information about the Invoke Operation task.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Target Operation The operation to invoke. The drop-down list is populated with all operations from the interfaces in the target interface list of the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 174: Active Matrix Service Bus Design Guide

154 | Chapter 12 Reference

Input TabThe Input tab contains a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapping panel.

Output TabThe Output tab contains a static tree representation of the reply message schema for the invoked operation. Subsequent tasks in the mediation flow will have access to the reply message. The reply message is stored in an element within the mediation exchange whose root is named the same as the Invoke Operation task name specified on the General tab.

If the message exchange pattern for the operation is one-way, the output is null.

Field Description

Task Input A complex element containing the input message for the invoked operation. The structure of the sub-elements depends upon the structure of the input message for the operation.

You can also can input the required value for fields directly into the input schema.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 175: Active Matrix Service Bus Design Guide

Log | 155

LogTask

The Log task sends information from the mediation flow context to the log. The location and configuration of the log is specified in the bootStrap.xml configuration file for the node. See Configuring the Appenders and Loggers on page 46 for more information about

configuring the log.

The Log task can be placed on an input, output, or fault path.

See Chapter 4, Log Task, on page 43 for more information about the Log task. For complete information about ActiveMatrix logging, see the Managing Logging section of TIBCO ActiveMatrix Administration.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 176: Active Matrix Service Bus Design Guide

156 | Chapter 12 Reference

Log TabThe Log tab allows you to specify which information from the mediation exchange should be sent to the log file. This table describes the items you can select on the Log tab:

Item Description

Log All Items Selects all sub-items on this tab. This option sends all information in the mediation flow context to the log.

Mediation Flow Properties

The properties defined for the mediation flow. These properties can be defined on the Properties tab of the mediation flow.

You can check the parent item to send all mediation flow properties to the log, or you can check individual properties to send the desired properties to the log.

Message Context Sends all message context information to the log file. The message context includes information about the transport used for the message and the security context for the message.

You can optionally select either the transport or security information if you do not want the entire message context sent to the log.

Message Data The content of the message.

contributed data Some mediation tasks, such as Transform or custom tasks, can contribute additional data items to the mediation exchange. Each contributed data item is named for the task that contributes the data. You can send any contributed data item to the log.

Exchange Variable You can send exchange variable information to the log if you have specified an exchange variable on the mediation operation, and have set it using the Set Exchange Variable task.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 177: Active Matrix Service Bus Design Guide

Parse XML | 157

Parse XML Task

The Parse XML task is used when you have an XML document stored in a string or binary field. This task produces a tree representation of the XML that can be used by subsequent tasks in the mediation flow. This task can be paired with the Render XML task to convert the

parsed XML back into a string or binary field for transmission within a message.

XML documents are sometimes stored in string or binary fields to improve the performance of message transmission or for other reasons. You may want to view or manipulate the data within the document then replace the document in the message before transmission to a target operation or mediation operation. Also, the target or mediation operation in your mediation flow may expect to receive all or a subset of the fields within the document.

To parse an XML document, you must provide the schema definition for the data. The schema definition must be stored in an XSD within your project. You can use an existing XSD, create an XSD with the XSD editor within TIBCO Business Studio, or you can use your own XSD editor plug-in. See the Eclipse XSD Developer Guide for more information about the XSD editor within TIBCO Business Studio.

The output of the Parse XML task is placed into the contributed data portion of the mediation exchange. An element with the same name as the Parse XML task is placed into the mediation exchange. The structure of the element is determined by the XSD specified in the Output Schema field.

The Parse XML task can be placed on an input, output, or fault path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 178: Active Matrix Service Bus Design Guide

158 | Chapter 12 Reference

General TabUse the General tab to specify a name, description, and output schema for the task. If the XML document is in binary format instead of text format, you can specify that on the General Tab. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

This name is also the name of the element in the mediation exchange that stores the output of this task.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Output Schema An XSD stored in the workspace that describes the structure of the XML document you want to parse. The output of this task is a parsed XML tree containing the data in the XML document supplied in the input tab. This output schema will be the structure of the element added to the mediation exchange containing the output of this task.

Binary Input Check this box when the XML document is stored in binary format instead of text format. When this box is unchecked, the XML document is expected to be text.

This field controls the input element on the input tab of this task. When this field is unchecked, the input element is a string named xmlString. When this field is checked, the input element is a binary element named xmlBinary.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 179: Active Matrix Service Bus Design Guide

Parse XML | 159

Input TabThe Input tab contains a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapping panel.

Field Description

TaskInput A complex element to hold the input for this task. The sub-element of this element is the XML document that you want to parse. The Binary Input field on the General tab controls which of the following elements appear.

ParseXmlStringInput Appears when the Binary Input field on the General tab is not checked. Map this element to a string element in the Mediation Exchange that holds the XML document you want to parse.

ParseXmlBinaryInput Appears when the Binary Input field on the General tab is checked. Map this element to a binary element in the Mediation Exchange that holds the XML document you want to parse.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 180: Active Matrix Service Bus Design Guide

160 | Chapter 12 Reference

Query DatabaseTask

The Query Database task is used to construct a SQL SELECT statement query to a database. This task is useful for performing basic queries for looking up information stored in a database table that will be used in the mediation flow.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

This name is also the name of the element in the mediation exchange that stores the output of this task.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Shared Resource Profile Use the drop-down list on the field to select the available shared resource profile. Shared resource profiles define database connections that are used to perform the query. Shared resource profiles are defined on the Shared Resource Profiles tab of the mediation flow.

Max Row Count The maximum number of rows to retrieve. The default value is 1. Specify a positive integer or use the drop-down menu on the field to select Unlimited to return an unlimited number of rows.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 181: Active Matrix Service Bus Design Guide

Query Database | 161

Query TabYou use the Query tab to define the SELECT statement for the query.

Click the connection button to test the connection and to verify the table and column data. Clicking this button opens a connection, if you have specified a shared resource in the mediation flow Shared Resources Profile tab, and compares the table and column data with the metadata from the database. If the connection is not successful, an error notifies you of the reason.

Three lists enable you to select tables, input data, and output columns for use in the WHERE clause of your SELECT statement

Input data is used in the WHERE clause of your SELECT statement. Use the add (+) and delete (x) buttons to the right of each list to add and delete items from each list:

• When a database connection is present and valid, the + buttons display information from the database for selecting tables and output columns.

• When no database connection is present, the + buttons allow you to add items to each list, but you must name each item and specify a type if necessary.

Clicking the + and x buttons on the Input table attempt an automatic update of the WHERE condition. If you have modified the WHERE condition, the delete might not update it and you must fix it manually.

Use the Where Condition field on the Query tab to edit the WHERE clause of the query. You can add an input variable to a condition by typing a question mark (?) in the condition. Each input variable appears in the mapper panel on the Input tab, and you can supply data from the mediation exchange for the input variable. For example, if you want to create a condition to look up a zip code supplied in the input message, you can add the condition table.ZIP = ?. When you add a question mark into the WHERE clause, an input variable appears in the Input Data list. Supply a name for the input variable, then data from the mediation exchange can be mapped to the input variable.

Table join conditions are never automatically added to the WHERE clause, so you must manually edit the WHERE clause to specify any join conditions for your query.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 182: Active Matrix Service Bus Design Guide

162 | Chapter 12 Reference

The SQL Statement field displays a read-only version of the query you have specified. Table 15 lists the supported SQL types and how they map to XML. Note that length parameters are stripped from the SQP Type, and only the base type is used in the mapping—for example, char(12) becomes char.

Vendor-specific types are cast to string. You can enable the mapper to automatically recognize these types in one of these ways:

• Force vendor-specific types to a compatible XML type using the mapper cast.

• Override the type that is retrieved from the database for the column to a similar SQL/92 type.

Table 15 Supported SQL types and their mapping to XML

SQL/92 Data Types XML Type Equivalent

TINYINT short

SMALLINT short

INTEGER int

BIGINT long

REAL float

FLOAT float

DOUBLE double

CHAR string

VARCHAR string

NCHAR string (multi-byte)

NVARCHAR2 string (multi-byte)

DATE date

TIME time

TIMESTAMP dateTime

Binary or other complex data types such as JAVA_OBJECT are not supported.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 183: Active Matrix Service Bus Design Guide

Query Database | 163

Input TabThe Input tab contains a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapping panel.

Output TabThe Output tab is a read-only display of the output schema for this task. The output schema is determined by the output columns selected on the Query tab.

Test TabThe Test tab is used to test the database query. You must have a valid JDBC shared resource associated with the shared resource profile used by this task. The JDBC shared resource is used only in the design environment.

Field Description

InputValues A complex element to hold the input for this task. The sub-elements of this element are the input variables defined on the Query tab. Each input variable corresponds to a question mark (?) that appears in the WHERE clause of the query.

Map values from the mediation exchange to fields in the input schema to supply values for the input variables of the query.

It is important for you to ensure that the JDBC shared resource you use for testing in the design environment connects to a database that is similar to the database used when the project is put into production.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 184: Active Matrix Service Bus Design Guide

164 | Chapter 12 Reference

Render XMLTask

The Render XML task takes an XML tree for a specified schema and converts it to a string or binary element that contains the XML document. This task can be paired with the Parse XML task to convert the parsed XML back into a string or binary field for transmission

within a message.

XML documents are sometimes stored in string or binary fields to improve the performance of message transmission or for other reasons. You may want to view or manipulate the data within the document then replace the document in the message before transmission to a target operation or mediation operation. Also, the target or mediation operation in your mediation flow may expect to receive all or a subset of the fields within the document.

To render an XML document, you must provide the schema definition for the data. The schema definition must be stored in an XSD within your project. You can use an existing XSD, create an XSD with the XSD editor within TIBCO Business Studio, or you can use your own XSD editor plug-in. See the Eclipse XSD Developer Guide for more information about the XSD editor within TIBCO Business Studio.

The output of the Render XML task is placed into the contributed data portion of the mediation exchange. An element with the same name as the Render XML task is placed into the mediation exchange. The contents of the element is either a string or binary element containing the XML document.

The Render XML task can be placed on an input, output, or fault path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 185: Active Matrix Service Bus Design Guide

Render XML | 165

General TabUse the General tab to specify a name, description, and input schema for the task. If the XML document will be stored in binary format instead of text format, you can specify that on the General Tab. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

This name is also the name of the element in the mediation exchange that stores the output of this task.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Input Schema An XSD stored in the project that describes the structure of the XML document you want to render. The specified schema is used to determine the input schema for this task.

Binary Output Check this box when the XML document will be stored in binary format instead of text format. When this box is unchecked, the XML document is stored in a text field.

Encoding Use this field to specify the character encoding used to render the XML string. A list of encodings is provided. If the field is empty the default system encoding is used.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 186: Active Matrix Service Bus Design Guide

166 | Chapter 12 Reference

Input TabThe Input tab contains a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapping panel.

Field Description

TaskInput A complex element to hold the input for this task. The sub-element of this element is the schema specified in the Input Schema field on the General tab.

Map values from the mediation exchange to fields in the input schema to create the desired XML document.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 187: Active Matrix Service Bus Design Guide

Route | 167

RouteTask

The Route task allows you to send messages to a specific destination based on conditions that you specify. Data from the mediation flow context, such as the security information or message body, can be used to specify the conditions of the route.

You can only introduce the route in the input path. The response (output or fault) always returns to the original requester—that is, to the same mediation operation.

Route tasks send each incoming message to a single destination based on which route case evaluates to true, or to a single destination designated as otherwise if none of the cases evaluate to true.

See Chapter 5, Route Tasks, on page 49 for more information about the Route task.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 188: Active Matrix Service Bus Design Guide

168 | Chapter 12 Reference

Decision TabThe Decision tab allows you create routing cases, routing conditions, and variables to hold data that will be evaluated in the routing conditions. The Decision tab has a toolbar for adding and deleting cases and conditions:

Toolbar Icon Description

Add Case Adds a routing case to the table on this tab. A new case appears in the table on this tab with a default name, and the case is drawn in the mediation flow diagram. By default, new cases created with this icon point to an error icon until a Target Service/Operation is specified for the case.

Delete Case Deletes the selected routing case.

Add Variable Adds a variable to use in routing conditions. When you click this icon, a dialog appears that allows you to specify the name and data type of the variable. These datatypes are available:

• string

• integer

• boolean

• date

• time

• float

Each variable appears as a column between the Case column and the Target Service/Operation column.

Delete Variable Causes a dialog to appear where you can select the variable you want to delete.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 189: Active Matrix Service Bus Design Guide

Route | 169

The Decision tab also has a table containing all of the routing cases. The following describes the columns of the table:

At the bottom of this tab is the configuration for the Otherwise case for the route. The Otherwise case is taken when all other cases evaluate to false. You can use the Target Service Operation field to specify the target operation to perform for this case.

Column Description

Case Name of the routing case. Click in the cell to edit the name.

Variable List Each variable created with the Add Variable icon appear as columns in this table. You must specify a comparison operator and a constant to compare for each variable. Click in the cell to select the comparison operator from a drop-down list and edit the value of the constant in the text field.

The comparison operators that you can specify are:

• = (equal)

• != (not equal)

• < (less than)

• <= (less than or equal)

• > (greater than)

• >= (greater than or equal)

All of the variable conditions that you specify for each case must evaluate to true for the case to evaluate to true.

Target Service/Operation

The name of the Target Service and target operation that is the destination for this case. If you drag and drop the path for the case to a target operation in the mediation flow, this field is automatically set to the correct value. You can also click in this field to either type or select the desired target operation.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 190: Active Matrix Service Bus Design Guide

170 | Chapter 12 Reference

Decision Input TabThe Decision Input tab allows you to map data from the mediation exchange into the list of variables that you have created for the Route task. See Chapter 6, Transform Tasks, page 63 for a complete description of how to perform mapping.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 191: Active Matrix Service Bus Design Guide

Send Fault | 171

Send FaultTask

The Send Fault task returns a fault message to the original process that invoked the mediation task.

Send Fault tasks appear automatically in Fault paths. Send Fault tasks do not appear in the palette, and you cannot add these tasks manually.

See Chapter 10, Faults, on page 119 for more information about fault processing.

Fault TabThe Fault tab allows you to specify the fault to send to the original environment. The Fault tab has this field:

Field Description

Fault to Send A drop-down list of declared fault messages on the mediation operation. You can also chose to send the UndeclaredFault message.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 192: Active Matrix Service Bus Design Guide

172 | Chapter 12 Reference

Set Exchange VariableTask

The Set Exchange Variable task sets the value of the exchange variable for a mediation operation. The exchange variable stores data for use by any task in the input, output, or fault paths that can access the mediation exchange.

The Set Exchange Variable task can be placed on an input, output, or fault path.

See Working With Exchange Variables on page 24 for a description of how to define exchange variables for mediation operations.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

The Set Exchange Variable task sets the value of the entire exchange variable—if you need to set several attributes, set them all at once, using one Set Exchange Variable task.

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 193: Active Matrix Service Bus Design Guide

Set Exchange Variable | 173

Input TabThe Input tab contains a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Chapter 6, Transform Tasks, on page 63 for more information about using the mapping panel.

Field Description

ExchangeVariable The exchange variable element defined in the mediation operation General tab appears on the right side of the mapper.

To set the exchange variable, map values from the mediation exchange to the exchange variable element.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 194: Active Matrix Service Bus Design Guide

174 | Chapter 12 Reference

Throw FaultTask

The Throw Fault task allows you to explicitly throw a fault in a mediation flow.

This task can only be placed on the input path.

The Throw Fault task is useful in these situations:

• You want to deprecate a mediation operation, and therefore a fault is sent to all clients that request that operation.

• You want to specify routing cases where a fault should be sent. For example, if a loan processing application cannot process loans over $5,000,000, then you would configure a routing case for the loan request operation to examine the loan amount and place a Throw Fault task on the sub-path for the case where the loan amount was over $5,000,000.

See Chapter 10, Faults, on page 119 for more information about fault processing.

Fault TabThe Fault tab allows you to select the fault to throw. You can chose to throw the MediationTaskFault message, or you can click the Browse button to bring up a dialog of service descriptors. You can choose from the list of messages in the selected service descriptors to send a specific message when a fault is thrown. When a message in a service descriptor is selected, the WSDL Location field appears. You can click on the field label link to view the service descriptor in the WSDL editor.

The Throw Fault task is defined in the context of the flow, and can’t be shared across sub-flows. There can be only one Throw Fault task per flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 195: Active Matrix Service Bus Design Guide

Transform | 175

TransformTask

The Transform task is used to manipulate the data available in a mediation flow so that the expected input, output, or fault message can be created.

Transform tasks can be placed on input, output, or fault paths.

See Chapter 6, Transform Tasks, on page 63 for more information about Transform tasks.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Mapper TabThe Mapper tab allows you to map data from the mediation exchange into the expected message schema. See Chapter 6, Transform Tasks, page 63 for a complete description of how to perform mapping.

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Contribute Output to Mediation Exchange

By default, this field is unchecked signifying that the output of the Transform task should alter the message data. When this field is checked, the message data is left unaltered and the output of this task is added as another data item within the mediation exchange. The data contributed by this task is available to subsequent mediation tasks along the same path.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 196: Active Matrix Service Bus Design Guide

176 | Chapter 12 Reference

XPath RouteTask

The XPath Route task allows you to send messages to a specific destination based on conditions that you specify. Data from the mediation exchange, such as the security information or message body, can be used to specify the conditions of the route.

XPath Route tasks can only be placed on input paths, but specifying an XPath Route task on the input path automatically creates the correct output and fault paths.

See Chapter 5, Route Tasks, on page 49 for more information about the XPath Route task.

General TabThe General tab allows you to specify a name and description for the task. This tab is useful for providing documentation for tasks in your mediation flows. The General tab has these fields:

Field Description

Name Name of the task. The name is used to identify the instance of the task in the mediation flow. This name is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

Description Brief description of the task. This description is displayed in the tool tip that appears when the user hovers the cursor over the task icon in the mediation flow.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 197: Active Matrix Service Bus Design Guide

XPath Route | 177

Decision TabThe Decision tab allows you create routing cases, routing conditions, and variables to hold data that will be evaluated in the routing conditions. The Decision tab has a toolbar for adding and deleting cases and conditions:

Toolbar Icon Description

Add Case Adds a routing case to the table on this tab. A new case appears in the table on this tab with a default name, and the case is drawn in the mediation flow diagram. By default, new cases created with this icon point to an error icon until a Target Service/Operation is specified for the case.

Delete Case Deletes the selected routing case.

Add Variable Adds a variable to use in routing conditions. When you click this icon, a dialog appears that allows you to specify the name and data type of the variable. These datatypes are available:

• string

• integer

• boolean

• date

• time

• float

Each variable appears as a column between the Case column and the Target Service/Operation column.

Delete Variable Causes a dialog to appear where you can select the variable you want to delete.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 198: Active Matrix Service Bus Design Guide

178 | Chapter 12 Reference

The Decision tab also has a table containing all of the routing cases. The following describes the columns of the table:

Column Description

Case Name of the routing case. Click in the cell to edit the name.

Variable Names

(routing condition)

The name of each variable that you create appears in at the top of the middle column of this table. The middle column is used to specify the XPath expression for the routing condition for each case. Your expressions are not limited to simple comparisons, and you do not have to use any of the variables you have defined in the expressions.

You must type the XPath expression in the condition field next to each routing case, or select the field and use the Xpath Editor field at the bottom of the tab to edit the expression.

Variables are referenced in the XPath expressions for each routing case by their names. Unlike XPath expressions in the Transform task, you do not need to use a dollar sign to specify the root of the path to the variable. For example, the expression to determine if the city variable is equal to "Palo Alto" would be:

city = "Palo Alto"

The Transform task has a graphical XPath editor that you can use as a reference for creating XPath functions for the route task. See XPath on page 88 and Data/Function Tabs on page 78 for more information about XPath.

Target Service/Operation

The name of the Target Service and target operation that is the destination for this case. If you drag and drop the path for the case to a target operation in the mediation flow, this field is automatically set to the correct value. You can also click in this field to either type or select the desired target operation.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 199: Active Matrix Service Bus Design Guide

XPath Route | 179

At the bottom of the table on this tab is the configuration for the Otherwise case for the route. The Otherwise case is taken when all other cases evaluate to false. You can use the Target Service Operation field to specify the target operation to perform for this case.

At the bottom of this tab is an XPath editor window that you can use to edit the XPath expressions for each routing condition.

Decision Input TabThe Decision Input tab allows you to map data from the mediation exchange into the list of variables that you have created for the XPath Route task. See Chapter 6, Transform Tasks, page 63 for a complete description of how to perform mapping.

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 200: Active Matrix Service Bus Design Guide

180 | Chapter 12 Reference

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 201: Active Matrix Service Bus Design Guide

| 181

Index

A

addingcomments in XPath and XSLT 85, 90data to the mediation exchange 11interfaces to mediation flows 20mediation tasks to a path 30routing cases 54the same interface multiple times to a mediation

flow 6addressing schema elements 88automatically mediating target and mediation

interfaces 21

B

binding mediation and target interfaces to actual services 32

boolean values, testing in XPath 90business logic 4

mediation tasks 8

C

Catch Fault task 121, 150faults from target operation 125

Choose statement in XSLT 81comments 85comments in XPath 90components, mediation 32Composite Editor 32composites 32configuring the log file 44constants in XPath 78

contributing data to the mediation exchange 11logging 44

copying and pasting mediation tasks 31creating local WSDL files 22creating mediation flows 14

from existing web services 15customer support xix

D

datain mediation flows 10transforming message data 64

datatypesin schema components 71mediation flow properties 19of route task variables 56

deleting 21interfaces 21mappings 79mediation tasks 31paths 23XSLT statements 79

deploying projects 12designing mediation flows 12

E

evaluation context 89exchange variable

logging 44

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 202: Active Matrix Service Bus Design Guide

182 | Index

F

fault path 7, 120, 125effect of a route task 51faults occurring on mediation fault path 122

For Each statement in XSLT 83functions in XPath 78

G

Generate Reply task 151

H

Handle Reply task 152handling faults 120

from the mediation flow 126from the target operation 125returning faults to the invoker 128

I

icon size 17If statement in XSLT 82in-only message exchange pattern 5in-out message exchange pattern 5input path 7, 23

effect of a route task 51interfaces 5, 20, 22

adding to mediation flows 20deleting 21moving 22

Invoke Operation task 153

L

location of web services in project 20

Log task 44, 155configuring 45

M

mapping 86addressing schema elements 88comments 85deleting 79hints in the message panel 86repairing 86variable data in route tasks 56XSLT Choose statement 81XSLT For Each statement 83XSLT If statement 82XSLT variables 84

mediation 2mediation components 2, 32mediation exchange 10mediation flow

catching faults from 126Mediation Flow Editor 4, 8, 17

paths 7preferences 17

mediation flows 4, 14adding interfaces 20creating 14creating from existing web services 15designing 12handling faults 120interfaces 5logging properties 44paths 7properties 19relationship to components 32throwing faults 123transforming message data 64

Mediation Flows special folder 14

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 203: Active Matrix Service Bus Design Guide

Index | 183

mediation interface 6, 22adding 21adding the same interface multiple times 6automatically mediating 21binding to services 32component service 32deleting 21moving 22

mediation operationsinput path requirement 23

mediation path 7effects of a route task 51

mediation tasks 8adding 30Catch Fault task 121changing icon size 17contributing data to the mediation exchange 11copying and pasting 31deleting 31Generate Reply 9Handle Reply 9Invoke Operation 8Log 8Log task 44Parse XML 9Query Database 9Render XML 9Route 8Route task 50Send Fault task 128Set Dynamic Reference 9Set Exchange Variable 8Throw Fault 9Throw Fault task 123Transform 8, 64XPath Route 8XPath Route task 50

message context 10logging 44schema 73

message datalogging 44

message exchange patterns 5

messages 10routing to a set of target operations 51transforming data 64

moving interfaces 22

N

namespaces in XPath expressions 89

O

offering different quality to each client 21one-way message exchange pattern 5optional schema elements 72output path 7, 23

effect of a route task 51overriding mediation flow properties 19overview 2

P

Parse XML task 157pasting mediation tasks 31paths 7, 31

adding tasks 30copying tasks 31deleting 23deleting tasks 31effect of deleting interfaces 21fault path 120mediation flows 7mediation tasks 8message exchange patterns 7sub-paths 51working with 23

planning mediation flows 6preferences 17projection icon 21

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 204: Active Matrix Service Bus Design Guide

184 | Index

projects 4Mediation Flows special folder 14Service Descriptors special folder 20

properties 19

Q

quality of service 21Query Database task 160

R

relationship between components and items in a mediation flow 32

removing mappings and statements in Transform tasks 79

Render XML task 164repairing mappings 86repeating schema elements 72request-response message exchange pattern 5Route task 50, 167

adding or deleting variables 56conditions 58effect on paths 51mapping data to variables 56modifying target destinations 55routing cases 54variables 56

running projects 12

S

schemas 71addressing components 88qualifier characters 72transforming data 64

search predicates in XPath expressions 89Send Fault task 128, 171service assemblies 12

Service Descriptors special folder 20service-oriented architecture (SOA) 2Set Exchange Variable task 172setting properties on mediation flows 19Show Edit Tab XPath window 79size of mediation task icons 17special folders 14, 20sub-paths 51support, contacting xix

T

target interface 5adding 21adding the same interface multiple times 6automatically mediating 21binding to references 32component references 32deleting 21moving 22

target operationcatching faults 125handling faults 120

tasks 8adding 30Catch Fault 150copying and pasting 31deleting 31Generate Reply 151Handle Reply 152Invoke Operation 153Log 155Parse XML 157Query Database 160Render XML 164Route 167Send Fault 171Set Exchange Variable 172Throw Fault 174Transform 175XPath Route 176

technical support xixThrow Fault task 123, 174

TIBCO ActiveMatrix Service Bus Mediation Design Guide

Page 205: Active Matrix Service Bus Design Guide

Index | 185

TIBCO ActiveMatrix SOA projects 4deploying and running 12Mediation Flows special folder 14Service Descriptors special folder 20

Transform task 64, 175comments 85Context panel 73example 66icons in toolbar 79message panel 77right-click menu 80XSLT Choose statement 81XSLT For Each statement 83XSLT If statement 82XSLT variables 84

V

variablesin route tasks 56in XSLT 84

viewing paths 7virtualization 2

W

web services 5binding to mediation and target interfaces 32creating mediation flows from 15interfaces in mediation flows 20

working with paths 23WSDL files 5, 22

X

XPath 64, 88evaluation context 89functions and constants 78search predicates 89testing boolean values 90

XPath Route task 50, 176adding or deleting variables 56conditions 60effect on path 51mapping data to variables 56modifying target destinations 55routing cases 54variables 56

XSLT 64Choose statement 81comments 85deleting statements 79For Each statement 83hints 86If statement 82variables 84

TIBCO ActiveMatrix Service Bus Mediation Design Guide