tibco activematrix service bus development tutorials€¦ · · 2013-09-13tibco activematrix®...
TRANSCRIPT
TIBCO ActiveMatrix® Service BusDevelopment TutorialsSoftware Release 3.3.0September 2013
Important Information
SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDEDOR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITEDADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLEDSOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FORANY OTHER PURPOSE.
USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF ALICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT,OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENTWHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH ISDUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT ORCLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OFTHE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOURUSE 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 SoftwareInc.
TIBCO, Two-Second Advantage, TIBCO ActiveMatrix, and TIBCO Enterprise Message Service are either registeredtrademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries.
Enterprise Java Beans (EJB), Java Platform Enterprise Edition (Java EE), Java 2 Platform Enterprise Edition (J2EE),and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle Corporation in theU.S. and other countries.
All other product and company names and marks mentioned in this document are the property of their respectiveowners and are mentioned for identification purposes only.
THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALLOPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAMETIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFICOPERATING SYSTEM PLATFORM.
THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS ORIMPLIED, 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. CHANGESARE PERIODICALLYADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATEDIN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/ORCHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANYTIME.
THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY,BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITEDTO ANY RELEASE NOTES AND "READ ME" FILES.
Copyright (c) 2005-2013 TIBCO Software Inc. ALL RIGHTS RESERVED.
TIBCO Software Inc. Confidential Information
TIBCO ActiveMatrix Service Bus Development Tutorials
Contents
Preface..................................................................................................7Changes from the Previous Release of this Guide..................................................................8
TIBCO Product Documentation................................................................................................9
Other TIBCO Product Documentation....................................................................................10
Typographical Conventions....................................................................................................11
Connecting with TIBCO Resources........................................................................................14
Chapter 1 Basic SOA Design Tutorials...........................................15
Chapter 2 Mediation Tutorials.........................................................17
Chapter 3 Policy Tutorials...............................................................19Configuring the ResourceInstance Attribute in an External Policy.........................................20
Preparing an Application that Injects Resource Instances into Policies.................................21
TIBCO ActiveMatrix Service Bus Development Tutorials
TOC | 5
TIBCO ActiveMatrix Service Bus Development Tutorials
6 | TOC
Preface
TIBCO ActiveMatrix® Service Bus is a scalable and extensible platform for developing, deploying, andmanaging applications that conform to a service-oriented architecture.
TIBCO ActiveMatrix Service Bus Development Tutorials
Changes from the Previous Release of this Guide
This section itemizes the major changes from the previous release of this guide.
TIBCO ActiveMatrix Service Bus Development Tutorials
8 | Preface
TIBCO Product Documentation
This section lists documentation resources you may find useful.
The following documents form the TIBCO ActiveMatrix Service Bus documentation set:• Concepts: Read this manual before reading any other manual in the documentation set. This manual
describes terminology and concepts of the platform. The other manuals in the documentation set assumeyou are familiar with the information in this manual.
• Development Tutorials: Read this manual for a step-by-step introduction to the process of creating, packaging,and running composites in TIBCO Business Studio.
• Composite Development: Read this manual to learn how to develop and package composites.• Mediation Component Development : Read this manual to learn how to configure and implement Mediation
components.• Mediation API Reference : Read this manual to learn how to develop custom Mediation tasks.• Administration Tutorial: Read this manual for a step-by-step introduction to the process of creating and
starting the runtime version of the product, starting TIBCO ActiveMatrix servers, and deployingapplications to the runtime.
• Administration: Read this manual to learn how to manage the runtime and deploy and manage applications.• Hawk ActiveMatrix Plug-in User’s Guide: Read this manual to learn about the Hawk plug-in and its optional
configurations.• Installation and Configuration: Read this manual to learn how to install and configure the software.• Release Notes: Read this manual for a list of new and changed features, steps for migrating from a previous
release, and lists of known issues and closed issues for the release.
The documentation for the following features is installed separately:• TIBCO ActiveMatrix Binding Type for EJB• TIBCO ActiveMatrix Binding Type for Adapters• TIBCO ActiveMatrix Implementation Type for TIBCO Adapters• TIBCO ActiveMatrix Implementation Type for Microsoft CLR• TIBCO ActiveMatrix Binding Type for REST
TIBCO ActiveMatrix Service Bus Development Tutorials
Preface | 9
Other TIBCO Product Documentation
You may find it useful to read the documentation for the following TIBCO products:• TIBCO Enterprise Message Service™
TIBCO ActiveMatrix Service Bus Development Tutorials
10 | Preface
Typographical Conventions
Table 1: General Typographical Conventions
UseConvention
TIBCO products are installed into an installation environment. A product installed intoan installation environment does not access components in other installation environments.TIBCO_HOME
ENV_NAME Incompatible products and multiple instances of the same product must be installed intodifferent installation environments. An installation environment consists of the followingproperties:• Name - Identifies the installation environment. The name is appended to the name of
Windows services created by the installer and is a component of the path to the productshortcut in the Windows Start > All Programs menu. This name is referenced indocumentation as ENV_NAME .
• Path - The folder into which the product is installed. This folder is referenced indocumentation as TIBCO_HOME .
The folder that stores configuration data generated by TIBCO products. Configurationdata can include sample scripts, session data, configured binaries, logs, and so on. Thisfolder is referenced in documentation as CONFIG_HOME.
CONFIG_HOME
Code font identifies commands, code examples, filenames, pathnames, and outputdisplayed in a command window. For example:
code font
• Use MyCommand to start the foo process.• Code example:
public class HelloWorldImpl extends AbstractHelloWorldImpl {... public HelloResponseDocument sayHello(HelloRequestDocument firstName) { ... System.out.println("--> Generating Java Hello Component Response...");
String name = firstName.getHelloRequest()==null||firstName.getHelloRequest(). equals("")?"Friend":firstName.getHelloRequest(); HelloResponseDocument resp = HelloResponseDocument.Factory.newInstance(); resp.setHelloResponse("Hi " + name + "! " + "This is the Java component.\n");
System.out.println("--> Java Hello Component Response: \n\t\t" + resp.getHelloResponse()); ... }}
• CONFIG_HOME/admin/enterpriseName/samples/remote_props.properties
• Output example:C:\Program Files\tibco\amx-3\studio\3.6\eclipse>amx_eclipse_ant.exe -buildfile "C:/helloworld1/build.xml" -data "C:/hws"Buildfile: C:/helloworld1/build.xml
createApplicationDAA:[sds.createDAA] Waited for 47ms for workspace refreshes after building features.
all:BUILD SUCCESSFUL
BUILD SUCCESSFULTotal time: 2 minutes 18 seconds
TIBCO ActiveMatrix Service Bus Development Tutorials
Preface | 11
UseConvention
Bold code font is used in the following ways:bold code font
• 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 is used in the following ways:italic font
• To indicate a document title. For example: See TIBCO BusinessWorks Concepts.• To define new terms. For example: A keystore is a database of keys and certificates.• To indicate a variable in a command or code syntax that you must replace. For example:
MyCommand pathname.
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.
Keycombinations
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 theinformation provided in the current section to achieve a specific result.
The warning icon indicates the potential for a damaging situation, for example, data lossor corruption if certain steps are taken or not taken.
Table 2: Syntax Typographical Conventions
UseConvention
An optional item in command 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 param1 | param2 | param3
A logical group of items in a command. Other syntax notations may appear within eachlogical group.
For example, the following command requires two parameters, which can be either thepair 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 beeither param1 or param2 and the second can be either param3 or param4:
MyCommand {param1 | param2} {param3 | param4}
TIBCO ActiveMatrix Service Bus Development Tutorials
12 | Preface
UseConvention
In the next example, the command can accept either two or three parameters. The firstparameter 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 Development Tutorials
Preface | 13
Connecting with TIBCO Resources
How to Join TIBCOmmunity
TIBCOmmunity is an online destination for TIBCO customers, partners, and resident experts. It is a place toshare and access the collective experience of the TIBCO community. TIBCOmmunity offers forums, blogs,and access to a variety of resources. To register, go to http://www.tibcommunity.com.
How to Access TIBCO Documentation
After you join TIBCOmmunity, you can access the documentation here: http://docs.tibco.com.
How to Contact TIBCO Support
For comments or problems with this manual or the software it addresses, 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 username and password. If you do not have a username, you can request one.
TIBCO ActiveMatrix Service Bus Development Tutorials
14 | Preface
Chapter
1Basic SOA Design Tutorials
Many TIBCO ActiveMatrix SOA development tutorials are distributed as cheat sheets in TIBCO Business Studio.To access the cheat sheets, start TIBCO Business Studio, select Help > Cheat Sheets... , and expand the TIBCOSOA Development node. For tutorials that are not cheat sheets, see the specific tutorial category.
Many of the steps in cheat sheets launch modal dialogs. Once a dialog is open, you cannot expand the viewcontaining cheat sheet content. To ensure that you can see all the content, before opening a dialog you canexpand the view so that you could see all of the cheat sheet content or you can detach the view so that itcan be resized even while a dialog is open.
To access the basic SOA design tutorials, expand the Basic folder.
• Create an SOA Project with an Empty Composite
Describes how to create an SOA project.
• Import Projects from an Archive
Describes how to import projects from an archive file.
• Import a WSDL File into an SOA Project
Describes how to import a WSDL file into an SOA project.
TIBCO ActiveMatrix Service Bus Development Tutorials
Chapter
2Mediation Tutorials
The mediation tutorials explain how to create, package, and modify mediation flows.
Many of the steps in cheat sheets launch modal dialogs. Once a dialog is open, you cannot expand the viewcontaining cheat sheet content. To ensure that you can see all the content, before opening a dialog you canexpand the view so that you could see all of the cheat sheet content or you can detach the view so that itcan be resized even while a dialog is open.
To access the mediation tutorials, expand the Mediation folder.• How to Create and Package a Hello World Mediation Flow
Develop a simple Hello World application that returns an acknowledgment when a user submits a name to aSOAP client.
• How to Create and Package a Data Enrichment Mediation Flow
Use the Invoke Operation mediation task to enrich data in a mediation flow. The Invoke Operation task enablesyou to enhance message input, so that the message gathers additional data as it follows the mediation flow tothe target operation.
• How to Create and Package a Content-Based Routing and Data Transformation Mediation Flow
Create a mediation flow that uses route tasks to send requests to service implementations in a sample GlobalDistribution System (GDS) travel service.
Table 3: Sample Project Location
Sample Project ArchivesCheat Sheet
TIBCO_HOME/amx_it_mediation/version/samples/HelloWorldHello World Mediation• Create and Package
TIBCO_HOME/amx_it_mediation/version/samples/ContentBasedRouting
TIBCO_HOME/amx_it_mediation/version/samples/TargetService
Content-Based Routing andData Transformation• Create and Package
TIBCO_HOME/amx_it_mediation/version/samples/DataEnrichmentData Enrichment MediationFlow• Create and Package
TIBCO ActiveMatrix Service Bus Development Tutorials
Chapter
3Policy Tutorials
Policy tutorials illustrate how to use TIBCO ActiveMatrix policies.
Several external policies require you to configure an attribute named resourceInstance. The value of that attributeis not an actual resource instance, but an application that references the required resource instance; the purposeof the application is to inject the resource instance into policies that require it.
When configuring these policies, you must first ensure that the appropriate application is deployed and runningon the nodes where you will deploy the policy. To prepare the resource instance and application, see Preparingan Application that Injects Resource Instances into Policies on page 21.
To configure the policy to use the application, see Configuring the ResourceInstance Attribute in an External Policyon page 20.
The location of the sample policies is TIBCO_HOME/amx/version/samples/policy/samples.zip.
Topics
• Configuring the ResourceInstance Attribute in an External Policy• Preparing an Application that Injects Resource Instances into Policies
TIBCO ActiveMatrix Service Bus Development Tutorials
Configuring the ResourceInstance Attribute in an External Policy
Procedure
Several external policies require you to configure an attribute named resourceInstance. When configuringsuch policies (by copying from the samples), replace the sample value of the resourceInstance attributewith the actual name of the application that references (and injects) the appropriate resource instance.
TIBCO ActiveMatrix Service Bus Development Tutorials
20 | Policy Tutorials
Preparing an Application that Injects Resource Instances intoPolicies
Procedure
1. Create resource templates of the required types:
Required Resource TemplatesPolicy
Identity ProviderSigning or Decryption
Keystore Provider
Trust ProviderSignature Verification orEncryption
Keystore Provider
Mutual Identity ProviderBoth of the above
Keystore Provider
WS-Security ASPWssProvider orWssConsumer
LDAP Authentication ProviderLDAP for authentication
2. Create a resource instance from each template.3. Create governance agent applications that reference the resource instances (one application per resource
instance):
Application Template DAA NameApplication TemplateResourceInstance Type
com.tibco.governance.sharedresource.ldap.asp.daaTIBCO ActiveMatrixGovernance Agent LDAP
LDAPAuthenticationProvider Authentication Provider
App Template
com.tibco.governance.sharedresource.mutual.isp.daaTIBCO ActiveMatrixGovernance Agent Mutual
Mutual IdentityProvider
Identity Provider AppTemplate
com.tibco.governance.sharedresource.subject.isp.daaTIBCO ActiveMatrixGovernance Agent IdentityProvider App Template
Identity Provider
com.tibco.governance.sharedresource.trust.isp.daaTIBCO ActiveMatrixGovernance Agent TrustProvider App Template
Trust Provider
com.tibco.governance.sharedresource.wss.asp.daaTIBCO ActiveMatrixGovernance Agent WSS
WS-Security ASP
Authentication ProviderApp Template
TIBCO ActiveMatrix Service Bus Development Tutorials
Policy Tutorials | 21
4. Distribute the applications to the appropriate nodes and run them. Each application that injects a resourceinstance must run on every node where a policy requires that resource instance.
5. Each application type has a single property that you must set. In the Properties tab of the application,specify the resource instance name as the value of that property.For example, the Trust Provider application has a property named TrustIspConnectionFactory. Set itsvalue to the name of the resource instance that this application injects into policies.
TIBCO ActiveMatrix Service Bus Development Tutorials
22 | Policy Tutorials