Samples - TIBCO Product Documentation

Samples - TIBCO Product Documentation
TIBCO ActiveMatrix BusinessWorks™ Samples
Software Release 6.3.1
January 2016
Two-Second Advantage®
2
Important Information
SOME 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 THE LICENSE FILE)
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.
TIBCO, TIBCO ActiveMatrix BusinessWorks, TIBCO Rendezvous, TIBCO Enterprise Message Service,
TIBCO Business Studio, TIBCO Enterprise Administrator, TIBCO ActiveSpaces, TIBCO Runtime Agent,
TIBCO Designer, and Two-Second Advantage are either registered trademarks 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 the U.S. and 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. SEE THE README 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 © 2001-2016 TIBCO Software Inc. All rights reserved.
TIBCO Software Inc. Confidential Information
TIBCO ActiveMatrix BusinessWorks™ Samples
3
Contents
TIBCO Documentation and Support Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Changing Help Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Accessing Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Setting the Default Application Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Binding Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Using Basic Rest Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Using REST to Manage Books for a Bookstore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Using a SOAP Web Service to Make a Query to a Bookstore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Reconfiguring a Web Service by Changing the Transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Converting the Transport from SOAP over JMS to SOAP over HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Using a SOAP Connection to Publish Messages to Multiple Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Sending and Receiving a SOAP Bound Attachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Interoperability of Using JAX-WS Client to Invoke Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Invoking a SOAP over HTTP Web Service Using Different SOAP Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Invoking a SOAP over HTTP Web Service Using Different Binding Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Implementing a Service with a Service Binding and a Client with a Reference Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Implementing a Mortgage Loan Application with Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Sending and Receiving a SOAP Unbound Attachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Managing a Purchase Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Using SOAP Bound Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Using SOAP UnBound Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Using SOAP HTTP Transport Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Sending a SOAP Request and Receiving a SOAP Reply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Implementing a HTTP Service That Returns Information Based on ZIP Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Implementing a JMS Service That Writes Attachment to File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Sending a One Way Message over JMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Using JMS Destination Bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Implementing a JMS Service that Returns Information Based on Zip Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Implementing a JMS Service That Returns an Attachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Core Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Using Process and Module Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Using a Process Conversation to Correlate JMS Message Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Using Modularity with the Java Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Configuring a Conversation to Join a Wait for File Change Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Using an Asynchronous Event Handler to Implement a Simple Mortgage Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Using a Cross Process Conversation to Determine the Mortgage Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Catching Activity Faults with Scope and Fault Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
TIBCO ActiveMatrix BusinessWorks™ Samples
4
Modularity Among Applications with a Shared Module Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Load Balancing an Application Using an AppSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Invoking Subprocesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Dynamically Invoking Subprocesses Using SetEPR Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Policy Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Enforcing Basic Authentication with LDAP Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Enforcing Basic Authentication on a REST Service Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Enforcing Basic Credential Mapping on an Outbound Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Enforcing SOAP Security to Enable Confidentiality and Integrity on Message Exchanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Enforcing SOAP Security to Enable SAML Authentication and SAML Credential Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Palettes Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Creating an Order Processing Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Using FTP to Put and Get Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Using HTTP to Send and Receive Dynamic Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
HTTP Sending and Receiving MIMEAttachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Using HTTP or SOAP to Get Information from MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Using the HTTP Persistent Connection Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Sending a Request and Getting a Response from a Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Sending a Secured Request and Getting a Secured Response From a Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Invoking Custom Code to Complete a Purchase Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Using Java Activities to Publish Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Using Java Invoke that Makes a REST call to Search Twitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Using a Custom Process Starter in a Project That Gets Information about a Checking Account . . . . . . . . . . . . . . . . . . . . . . . . 101
Using JDBC Query - Process in Subsets and JDBC Update - Batch Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Setting Up a JDBC Connection to Query and Update Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Using Oracle Objects and Collections in JDBC Call Procedure and JDBC Query Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Setting Up and Executing JDBC Activities with Eclipse Using DTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Sending and Getting JMS Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Using JMS Message Selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Receiving a JMS Message from a Queue and Responding to the Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Sending a JMS Message and Receiving a Response in a Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Sending a JMS Message to a Queue and Waiting for a Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Sending a JMS Message and Receiving a Durable Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Sending Mail Using HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Sending Mail Using MIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Sending and Receiving Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Publishing and Subscribing to TIBCO Rendezvous Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Managing TCP Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Sharing a TCP Connection Across Multiple Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Migrating Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
TIBCO ActiveMatrix BusinessWorks™ Samples
5
HTTP Basic Sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
HTTP Persistent Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
JAVA Method Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
JMS Message Selector Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
HTML Mail with Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Mail with Simple Attachment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
TIBCO ActiveMatrix BusinessWorks™ Samples
6
TIBCO Documentation and Support Services
Documentation for this and other TIBCO products is available on the TIBCO Documentation site. This
site is updated more frequently than any documentation that might be included with the product. To
ensure that you are accessing the latest available help topics, please visit:
https://docs.tibco.com
Product-Specific Documentation
Documentation for TIBCO products is not bundled with the software. Instead, it is available on the
TIBCO Documentation site. To directly access documentation for this product, double-click the
following file:
TIBCO_HOME/release_notes/TIB_BW_version_docinfo.html
The following documents for this product can be found on the TIBCO Documentation site:
●
Concepts
●
Installation
●
Getting Started
●
Application Development
●
Administration
●
Bindings and Palettes Reference
●
Samples
●
Error Codes
●
API Reference
●
Migration
How to Contact TIBCO Support
For comments or problems with this manual or the software it addresses, contact TIBCO Support:
●
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.
How to Join TIBCOmmunity
TIBCOmmunity is an online destination for TIBCO customers, partners, and resident experts. It is a
place to share and access the collective experience of the TIBCO community. TIBCOmmunity offers
forums, blogs, and access to a variety of resources. To register, go to the following web address:
https://www.tibcommunity.com
TIBCO ActiveMatrix BusinessWorks™ Samples
7
Changing Help Preferences
By default, documentation access from TIBCO Business Studio is online, through the TIBCO Product
Documentation site (Doc site) at https://docs.tibco.com/which contains the latest version of the
documentation. Check the Doc site frequently for updates. To access the product documentation
offline, download the documentation to a local directory or an internal web server and then change the
help preferences in TIBCO Business Studio ™.
Prerequisites
Before changing the help preferences to access documentation locally or from an internal web server,
download the documentation from https://docs.tibco.com/.
1. Go to: https://docs.tibco.com/
2. In the Search field, enter ActiveMatrix
BusinessWorks
and press Enter.
3. Select the TIBCO ActiveMatrix BusinessWorks product from the list. This opens the product
documentation page for the latest version.
4. Click Download All.
5. A zip file containing the latest documentation downloads to your web browser's default download
location. Copy the zip file to a local directory or to an internal web server and then unzip the file.
To change help preferences on the Preferences dialog to access the documentation from a custom
location:
Procedure
1. In TIBCO Business Studio™, click Window > Preferences. On Mac OS X, click TIBCO Business
Studio > Preferences.
2. In the Preferences dialog, click BusinessWorks > Help.
3. Click Custom Location and then click Browse to select the html directory in the folder where you
unzipped the documentation, or provide the URL to the html directory on your internal web server.
4. Click Apply and then click OK.
TIBCO ActiveMatrix BusinessWorks™ Samples
8
Accessing Samples
Procedure
1. Launch TIBCO Business Studio™ from $TIBCO_HOME\studio\4.0\eclipse
\TIBCOBusinessStudio.exe.
By default, TIBCO Business Studio™ opens the Design perspective.
2. Click Help > BusinessWorks Samples.
The File Explorer view displays a top level listing of all the samples.
3. Navigate to the directory containing the sample you want to access and do the following:
●
Double-click the archive file, <sample_name>.zip, to import the sample application to your
workspace. For example, double-click tibco_bw_sample_binding_rest_basic.zip to import
the application and the application module to your workspace.
●
Click readme.link to open the sample Help page in the References view. For example, by
clicking bindings > rest > basic > readme.link you can access the Help page for Basic REST
Sample application. You can access the help page of all samples using the same process.
TIBCO ActiveMatrix BusinessWorks™ Samples
9
Setting the Default Application Profile
Procedure
1. Before running the sample make sure to update the default Application Profile according to the OS
Platform you are running on.
2. Click the <Project>.application, expand Package Unit folder and open the Properties file.
3. If you are running on Unix based system, then select UnixProfile column header to enable Set as
Default button. Click the Set as Default button to set it as the default Application Profile.The
default Profile is indicated by the straight brackets [ ] around the Profile name.
If you are running on Windows system, then make sure the WindowsProfile is set as default before
running or debugging this application in TIBCO Business Studio.
4. Save your project.
TIBCO ActiveMatrix BusinessWorks™ Samples
10
Binding Features
Endpoints expose the location of the service to the service partner. An endpoint binding specifies the
transport to use for the endpoint, any transport-specific properties, and any SOAP details, such as
SOAP version, SOAP action, and so on. This section includes samples that show how to use bindings
correctly.
Using Basic Rest Binding
In this REST Bookstore sample you can use the RESTful service to add, and retrieve books from a
Bookstore (in this sample, Bookstore is files as a datastore). This sample uses two REST methods: POST
and GET.
Prerequisites
Install the latest Google Chrome version in the standard default location.
If you are accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
Procedure
1. In the samples directory, select binding > rest > Basic and double-click
tibco.bw.sample.binding.rest.Basic. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.binding.rest.Basic project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click books.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.rest.Basic.application.
8. Click Debug. This will run the sample in Debug mode.
The console window shows engine messages similar to: Started BW Application
[tibco.bw.sample.binding.rest.Basic.application:1.0].
The OSGI command to list REST and Swagger URLs is lrestdoc, which lists the following
discovery URL:
[Application Name]: tibco.bw.sample.binding.rest.Basic.application [Discovery
Url]: http://localhost:7777/tibco.bw.sample.binding.rest.Basic.application.
9. Launch Google Chrome browser and open http://localhost:7777/
tibco.bw.sample.binding.rest.Basic.application.
Result
The Swagger API Page displays:
TIBCO ActiveMatrix BusinessWorks™ Samples
11
Click POST and provide the JSON payload.
You can use the books.json payload provided with the sample present at BW_HOME\samples\binding
\rest\Basic\books.json. On successful POST of Data, the books.log file is created in the c:/tmp/
RestBasic folder (or /tmp/RestBasic on Unix Platform), with the data you just posted.
Click Get > Try it out to view all the books that you have just posted. You can see the data similar as
the following:
You can also change the output file location.
To change the output file location, go to tibco.bw.sample.binding.rest.Basic.application -> Package
Unit and open Properties file for editing. Depending on your Operating System under test, edit the
output file location in either the UnixProfile column or WindowsProfile column.
The Books_Invoke.log file is generated at c:\tmp\RestBasic\. This file contains POST Books and
GET Books output from the Client process.
TIBCO ActiveMatrix BusinessWorks™ Samples
12
Understanding the Configuration
The project contains the following processes.
●
Books Process: In this process, a REST service is created that performs two operations,
POST and GET. The POST operation posts one or more books to the bookstore or books
collection (in this case a file) and the GET operation retrieves all the books from the
Bookstore (file). In the Books/post operation, a sub process is called to add books to the file.
The PostBooksToFile operation is implemented in the BooksFile subprocess. In the
Books/get operation, a sub process is called to retrieve books from the file. The
GetBooksToFile operation is implemented in the BooksFile subprocess. The following
diagram depicts the Books process.
●
BooksFile Subprocess: File handling is managed using the BooksFile sub process, which
adds and retrieves books from the file. The BooksFileService service implements the
operations to add and get books from the file. In BooksFileService/PostBooksToFile, Render
JSON activity is used to render data that the user has posted, write it to a file, read the file,
parse the data, and then post the data back to the user. In BooksFileService/GetBooksToFile,
the file previously created is read, parsed, and then the data is returned to the user.
TIBCO ActiveMatrix BusinessWorks™ Samples
13
●
Client Process: This is a REST Client process which uses Invoke REST API activity to
retrieve data from the REST Server. This process is used to Invoke the POST and GET
operations on the REST resource.
For example, in POST_Books, we provide HTTP Client Resource that listens to the same
host and port as that of the server. The Resource Path is "/books", HTTP Method is "POST",
and Request and Response type is JSON. In the Message Body, we provide the JSON
payload which is read from the file present at BW_HOME\samples\binding\rest
\BookStore\samplejson\books.json .
This JSON payload is then posted to the output file.
Troubleshooting
●
If you do not see the REST Swagger API page, verify whether the application has started.
●
If you see any problem markers in the project, clean the project by invoking Project > Clean
or try switching to a clean new workspace.
●
If you get any File was not found exception, verify whether the books.json file is
present at the location as described in the Input_File Module Property.
Using REST to Manage Books for a Bookstore
This REST Bookstore Sample Using a Database shows how to use the RESTful service to add, delete,
update, and retrieve books from Bookstore.
The sample uses the following HTTP methods for the Books REST resource:
●
POST: Add books to the bookstore
●
GET: Get books from the bookstore
●
PUT: Updates books to the bookstore
●
DELETE: Deletes books from the bookstore
Prerequisites
Install the latest Google Chrome version at the standard default location.
Install the PostgreSQL Database:
TIBCO ActiveMatrix BusinessWorks™ Samples
14
1. Download and install PostgreSQL from http://www.postgresql.org/download/.
2. Go to SQL Shell (psql) from the installed program.
3. The PostgreSQL command line window starts.
4. Open the DB and table creation script, dbsetup.sql from the scripts folder under
TIBCO_HOME/bw/n.n/samples/binding/rest/BookStore/scripts.
5. Run the script from the command line as per the instructions given in the readme file present under
the scripts folder.
You will see the database and the tables created from the pgAdmin UI from the installed program.
If you are accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
Procedure
1. In the samples directory, select binding > rest > Bookstore and double-click
tibco.bw.sample.binding.rest.BookStore. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.binding.rest.BookStore project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Expand tibco.bw.sample.binding.rest.Bookstore.application > Package Unit folder. Provide valid
values for the application properties. Provide a valid username, password and database URL to
connect to your PostgreSQL database in the module properties, if different from the default setting.
5. Verify your JDBC connection.
a) Fully expand the Resources directory.
b) Double-click JDBCConnectionResource.jdbcResource.
c) In JDBC Driver, click Click Here to Set Preferences.
d) Set the JDBC driver folder directory preference to the folder where you have downloaded
PostgreSQL JDBC Driver as mentioned in the Prerequisites section. Click Apply and then click
OK.
e) Click the Test Connection button to verify the connection.
6. Click File > Save.
7. Fully expand the Processes directory and double-click Books.bwp.
8. Click Run > Debug Configurations.
9. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
TIBCO ActiveMatrix BusinessWorks™ Samples
15
10. Click Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.rest.BookStore.
11. Click Debug. This will run the sample in Debug mode.
The console window shows engine messages similar to: Started
BW Application
[tibco.bw.sample.binding.rest.BookStore.application:1.0].
The OSGI command to list
REST and Swagger URLs is lrestdoc, which lists the discovery URL: [Application Name]:
tibco.bw.sample.binding.rest.BookStore.application [Discovery Url]: http://
localhost:7777/tibco.bw.sample.binding.rest.BookStore.application.
12. Launch Google Chrome browser and open http://localhost:7777/
tibco.bw.sample.binding.rest.BookStore.application. The Google Chrome page displays as follows.
13. Click on any of the operations, such as POST, GET, PUT, DELETE as displayed on the web page.
14. After you have finished with the operations on the page, in TIBCO Business Studio, click the
Terminate icon to stop the process.
Result
The web page lists the following operations for Books and Events:
Books
●
Post books
●
GET books
●
GET book by ISBN
●
PUT book by ISBN
●
DELETE book by ISBN
Events
●
POST Events
●
GET Events
●
GET Event by EventID
TIBCO ActiveMatrix BusinessWorks™ Samples
16
●
PUT Event by EventID
●
DELETE Event by EventID
GET books returns an output similar to the following:
{
"Book": [
{
"isbn": "0061122416",
"name": "The Alchemist",
"description": "Every few decades a book is published that changes the lives
of its readers forever. The Alchemist is such a book",
"authorName": "Paul Coelho",
"releaseDate": "2006-04-25",
"vintage": true,
"signed": true,
"price": 11.9
},
{
"isbn": "0071450149",
"name": "The Power to Predict",
"description": "How Real Time Businesses Anticipate Customer Needs, Create
Opportunities, and Beat the Competition",
"authorName": "Vivek Ranadive",
"releaseDate": "2006-01-26",
"vintage": false,
"signed": true,
"price": 15.999
}
]
}
GET books by ISBN returns an output similar to the following for the ISBN 0061122416:
{
"isbn": "0061122416",
"name": "The Alchemist",
"description": "Every few decades a book is published that changes the lives
of its readers forever. The Alchemist is such a book",
"authorName": "Paul Coelho",
"releaseDate": "2006-04-25",
"vintage": true,
"signed": true,
"price": 11.9
}
The books.log file is generated with the following information:
POST Books------->{"Book":[{"isbn":"1451648537","name":"Steve
Jobs","description":"Biography of Apple Co-Founder Steve Jobs","authorName":"Walter
Isaacson","releaseDate":"2012-10-24","vintage":false,"signed":false,"price":21},
{"isbn":"0385537859","name":"Inferno","description":"Robert Langdon returns in Dan
Brown's latest fast paced action thirller","authorName":"Dan
Brown","releaseDate":"2013-05-14","vintage":false,"signed":true,"price":14.09},
{"isbn":"0399103421","name":"The Godfather","description":"The Godfather is an epic
story of a New York's top mafia family, loyalty, and how men of honor live in their
own world, and die by their own laws.","authorName":"Mario
Puzo","releaseDate":"1969-03-10","vintage":true,"signed":true,"price":
50}]}**************************************************************
GET Books------->{"Book":[{"isbn":"1451648537","name":"Steve
Jobs","description":"Biography of Apple Co-Founder Steve Jobs","authorName":"Walter
Isaacson","releaseDate":"2012-10-24+05:30","vintage":false,"signed":false,"price":
21},{"isbn":"0385537859","name":"Inferno","description":"Robert Langdon returns in
Dan Brown's latest fast paced action thirller","authorName":"Dan
Brown","releaseDate":"2013-05-14+05:30","vintage":false,"signed":true,"price":
14.09},{"isbn":"0399103421","name":"The Godfather","description":"The Godfather is
an epic story of a New York's top mafia family, loyalty, and how men of honor live
in their own world, and die by their own laws.","authorName":"Mario
Puzo","releaseDate":"1969-03-10+05:30","vintage":true,"signed":true,"price":
50}]}**************************************************************
GET Book By ISBN------->{"isbn":"1451648537","name":"Steve
TIBCO ActiveMatrix BusinessWorks™ Samples
17
Jobs","description":"Biography of Apple Co-Founder Steve Jobs","authorName":"Walter
Isaacson","releaseDate":"2012-10-24+05:30","vintage":false,"signed":false,"price":
21}**************************************************************
DELETE Book By ISBN-------->"Deleted book with ISBN 1451648537"**************************************************************
GET Events By ISBN--->{}**************************************************************
TIBCO ActiveMatrix BusinessWorks™ Samples
18
Understanding the Configuration
The project contains three processes: Books, Events, Invoke_Client, and two subprocesses;
BooksDB and EventsDB.
Books Process: In this process, the Book REST service performs the post, get, put, delete
operations. It posts one or more books to the bookstore and retrieves all the books from the
bookstore. For the post operation, a sub process is called to add books to the database. The
addBooks operation is implemented in the BooksDB subprocess. The Book REST service
performs three operations: getting a book from the bookstore by ISBN, updating a book in the
bookstore using ISBN, and deleting a specific book from the bookstore using ISBN. ISBN is
passed as a parameter to these operations.
BooksDB Subprocess: The subprocess handles deletes, updates, retrievals of books from the
database. The BooksPersist service implements following operations: adding books to database,
getting all books from database, getting a book by ISBN, updating a book by ISBN, deleting a
book by ISBN. Using BooksPersist/addBooks, books are added to the database.
Events Process: It is similar to the Books process and is used to add, delete, update, and
retrieve events.
TIBCO ActiveMatrix BusinessWorks™ Samples
19
EventsDB Process: It is similar to the BooksDB process and is used to add, delete, update, and
retrieve events from the database.
Invoke_Client Process: This is a REST Client process which uses Invoke REST API activity to
retrieve data from the REST Server. It is similar to Swagger UI. Using this process, you can
POST, GET, PUT, and DELETE books by specifying the HTTP Client, Resource Path, HTTP
Method, Request Type, and Response Type in the Invoke REST API activity.
For example, in POST_Books, we provide HTTP Client Resource which listens to the same host
and port as that of server. The Resource Path is "/books", HTTP Method is "POST", and
Request and Response type is JSON. In the Message Body, we provide the JSON payload which
is read from the file present at BW_HOME\samples\binding\rest\BookStore\samplejson
\books.json. This posts books from the books.json payload into the database and you can
view the data posted into the output file.
TIBCO ActiveMatrix BusinessWorks™ Samples
20
TIBCO ActiveMatrix BusinessWorks™ Samples
21
Troubleshooting
●
If you are unable to insert rows into the database using the dbsetup.sql script in the
scripts folder, use the sample json payload from the samplejson folder to post the data.
●
If you do not see the REST Swagger API page, verify whether the application has started.
●
If you see any problem markers in the project, clean the project by invoking Project > Clean
or try switching to a clean new workspace.
●
If you get any File was not found exception, verify whether books.json and
book_put.json file is present at the location as specified in the Input_File and
Input_File_1 Module Property.
●
If you get an error about unregistered user, open the pgAdmin UI and select all check
boxes under the Role Privileges tab for the bwuser.
Using a SOAP Web Service to Make a Query to a Bookstore
Using a SOAP binding, a web service WSDL operation queries for information from a data source. The
web service has one operation, GetBooksByAuthor, that is implemented in the process,
QueryBooksByAuthorProvider. At run-time, a request containing an author name returns details about
the author's books.
Prerequisites
Copy the BookStore.xml file to C:\tmp location.
Procedure
1. In the samples directory, select binding > soap > http > BookStore and double-click
tibco.bw.sample.binding.soap.http.BookStore. See Accessing Samples for more information.
TIBCO ActiveMatrix BusinessWorks™ Samples
22
2. In Project Explorer, expand the tibco.bw.sample.binding.soap.http.BookStore project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click QueryBooksByAuthorProvider.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.BookStore.BookStore.application.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The query sends a request for "Vivek Ranadive" and returns the following book details:
17:58:24.807 [PVM:In-Memory STWorkProcessor:2] INFO
c.t.b.g.L.t.b.b.s.h.BookStore.Log - Message=Book Title: The Power of Now, Author is
Vivek Ranadive, Date: 1999, ISBN 0-06-566778-9, Publisher is Tibco Software Inc
Understanding the Configuration
The following processes are defined in the project:
●
BookStoreServiceClient.bwp: The process implements the GetBooksByAuthor operation
using BooksInterface.wsdl, and then invokes the QueryBooksByAuthorProvider process.
The reply containing the query results is made by mapping to the output of the Query
service. A Timer activity triggers the client and then triggers a SOAP Invoke activity, which
is the actual web service client.
●
QueryBooksByAuthorProvider.bwp: The process definition representing the service's
business logic. The service Receive activity implements the GetBooksByAuthor operation
based on the BooksInterface.wsdl file. The Read File activity reads the bookstore (an
XML file in this sample).
The file must be on the machine that is used to run the sample.
The Parse XML activity then parses the XML document. Finally, the filter is executed at the
end of the process flow in the Reply (see Reply activity's Input tab).
The following resources are defined in the project:
●
Resources\BookStore.xml.
The file representing the bookstore database.
●
HTTPConnector.httpConnResource: The HTTP shared resource to use. If you want the
web service to access a different host machine or port, edit the Host and Port properties and
then regenerate the concrete WSDL from the component binding. See Application
Development for details.
The following schemas and service descriptors are defined in the project:
●
Schemas\Books.xsd:
service interface.
●
The schema file containing the
Service Descriptors\BooksService.wsdl:
web service.
type
definitions used by the web
The WSDL file that describes the Bookstore
TIBCO ActiveMatrix BusinessWorks™ Samples
23
Reconfiguring a Web Service by Changing the Transport
This sample documentation describes the way to convert a transport for a Web Service
Prerequisites
TIBCO Enterprise Message Service™ must be running.
Sample Description
Converting a transport for a Web Service:
●
from SOAP over HTTP to SOAP over JMS
●
from SOAP over JMS to SOAP over HTTP
See Accessing Samples for more information.
Before performing the following steps, import the SOAP over HTTP ZipCodeServiceProvider.zip
project from the File Explorer view by double-clicking the project zip in TIBCO Business Studio.
Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
Converting the Transport from SOAP over HTTP to SOAP over JMS
Procedure
1. Create and configure a JMS Connection shared configuration resource.
2. Navigate to the Module Descriptors > Components tab and select ZipPort service.
3. Click the Bindings tab, and in the Transport Configuration section, change the Transport Type
from HTTP to JMS.
4. Create the JMS Connection shared resource with default or custom values using the JMS
Connection wizard after changing the Transport Type to JMS.
5. Change the Messaging Style to Queue in the JMS Connection shared resource.
6. Create JNDI Configuration shared resource with default or custom values.
7. Test the connection using the Test Connection button.
8. Click Bindings > Transport Configuration and specify the JMS Destination value as
queue.sample or a custom queue name.
9. In the TIBCO Enterprise Message Service server, create a queue with queue.sample name, if queue
was not created earlier, using TIBCO Enterprise Message Service Administration option.
10. Click the Generate Concrete WSDL for SOAPServiceBinding binding link in the Binding
configuration. Use the Generate WSDL wizard to generate a new concrete WSDL.
11. Delete the previous concrete WSDL, to avoid WSDL cache exceptions, located under Service
Descriptors > Special Folders that contains HTTP transport details.
12. Specify the folder location where you want to generate the concrete WSDL file.
13. Clear the Embed options (Abstract WSDL and Schema) check boxes, if both Service and Client are
under the same project module.
14. Click OK in the WSDL generated successfully confirmation dialog.
15. Overwrite (if required) with ActiveMatrix BusinessWorks 5.x client concrete WSDL file.
16. Go to the Web Service Client project (ActiveMatrix BusinessWorks 5.x) in TIBCO Designer and click
the Browse option in SOAP Request Reply activities to select the Service/Operation from the newly
imported WSDL file. Optionally click Reload to get WSDL configurations.
TIBCO ActiveMatrix BusinessWorks™ Samples
24
17. Click Transport Connection to test the connection status.
Result
The Client and Server are executed.
Converting the Transport from SOAP over JMS to SOAP over HTTP
Before performing the following steps, import the ZipCodeLookup.zip project from the File Explorer
view by double-clicking the project zip in TIBCO Business Studio.
Procedure
1. Create an HTTP Connection shared configuration resource, and configure the HTTP Host and Port
details.
2. Navigate to the Module Descriptors > Components tab and select ZipPort service.
3. Click the Bindings tab, and in the Transport Configuration section, change the Transport Type
from JMS to HTTP.
4. Create the HTTP Connection shared resource with default or custom values using the HTTP
Connection wizard after changing the Transport Type to HTTP.
5. Click the Generate WSDL for SOAPReferenceBinding binding link in the Binding configuration.
Use the Generate WSDL wizard to generate a new concrete WSDL.
6. Clear the Embed options (Abstract WSDL and Schema) check boxes, if both Service and Client are
under same project module.
If required, overwrite with the existing Client concrete WSDL file.
7. Click OK in the WSDL generated successfully confirmation dialog.
8. Navigate to Module Descriptors > Components tab and select ZipPort Reference.
9. Delete the previous SOAPReferenceBinding configured with JMS transport.
10. Optionally, configure the HTTP Client shared resource to override the custom configurations.
11. To avoid WSDL cache exceptions, delete the previous concrete WSDL located under Service
Descriptors > Special Folders that contains JMS transport details.
If the previous concrete WSDL is not removed or deleted, you see two portTypes.
Choose the default selected portType, which is HTTP.
If you are using Context mappings on Client binding, you must reconfigure the
Context mappings.
Result: The Client and Server are executed properly.
Using a SOAP Connection to Publish Messages to Multiple Endpoints
This sample shows how to publish messages to multiple endpoints over HTTP and JMS.
Prerequisites
TIBCO Enterprise Message Service must be running.
TIBCO ActiveMatrix BusinessWorks™ Samples
25
Procedure
1. In the samples directory, select binding > soap > http > HTTPJMSMultiEndpoint and double-click
tibco.bw.sample.binding.soap.http.HTTPJMSMultiEndpoint. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.HTTPJMSMultiEndpoint
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection. To verify:
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) Click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click TestService.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click theApplications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.http.HTTPJMSMultiEndpoint.application.
9. Click Debug. This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
Result
The file provided for the OUTPUT_FILE property is written with the following content:
JMS : Output of getCityInfo : 61801 Urbana Illinois Urbana, Illinois, United States
40.11 88.207
JMS : Output of getCityDistance : 61801 61820 Urbana Champaign Illinois Illinois
Urbana, Illinois, United States Champaign, Illinois, United States
HTTP : Output of getCityInfo : 61801 Urbana Illinois Urbana, Illinois, United States
40.11 88.207
HTTP : Output of getCityDistance : 61801 61820 Urbana Champaign Illinois Illinois
Urbana, Illinois, United States Champaign, Illinois, United States
Sending and Receiving a SOAP Bound Attachment
A client process sends Text and GIF files as attachments for the In-Band attachments to the server
process. The server process receives these attachments, and returns them as its response. The client
process captures the sent and received attachments' size.
It is a Bound Attachment when one part of the Input or Output WSDL message is of type
"base64binary" and that part is mapped with an attachment. In a concrete WSDL, the attachment is
described as a mime part of the Multipart message.
Prerequisites
Copy the Attachment.txt and tibcologo.gif files from TIBCO_HOME\bw\n.n\samples\binding
\soap\http\BoundAttachments to the directory specified for the AttachmentBaseDir property.
TIBCO ActiveMatrix BusinessWorks™ Samples
26
Procedure
1. In the samples directory, select binding > soap > HTTP > BoundAttachments and double-click
tibco.bw.sample.binding.soap.http.BoundAttachments. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.BoundAttachments project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ClientProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click theApplications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.BoundAttachments.application.
8. Click Debug. This will run the sample in Debug mode.
9. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
A BoundAttachments directory is created and the Output.log file is written to it.
Sent binary file size : 2878 bytes. Received binary file size : 2878 bytes. Sent
text file size : 35 Received text file size : 35
Understanding the Configuration
The ServerProcess implements the getsetAttachments operation. It receives the Client request
that has WSDL message parts defined as base64Binary type and has Binary and Text
attachments. Service reply mechanism sends back the same attachments to the ClientProcess.
The ClientProcess invokes the ServerProcess with input attachments (Binaryand Text).
Consumer (Client) reads the input files and sends them to Producer (Server)process.
Attachments received from Server are written to the disk on the Client side. Finally, the Sent
and Received file size information for Binary and Text attachments is written at the location
specified in OUTPUT_FILE module property.
These attachments' size matches and also depicts that attachments can be sent or received
between the Producer and Consumer where they are defined as part of the WSDL definition.
Interoperability of Using JAX-WS Client to Invoke Service
This example illustrates the interoperability of using JAX-WS client to invoke Service exposed on
TIBCO ActiveMatrix BusinessWorks ™.
Prerequisites
Copy the jaxws_sample.wsdl from TIBCO_HOME\bw\n.n\samples\binding\soap\http
\JAXWSInterop to the directory specified for “CONCRETE_WSDL_LOCATION_URL” property.
Procedure
1. In the samples directory, select binding > soap > http > JAXWSInterop and double-click
tibco.bw.sample.binding.soap.http.JAXWSInterop. See Accessing Samples for more information.
TIBCO ActiveMatrix BusinessWorks™ Samples
27
2. In Project Explorer, expand tibco.bw.sample.binding.soap.http.JAXWSInterop project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Client.bwp.
5. Place the jaxws_sample.wsdl at the location of Module Property value
“CONCRETE_WSDL_LOCATION_URL”.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http. JAXWSInterop.application.
9. Click Debug. This will run the sample in Debug mode.
10. In TIBCO Business Studio ™, click the Terminate
icon to stop the process.
Result
The result shows the following response in the console and the output file:
Response for : Sending JAX-WS client request...
Understanding the Configuration
The sample consists of two TIBCO ActiveMatrix BusinessWorks ™ processes:
●
tibco.bw.sample.binding.soap.http.jaxwsinterop.Client
●
tibco.bw.sample.binding.soap.http.jaxwsinterop.ServerProcess
Service process exposes an operation to accept an input string and returns string as part of
response.
Client process uses a concrete WSDL generated from service to send a request with input
parameters and then writes the response to file.
Client process uses a Java Invoke activity that passes the concrete WSDL location to the Java
invoke (tibco.bw.sample.binding.soap.http.jaxwsinterop.Client.java) and JAX-WS client code
sets value ("Sending JAX-WS client request...") as input and then sends the request.
Invoking a SOAP over HTTP Web Service Using Different SOAP Versions
This sample shows implementation of a service for determining zip code information. This includes
getting information for the city for the specific zip code and calculating distance between two cites
defined by their zip codes.
The process provides city information based on a zip code, using HTTP as the transport. The service
represents a simple HTTP based service using SOAP 1.1 and SOAP 1.2.
Prerequisites
To run the sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
TIBCO ActiveMatrix BusinessWorks™ Samples
28
Procedure
Configure the Server
1. In the samples directory, select binding > soap > http > MixedSOAPVersions and double-click
tibco.bw.sample.binding.soap.http.MixedSOAPVersions. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco.bw.sample.binding.soap.http.MixedSOAPVersions project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Process.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.MixedSOAPVersions.application.
8. Click Debug. This will run the sample in Debug mode.
Configure the TIBCO ActiveMatrix BusinessWorks ™ Client
9. Unzip the TIBCO_HOME\bw\n.n\samples\bindings\soap\http\MixedSOAPVersions
\bw5\tibco.bw.binding.soap.http.MixedSOAPVersionsClient.zip file to a directory.
10. Start TIBCO Designer and open the unzipped project in the directory.
a) In TIBCO Designer, click Global Variables and verify whether the variables are set correctly.
b) Click theTester tab and then click the green button. Click the check box next to the process and
then select Load & Start Current.
c) After the process completes, click the Stop Testing icon to stop the process.
11. In TIBCO Business Studio ™, click the Terminate
icon to stop the process.
Result
●
For getCityInfoTest, the zip code defined in the zip field returns information about Urbana IL.
●
For getCityDistanceTest, the distance between two zip codes is returned.
The following output is visible in the console:
12:37:20.751 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log - Invoked cityinfo
12:37:20.774 INFO [bwThread:In-Memory STWorkProcessor-4]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log - getCityInfo:
city: Urbanastate: Illinois
location: Urbana, Illinois, United States
latitude: 44.11
longitude: 88.207
zip: 61801
12:37:22.642 INFO [bwThread:In-Memory STWorkProcessor-6]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log1 - Invoked cityDistance
TIBCO ActiveMatrix BusinessWorks™ Samples
29
12:37:22.650 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log -getCityDistance: 4
Understanding the Configuration
The server process has two operations implemented: getCityInfo and getCityDistance are
used to return information, based on zip codes.
The operations implemented in the server process are invoked using the getCityDistanceTest
and getCityInfoTest test processes from the client project developed in ActiveMatrix
BusinessWorks 5.x.
●
The endpoint ConcreteZipInfo_SOAP1.1 using SOAP 1.1 implements getCityInfoTest.
●
The endpoint, ConcreteZipInfo_SOAP1.2 using SOAP 1.2 implements getCityDistance.
Invoking a SOAP over HTTP Web Service Using Different Binding Styles
This sample shows the creation and invocation of a SOAP over HTTP web service. It demonstrates how
to use two different binding styles, RPC and DOC Literal for the same service on two different
endpoints.
Prerequisites
To run the sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
Procedure
Configure the Server
1. In the samples directory, select binding > soap > http > MixedStyles and double-click
tibco_bw_sample_binding_soap_http_mixedstylesprovider. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco_bw_sample_binding_soap_http_mixedstylesprovider
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Process.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco_bw_sample_binding_soap_http_mixedstylesprovider.
8. Click Debug. This will run the sample in Debug mode.
Configure the TIBCO ActiveMatrix BusinessWorks ™ Client
9. Unzip the TIBCO_HOME\bw\n.n\samples\bindings\soap\http\MixedStyles
\bw5\tibco.bw.binding.soap.http.MixedStylesClient.zip file to a directory.
10. Start TIBCO Designer and open the project unzipped in the directory.
a) In TIBCO Designer, click Global Variables and verify the variables are set correctly.
b) Click Tester and then click the green button. Select the check box next to the process and then
click Load & Start Current.
TIBCO ActiveMatrix BusinessWorks™ Samples
30
c) After the process completes, click the Stop Testing
11. In TIBCO Business Studio ™, click the Terminate
icon to stop the process
icon to stop the process.
Result
The Service has the following two different endpoint bindings:
●
The Document/Literal is the endpoint for ZipPortEndpoint1.
●
The RPC/Literal is the endpoint for ZipPortEndpoint2.
For the getCityInfoTest operation, you can view the information corresponding to the zip code that is
defined in the zip field. Its default value is 60801. This should return information about Urbana, IL.
For the getCityDistanceTest operation, you can view the information corresponding to the distance
between two zip codes. The default values are:
●
60801: Urbana, IL
●
61820: Champaign, IL
The console shows the following output:
15:24:51.971 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log - Invoked cityinfo
15:24:51.992 INFO [bwThread:In-Memory STWorkProcessor-4]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log - getCityInfo-DOC:
city: Urbana
state: Illinois
location: Urbana, Illinois, United States
latitude: 40.11
longitude: 88.207
zip: 61801
15:24:53.857 INFO [bwThread:In-Memory STWorkProcessor-6]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log1 - Invoked cityDistance
15:24:53.865 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.b.s.h.M.Log -getCityDistance-RPC: 4
Understanding the Configuration
At run-time for the first operation, the client sends a SOAP request comprising a zip code and
receives a city information of that zip code. For the second operation, the client sends a SOAP
request comprising two zip codes and returns the distance between the two cities defined by
their zip codes.
The following shared resources are defined in the project:
●
HTTPConnectorResource.httpConnResource: The HTTP Connection Shared Resource
containing the transport configuration.
●
CitySchema.xsd: The XSD Schema file containing the definition of the types used by the
web service interface.
●
ZipInfo.wsdl: The WSDL file that describes the web service.
TIBCO ActiveMatrix BusinessWorks™ Samples
31
Implementing a Service with a Service Binding and a Client with a
Reference Binding
In this sample, a service implements a simplified online mortgage broker application. The borrower
requests a loan through a broker. The broker processes the loan request using one of the third-party
partner services. The borrower can either specify the preferred third-party provider or allow the broker
to default to one. The third-party partner services request credit rating of the borrower from a credit
check service and in turn approves or rejects the loan application based on the credit rating.
Procedure
1. In the samples directory, select binding > soap > http > MortgageBrokerServiceClient and doubleclick tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient. See Accessing Samples for
more information.
2. In Project Explorer, expand the tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. You can modify the values specified for the Name, Amount, and Preferred bank fields by clicking
on the Input tab of the Invoke activity Client in the borrower.LoanRequestProcess process.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient.application.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
TIBCO ActiveMatrix BusinessWorks™ Samples
32
Result
The response is printed to the console and to disk in the output.log file. The response contents are
either response from Mortgage Broker:Name: John: Status: REJECTED, or response from
Mortgage Broker:Name: John : Status: APPROVED.
●
When a preferred bank is specified, the corresponding bank service is invoked. If not, Bank_A
service is invoked.
●
When the Bank_A and Bank_C servives are invoked, either an Approved or Rejected message is
returned, depending on the (random) credit score for the applicant.
TIBCO ActiveMatrix BusinessWorks™ Samples
33
Understanding the Configuration
This sample illustrates various features of the Process Reference. These features are present as
options of Reference Type available on the General tab of the properties view of the Process
Reference.
The available options are:
●
Binding Reference
●
Binding Reference - External
●
Process Reference
●
Process Reference - Dynamic
The following processes defined in this sample explain their features in the processes.
borrower.LoanRequestProcess
This process acts as a Consumer and allows the borrower to issue a loan request to the
Mortgage Broker Service. The borrower specifies the values of the following fields in the
requestLoanOperation activity in the borrower.LoanRequestProcess process.
●
Borrower name
●
Loan amount requested
●
Preferred bank. Specify one of the available banks "Bank_A" and "Bank_C". By default, the
broker service calls bank A, if no preferred bank is specified.
Add an empty string "", for not specifying a preferred bank.
TIBCO ActiveMatrix BusinessWorks™ Samples
34
This process uses Process Reference option to invoke the Mortgage broker process. This
options statically map the two Processes together.
mortgageBroker.LoanRequestProcess
This process receives the request from the borrower and calls the available SOAP Service
Providers through subprocess calls.
Depending on the value of "Preferred bank" request field, this process either uses Process
Reference -Dynamic option with Set EPR activity to dynamically call Bank_A_PartnerProcess
TIBCO ActiveMatrix BusinessWorks™ Samples
35
or Bank_C_PartnerProcess sub process OR uses the Process Reference option to statically
invoke the Default_PartnerProcess sub process.
Each subprocess uses the Binding Reference option on the Process Reference to act as a SOAP
Service Consumer, of an available Bank Service.
banks.bank_A.Bank_A_Process
This process acts as both a SOAP Service Provider for the mortgage broker and a SOAP Service
Consumer for the Credit Check Service.
SOAP Service Provider configuration is specified at the Component level.
TIBCO ActiveMatrix BusinessWorks™ Samples
36
Bank_A_Process invokes the credit check service through "BankSubProcessForCreditCheck"
sub process. This subprocess uses Binding Reference option, on the Process Reference, to act as
a SOAP Service Consumer.
banks.bank_C.Bank_C_Process
This process receives the details of the borrower from the mortgage broker and queries a credit
check services to validate the borrower credentials. The bank can specify the borrower name.
The process exposes services to the mortgage broker.
This process acts as both a SOAP Service Provider for the mortgage broker and a SOAP Service
Consumer for the Credit Check Service.
TIBCO ActiveMatrix BusinessWorks™ Samples
37
SOAP Service Provider configuration is specified at the Component level.
Bank_C_Process uses Binding Reference-external option on the Process Reference, to act as a
SOAP Service Consumer of the Credit check Service.
Configuration of Binding Reference-external is specified at the Component Level.
creditCheck.CreditCheck
This process acts as a SOAP Service Provider for credit check functionality. It processes the
request returns the credit rating for a customer.
SOAP Service Provider is configured at the Component level.
Implementing a Mortgage Loan Application with Fault
This sample shows a service implementation that invokes fault using a service and reference binding.
In this sample, the service implements a simplified online mortgage broker application. The borrower
requests a loan through a broker and the broker processes the loan request using one of the third-party
partner services. The borrower can specify the preferred third-party provider. The third-party partner
services request credit rating of the borrower from a credit check service and in turn replies with fault
message if requested loan amount is not valid.
Procedure
1. In the samples directory, select binding > soap > http > MortgageLoanClientFault and double-click
tibco_bw_sample_binding_soap_http_mortgagebrokerservice. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco_bw_sample_binding_soap_http_mortgagebrokerservice
project.
3. Fully expand the Processes directory and double-click LoanRequestProcess.bwp.
TIBCO ActiveMatrix BusinessWorks™ Samples
38
4. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
5. Double-click the requestLoanOperation activity.
6. Click the Input tab and modify the values for the Name, Amount and Preferred bank fields. Enter
amount less than or equal to 25000 or greater than equal to 100000 in the Amount field.
7. Click Run > Debug Configurations.
8. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
9. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco_bw_sample_binding_soap_http_mortgagebrokerservice_application.
10. Click Debug. This will run the sample in Debug mode.
11. Click the Terminate
icon to stop the process.
Result
When a preferred bank is specified, the corresponding bank service is invoked.
Bank_A and Bank_C, when invoked, returns fault message Requested
Loan Amount is not valid.
Loan amount should be more than 25000 and less than 100000.
TIBCO ActiveMatrix BusinessWorks™ Samples
39
Understanding the Configuration
The following shared resources are defined in the project:
●
HTTPConnectorResource.httpConnResource: The HTTP Connection Shared Resource that
contains the transport configuration.
●
BankLoanSchema.xsd: The XSD Schema file that contains the definition of the types used
by the Bank web service's interface.
●
BrokerSchema.xsd: The XSD Schema file that contains the definition of the types used by
the Broker web service's interface.
●
CreditCheckSchema.xsd: The XSD Schema file that contains the definition of the types used
by the Credit Check web service's interface.
●
BankWSDLAbstract.wsdl: Common service interface to request for a loan from a bank.
●
CreditCheckWSDL.wsdl: The WSDL file that describes the Credit Check web service.
●
BrokerWSDL.wsdl: The WSDL file that describes the Mortgage Broker web service.
The example consists of the following:
●
CreditCheckService: Provides services for loan approvals. In this example, the borrowers
can choose one of the two banks, Bank A and Bank C. These services call
CreditCheckService to approve or reject a loan request or to verify if the requested loan
amount is not valid.
●
Bank_A_Process / Bank_C_Process: Provides service to get the credit rating for a customer
by calling a process that generates a credit score or reply with a fault message if the
requested loan amount is invalid.
●
mortgageBroker.LoanRequestProcess: Provides service to request for a loan through the
Mortgage Broker. The broker in turn checks with the preferred bank for the loan.
●
LoanRequestProcess: Allows the borrower to issue a loan request. The borrower can
specify Name, Amount, and Preferred Bank. Depending on the Preferred Bank value the
respective Bank Process is invoked.
Sending and Receiving a SOAP Unbound Attachment
A client sends Text and GIF files as attachments for unbound attachments to the server process. The
Server process receives these attachments and returns them as its response. The Client process captures
the sent and received attachments size.
Prerequisites
Copy the Attachment.txt and Client.gif files from TIBCO_HOME\bw\n.n\samples\binding\soap
\http\UnboundAttachments to the directory given for the AttachmentBaseDir property.
It is an Unbound Attachment when no part of the Input or Output WSDL message is mapped to an
attachment. In the concrete WSDL there is no indication whether an attachment is required in the Input
or Output. You can map an attachment in the mimePart config at Binding level only at design time.
Procedure
1. In the samples directory, select binding > soap > HTTP > UnboundAttachments and double-click
tibco.bw.sample.binding.soap.http.UnboundAttachments. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.UnboundAttachments project.
TIBCO ActiveMatrix BusinessWorks™ Samples
40
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Click Run > Debug Configurations.
5. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
6. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.http.UnboundAttachments.application.
7. Click Debug. This will run the sample in Debug mode.
8. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
An UnboundAttachments directory is created and output.log file is generated with the following
content written to it:
Sent binary file size : 2878 bytes. Received binary file size : 2878 bytes. Sent
text file size : 35 Received text file size : 35
Understanding the Configuration
The ServerProcess implements the getsetAttachments operation along with Context activities.
It receives the Client request that has WSDL message parts defined as Element of Complex
type. Binary and Text attachments are retrieved using Get Context activity. Service reply
mechanism sends back the same attachments to the ClientProcess using Set Context activity.
The ClientProcess invokes the ServerProcess with input attachments (Binary and Text) using
Set Context activity. The Consumer (Client) reads the input files and sends them to the
Producer (Server) process using the context mechanism. Attachments received from the Server
through Get Context activity are written to disk on the Client side. Finally, the Sent and
Received file size information for Binary and Text attachments is written at the location
specified in the OUTPUT_FILE module property.
These attachments' size matches and also depicts that attachments can be sent or received
between the Producer and Consumer where they are defined using the context mechanism
outside of WSDL definition.
Managing a Purchase Order
A purchase order moves through a set of operations including submission, verifying status, calculating
price, and managing faults. This sample shows the processes used to manage these operations.
Prerequisites
To run the sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
Procedure
Configure the Server
1. In the samples directory, select binding > soap > http > PurchaseOrder and double-click
tibco.bw.sample.binding.soap.http.PurchaseOrder. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.PurchaseOrder project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
TIBCO ActiveMatrix BusinessWorks™ Samples
41
4. Copy the ShippingCosts.xml and PriceBook.xml files from TIBCO_HOME\bw\n.n\samples
\binding\soap\http\PurchaseOrder to the directory given for the INPUT_DIRECTORY
property.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.PurchaseOrder.application.
8. Click Debug. This will run the sample in Debug mode.
Configure the ActiveMatrix BusinessWorks 5.x Client
9. Extract the ActiveMatrix BusinessWorks 5.x client project
bw5\tibco.bw.sample.binding.soap.http.PurchaseOrder.Client.zip
directory.
into a temporary
10. Start TIBCO Designer and import the ActiveMatrix BusinessWorks 5.x client project from the
temporary directory.
11. In TIBCO Designer verify the output file, Host, and Port global variables.
If you change the module properties in the project, you must regenerate the concrete
WSDL and import it into the 5.x client project.
12. In TIBCO Designer, click Tools > Tester > Start.
13. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
You will see the following output:
Purchase ID 1234 is not valid
Submit PurchaseOrder Successful
Successful Status
Status PurchaseOrder :Pending
Status PurchaseOrder: Processed
TIBCO ActiveMatrix BusinessWorks™ Samples
42
Understanding the Configuration
The SellerService main process implements the submitPurchaseOrder and
checkStatusPurchaseOrder operations. The submitPurchaseOrder operation returns a
purchase order ID. A buyer uses this ID to check status when invoking the
checkStatusPurchaseOrder operation. Each operation calls subprocesses:
●
The SubmitPOExecute subprocess is called from the submitPurchaseOrder operation and
initiates the purchase order submission by calling the SubmitProcessOrder sub process and
then generates the purchase order ID.
●
The SubmitProcessOrder subprocess calls the GetPriceForItem and
CalculateShippingCosts sub processes to calculate item prices and shipping costs
respectively. After these calculations complete, the purchase order changes to processed
status, from pending status.
●
The GetPriceForItem subprocess reads data from PriceBook.xml and returns the price for
an item.
●
The CalculateShippingCosts subprocess reads data from ShippingCosts.xml and returns
the shipping costs based on region.
●
The CheckStatus subprocess is called from the checkStatusPurchaseOrder operation and
returns the status of purchase order, either pending or processed.
Using SOAP Bound Headers
This sample shows how to use SOAP Bound Headers by passing any data or control information in the
SOAP envelope. In this sample the Input WSDL message part is configured as a Header in the WSDL
definition.
Procedure
1. In the samples directory, select binding > soap > http > SOAPBoundHeaders and double-click
tibco.bw.sample.binding.soap.http.SOAPBoundHeaders. See Accessing Samples for more
information.
2. In the Project Explorer expand the tibco.bw.sample.binding.soap.http.SOAPBoundHeaders
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Client.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.SOAPBoundHeaders.application
8. Click Debug. This will run the sample in the Debug mode.
9. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The expected outcome for the file identified in the OUTPUT_FILE property is similar to the following
console output:
TIBCO ActiveMatrix BusinessWorks™ Samples
43
10:41:08.248 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.b.s.h.S.Log - Invoked cityinfo
10:41:08.273 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.b.s.h.S.Log - CityInfo response:
city: Urbana
state: Illinois
location: Urbana, Illinois, United States
latitude: 40.11
longitude: 88.207
zip: 61801
10:41:10.299 INFO [bwThread:In-Memory STWorkProcessor-5]
c.t.b.p.g.L.t.b.s.b.s.h.S.Log1 - Invoked cityDistance
10:41:10.306 INFO [bwThread:In-Memory STWorkProcessor-6]
c.t.b.p.g.L.t.b.s.b.s.h.S.Log1 - CityDistance response:
Distance from cityUrbana to city Champaign is 4
Understanding the Configuration
This sample implements a service for determining information about the zip codes. This
includes getting information for the city at the specified zip code, and for getting the distance
between two cites (defined by their zip codes). CityInfo operation input message is configured
as SOAP Header data whereas the CityDistance operation input message is configured as
SOAP Body data.
Two operations are implemented in the server process. The service operations getCityInfo and
getCityDistance provide a means for getting the city information about a zip code and distance
between the cities. Both operations are invoked from the client side with a small sleep between
invocations.
Using SOAP UnBound Headers
SOAP Unbound headers can pass any Out-of-Band data or control information in the SOAP envelope.
In this sample a simple getBook operation based on the specified interface WSDL file is implemented
showing the use of SOAP Unbound Headers.
Procedure
1. In the samples directory, select binding > soap > HTTP > SOAPHeaders and double-click
tibco.bw.sample.binding.soap.http.SOAPUnboundHeaders. See Accessing Samples for more
information.
2. In the Project Explorer expand the tibco.bw.sample.binding.soap.http.SOAPUnboundHeaders
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ClientProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
TIBCO ActiveMatrix BusinessWorks™ Samples
44
7. Click Applications and then click the Deselect All button if you have multiple applications. Select
the check box next to tibco.bw.sample.binding.soap.http.SOAPUnboundHeaders.application.
8. Click Debug. This will run the sample in Debug mode.
9. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The expected outcome for the file identified in the OUTPUT_FILE property is:
Expected captchaID : CID007
Received captchaID : CID007
Understanding the Configuration
This sample shows the use of SOAP unbound headers on service and reference.
The service exposes a login method that accepts a username and password, and expects a
captcha string to be passed using SOAP unbound headers. Verification of the received
username and password returns a captchaID to caller.
The ClientProcess sends a username and password as part of request message and sends the
captcha string using headers.
The ServerProcess receives the username and password and, on successful verification of
credentials, returns a captchaID as part of the headers and returns a boolean indicating login
success or failure.
Using SOAP HTTP Transport Headers
This sample shows how to use SOAP Transport headers received on the service side. The service
publishes the transport header elements for two operations.
Procedure
1. In the samples directory, select binding > soap > HTTP > TransportHeaders and double-click
tibco.bw.sample.binding.soap.http.TransportHeaders. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.TransportHeaders project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Client.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.TransportHeaders.application.
8. Click Debug. This will run the sample in Debug mode.
9. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
For getCityInfoTest, you see the information corresponding to the zip code that is defined in the zip
field. Its default value is 61801, which returns information about Urbana IL.
TIBCO ActiveMatrix BusinessWorks™ Samples
45
For getCityInfoTestHeaders, you see the information corresponding to the distance between two zip
codes. The default values are 61801 for Urbana IL and 61820 for Champaign IL.
HTTP Transport Headers from the client side are captured along with input data on the service side.
Transport Headers parameters are saved on service side.
The file specified for the OUTPUT_FILE property is written with the following contents:
HTTP Transport Header elements for operation CityInfo:
method: POST
requesturi: /SOAPServiceBinding/zipPort/
httpversion: 1.1
querystring:
protocol: HTTP/1.1
port: 11005
Header->accept:
Header->accept-charset:
Header->accept-encoding: Header->content-type: text/xml; charset=UTF-8
content-length: 167
connection:
cookie:
pragma:
HTTP Transport Header elements for operation CityDistance:
method: POST
requesturi: /SOAPServiceBinding/zipPort/
httpversion: 1.1
querystring:
protocol: HTTP/1.1
port: 11005
Header->accept:
Header->accept-charset:
Header->accept-encoding: Header->content-type: text/xml; charset=UTF-8
content-length: 360
connection:
cookie:
pragma:
TIBCO ActiveMatrix BusinessWorks™ Samples
46
Understanding the Configuration
This sample implements a service to determine the information about the zip codes along with
passing the HTTP Transport parameters using the context resource. This includes getting
information for the city at the specified zip code, and for getting the distance between two cites
(defined by their zip codes).
Two operations are implemented in the server process. The service operations getCityInfo and
getCityDistance provide a means for getting the city information about a zip code and distance
between the cities. HTTP Transport Headers are captured on the service side using the Context
activities.
Both operations are invoked from the client side with a small sleep between invocations. HTTP
Transport Headers details from client side are captured as an output on the service side.
Sending a SOAP Request and Receiving a SOAP Reply
A SOAP client is configured to send messages to a SOAP server, which processes the requests and
sends back responses back to the SOAP client.
Prerequisites
To run the sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
Procedure
Configure the Server
1. In the samples directory, select binding > soap > http > WSDLImportWSDLand double-click
tibco.bw.sample.binding.soap.http.WSDLImportWSDL. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.WSDLImportWSDL project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click QueryBooksByAuthor.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.http.WSDLImportWSDL.application.
8. Click Debug. This will run the sample in Debug mode.
Configure the ActiveMatrix BusinessWorks 5.x Client
9. In TIBCO Designer, import the client project,
bw5\tibco.bw.sample.binding.soap.http.WSDLImportWSDL.client.
10. Update the HTTP shared resource configuration and verify the Host and Port values and
OUTPUT_FILE global variable.
If you updated HTTPConnector.httpConnResource in the project, you must regenerate the
concrete WSDL and import it into the 5.x client project.
11. In TIBCO Designer, click Tools > Tester > Start.
12. In TIBCO Business Studio, click the Terminate
icon to stop the process.
TIBCO ActiveMatrix BusinessWorks™ Samples
47
Result
The output of the SOAP Request Reply activity shows the book values returned by the server,
Advanced Java John Doe March, 2002 0596002111 O'Connelly.
Understanding the Configuration
This sample shows how to generate a concrete WSDL, when an abstract WSDL imports another
WSDL, and how it is exposed by a service using a SOAP over HTTP binding. The server side is
implemented in ActiveMatrix BusinessWorks 6.x and the client side is implemented in
ActiveMatrix BusinessWorks 5.x. The client side shows a SOAP palette resource named SOAP
Request Reply, which is used to send a SOAP request to the server and receive a SOAP
response.
The abstract WSDL is named BooksInterface.wsdl:
●
The BooksInterface.wsdl abstract file imports the BooksMessage.wsdl file, which contains
messages used by the operations in BooksInterface.wsdl.
●
The BooksMessage.wsdl file imports the Books.xsd schema file, which contains elements
used by the messages in the BooksMessage.wsdl file.
●
The Books.xsd schema file includes the BooksType.xsd schema file, which contains the
types used by the elements in the Books.xsd file.
●
The SOAP over HTTP binding is used in the process service.
tibco.bw.sample.binding.soap.http.WSDLImportWSDL in ActiveMatrix BusinessWorks 6.x
contains the QueryBooksByAuthor process, which shows how to receive a SOAP request from
the SOAP client and process the request. This process executes as follows:
1. The service exposed via SOAP over HTTP receives a SOAP request.
2. The Reply activity from the Basic Activities palette sends a response back to the client.
tibco.bw.sample.binding.soap.http.WSDLImportWSDL.client in ActiveMatrix
BusinessWorks 5.x contains the QueryBooksByAuthor process, which shows how to send a
SOAP request to the SOAP server and process the response. This process definition executes as
follows:
1. The Timer activity starts a job.
2. The SOAP Request Reply activity sends a SOAP request to the SOAP server and receives
the response from the server and writes the response to OUTPUT_FILE location.
Implementing a HTTP Service That Returns Information Based on ZIP
Codes
The HTTP service returns information about a city, given a ZIP code. It also provides the distance
between two cities as defined by their ZIP codes.
Prerequisites
To run the sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
TIBCO ActiveMatrix BusinessWorks™ Samples
48
Procedure
Configure the Server
1. In the samples directory, select binding > soap > http > ZipCodeServiceProvider and double-click
tibco.bw.sample.binding.soap.http.ZipCodeServiceProvider. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.http.ZipCodeServiceProvider
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ZipCodeService.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.http.ZipCodeServiceProvider.application.
8. Click Debug. This will run the sample in Debug mode.
Configure the ActiveMatrix BusinessWorks 5.x Client
9. In TIBCO Designer, import the client project,
bw5\tibco.bw.sample.binding.soap.http.ZipCodeServiceProvider.client.
10. Update the HTTP shared resource configuration and verify the Host and Port values and
OUTPUT_FILE global variable.
If you updated HTTPConnector.httpConnResource in the project, you must regenerate the
concrete WSDL and import it into the 5.x client project.
11. In TIBCO Designer, click Tools > Tester > Start.
12. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
For the getCityInfo service, information corresponding to the zip code defined in the ZIP field is
returned. The default value is 61801, which returns information about Urbana, IL.
For the getCityDistance service, information corresponding to the distance between two ZIP codes is
returned. The default values are 61801 for Urbana IL and 61820 for Champaign IL.
Understanding the Configuration
The project contains the ZipCodeService process that provides city information about a ZIP
code. HTTP is used for the transport. The project represents a simple HTTP based service using
SOAP. The getCityDistance and getCityInfo operations are implemented in the
ZipCodeService process.
Implementing a JMS Service That Writes Attachment to File
This sample reads a GIF file as a binary data on the Consumer (client) and sends the request over JMS
transport with attachment configured in Set Context activity. The message format is a RPC-literal
element. The SOAP Service receives the message and writes it to the disk. The Service process then
reads the file from the disk and sends it back to the SOAP Consumer (client). Finally, the SOAP
Consumer (Reference binding) writes the same file to the disk.
TIBCO ActiveMatrix BusinessWorks™ Samples
49
Prerequisites
TIBCO Enterprise Message Service must be running.
Copy the ImageInput1.gif file from the TIBCO_HOME\bw\n.n\samples\binding\soap\jms
\AttachmentWriteToFile location to the c:\tmp folder on Windows or /tmp on UNIX. This file is
used as an input attachment.
In TIBCO EMS administration, create queue.sample before executing the sample.
Procedure
1. In the samples directory, select binding > soap > jms > AttachmentWriteToFile and double-click
tibco.bw.sample.binding.soap.jms.AttachmentWriteToFile. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.jms.AttachmentWriteToFile project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Server.bwp.
5. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click Test Connection to verify the connection.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.jms.AttachmentWriteToFile.application.
9. Click Debug. This will run the sample in Debug mode.
10. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The output.log file at C:\tmp\AttachmentWriteToFile location shows the following information:
Sent file size : 2514 bytes. Received file size : 2514 bytes.
You also see two attachments, printServer.gif and printClient.gif at C:\tmp
location.
\AttachmentWriteToFile
TIBCO ActiveMatrix BusinessWorks™ Samples
50
Understanding the Configuration
SOAP Consumer (Client) sends the binary data using context over JMS transport. Service
receives the attachment data and writes the attachment to the disk at location specified in
SENT_RECV_FILES_WTF property. Threshold size WRITE_THRESHOLD and WriteToFile
Directory is set on both Service and Reference binding.
The Consumer (Client) receives the attachment data from the Service using context and writes
the content to disk. Both Service Provider and Consumer (Client) write data to the disk based
on the Binding Persistence Configuration.
Generated attachment files, that is, printServer.gif and printClient.gif on
Service Provider and Consumer (client) must be identical to the provided INPUT_FILE
that is specified in the Module Properties.
Sending a One Way Message over JMS
The SOAP Invoke activity is used to send a one way message over JMS. The message format is a docliteral element. Because this is a one way message, no response is expected from the server.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select binding > soap > jms > OneWayDocLiteral and double-click
tibco.bw.sample.binding.soap.jms.OneWayDocLiteral. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.jms.OneWayDocLiteral project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click JMSClient.bwp.
5. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.jms.OneWayDocLiteral.application.
9. Click Debug. This will run the sample in Debug mode.
10. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The console displays messages similar to the following:
16:11:19.386 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.b.s.j.O.Log - [Server] Received Request :: date=2014-05-08+05:30
boolean=true double=1.1 int=22 string=testStr byte=33 short=44
The expected outcome for the file identified in the OUTPUT_FILE property is:
TIBCO ActiveMatrix BusinessWorks™ Samples
51
[Server] Received Request :: date=2014-05-08+05:30 boolean=true double=1.1
The OneWayDocLiteral.log output file generated at the C:\tmp\OneWayDocLiteral location shows
the one way request received from the server.
Understanding the Configuration
The project comprises the following two processes:
●
JMSClient
●
JMSServiceProcess
The JMSClient process sends a one way request to the JMSServiceProcess through a SOAP
doc-literal message.
Using JMS Destination Bridges
This sample illustrates the support of JMS destination bridges in TIBCO ActiveMatrix BusinessWorks.
Prerequisites
●
TIBCO Enterprise Message Service must be running.
●
In TIBCO EMS administration, create queue.sample and topic.sample before executing the
sample.
●
A bridge must be created between Topic to Queue, that is, between topic.sample and
queue.sample.
●
Create queue replyQueue.
Procedure
1. In the samples directory, select binding > soap > jms > TopicQueueBridge and double-click
tibco.bw.sample.binding.soap.jms.TopicQueueBridge. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.jms.TopicQueueBridge project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click client.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.jms.TopicQueueBridge.application.
9. Click Debug. This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
Result
The Console shows the following response:
TIBCO ActiveMatrix BusinessWorks™ Samples
52
11:39:13.563 INFO [bwThread:In-Memory STWorkProcessor-5]
c.t.b.p.g.L.t.b.s.b.s.j.T.Log - Response received with value :0.5
The TopicQueueBridge.log output file at C:\tmp\TopicQueueBridge location shows that the
message has been sent to the Topic and received from the Queue using SOAP over JMS.
Understanding the Configuration
The process sends a message to the Topic and is receives from the Queue using SOAP over
JMS.
This process executes as follows:
●
Client sends a request.
●
WS Service receives the request and calls the Service process. The Service process processes
the data and returns the response.
Implementing a JMS Service that Returns Information Based on Zip Codes
The JMS service returns information about a city, given a zip code. It also provides the distance
between two cities as defined by their zip codes.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select binding > soap > jms > ZipCodeLookup and double-click
tibco.bw.sample.binding.soap.jms.ZipCodeLookup. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.binding.soap.jms.ZipCodeLookup project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ZipInfoService.bwp.
5. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.binding.soap.jms.ZipCodeLookup.application.
9. Click Debug. This will run the sample in Debug mode.
10. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
For the getCityInfo service, information corresponding to the zip code defined in the zip field is
returned. The default value is 61801, which returns information about Urbana, IL.
For the getCityDistance service, information corresponding to the distance between two zip codes is
returned. The default values are 61801 for Urbana IL and 61820 for Champaign IL.
TIBCO ActiveMatrix BusinessWorks™ Samples
53
Understanding the Configuration
The project contains the ZipInfoService process that provides city information about a zip
code. JMS is used for the transport. The project represents a simple JMS based service using
SOAP. The getCityDistance and getCityInfo operations are implemented in the
ZipInfoService process.
Implementing a JMS Service That Returns an Attachment
The JMS service returns information about a city, given a zip code as an attachment.
Prerequisites
TIBCO Enterprise Message Service must be running.
Copy the CityInfo.xml from TIBCO_HOME\bw\n.n\samples\binding\soap\jms
\ZipCodeLookupWithAttachment file to the c:\tmp folder. The file has city information and is used to
send as the attachment.
In TIBCO EMS administration, create queue.sample and topic.sample before executing the sample.
Procedure
1. In the samples directory, select binding > soap > jms > ZipCodeLookupWithAttachment and
double-click tibco.bw.sample.binding.soap.jms.ZipCodeLookupWithAttachment. See Accessing
Samples for more information.
2. In Project Explorer expand the
tibco.bw.sample.binding.soap.jms.ZipCodeLookupWithAttachment project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ZipInfoService.bwp.
5. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click Test Connection to verify the connection.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.binding.soap.jms.ZipCodeLookupWithAttachment.application.
9. Click Debug. This will run the sample in Debug mode.
10. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The output.log file at C:\tmp\ZipCodeLookupWithAttachment location shows the following output:
Zip Code : 94086
City : SUNNYVALE
State : CA
TIBCO ActiveMatrix BusinessWorks™ Samples
54
Core Features
This section includes a set of samples that demonstrate core features, including using shared modules,
managing faults, configuring conversations, invoking sub processes and so on.
Using Process and Module Properties
This sample demonstrates the use of process and module properties.
Procedure
1. In the samples directory, select core > config > BasicPropertyConfiguration and double-click
tibco_bw_sample_core_config_processandmoduleproperties.zip. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco_bw_sample_core_config_processandmoduleproperties
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Click Run > Debug Configurations.
5. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
6. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco_bw_sample_core_config_processandmoduleproperties_application.
7. Click Debug. This will run the sample in Debug mode.
The WriteFileMProp activity writes to the file name that is defined in the MP_FileName1 Module
Property. The WriteFilePProp activity writes to the file name that is defined in the PP_FileName2
Process Property. By default, this value is set to C:\tmp\BasicPropertyConfiguration
\fileProcessPropDefault.log.
8. Click the Terminate
icon to stop the process.
Result
The fileModulePropDefault.log and fileProcessPropDefault.log files are written to the c:\tmp
directory. The console prints a message similar to the following:
\BasicPropertyConfiguration
INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.c.c.b.p.Log - ->Completed WriteToFileProcessA Job: bw0a100
Using a Process Conversation to Correlate JMS Message Jobs
JMS client and server processes correlate with each other by sending and receiving JMS messages
through the process conversation mechanism.
Prerequisites
Use TIBCO ActiveMatrix BusinessWorks 6.x server. However, if you want to run ActiveMatrix
BusinessWorks 5.x server, install TIBCO ActiveMatrix BusinessWorks 5.x.
TIBCO Enterprise Message Service must be running.
TIBCO ActiveMatrix BusinessWorks™ Samples
55
Procedure
1. In the samples directory, select core > conversation > MultiJobsCorrelation and double-click
tibco.bw.sample.core.conversation.MultiJobsCorrelation. See Accessing Samples for more
information.
2. In the Project Explorer, expand the tibco.bw.sample.core.conversation.MultiJobsCorrelation
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand tibco.bw.sample.core.conversation.MultiJobsCorrelation.application and doubleclick Properties. The output file location defined for the application is displayed in the dialog.
5. Ensure that the TIBCO Enterprise Message Service server is up and running.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.core.conversation.MultiJobsCorrelation.application.
9. Click Debug. This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
11. For the server created in ActiveMatrix BusinessWorks 5.x:
a) In TIBCO Business Studio, select Module Descriptors > Components and remove
Receiver.bwp.
b) Repeat steps 6 through 8 from above.
c) Unzip, open, and run bw5/tibco.bw.sample.core.conversation.MultiJobsCorrelation.Server in
the TIBCO Designer 5.x Tester.
Result
From the Debugger, expand BWNode to see the jobs created. Jobs are completed in the order of server
side reply and not in the order of their creation. The following image shows the resulting console
screen.
On UNIX, you can also verify the expected result by tailing the client output to the file /tmp/
MultiJobsCorrelation/MultiJobsCorrelation.log.
The MultiJobsCorrelation.log at the C:\tmp\MultiJobsCorrelation location shows requests 1 to
10 when sent in order with the corresponding correlation IDs. The server response is received out of
order and the runtime engine correlates each reply to the corresponding request correctly. You will see
the following output.
TIBCO ActiveMatrix BusinessWorks™ Samples
56
TIBCO ActiveMatrix BusinessWorks™ Samples
57
Understanding the Configuration
A conversation is configured with an Initiator and a Joiner. Click the WaitForServerReply
activity (a JMS Signal-In activity).
Click the Conversations tab. In this case, WaitForServerReply is both the Initiator and Joiner
for this conversation.
The WaitForServerReply activity's Initiate action is configured with $ReceiveLaunchMsg/
JMSHeader/ns:JMSCorrelationID where SendRequestToServer activity Input is also configured
with the same JMSCorrelationID. See the following.
The reason for this configuration is on the ActiveMatrix BusinessWorks 5.x JMSServerProcess
side. The Reply To Client activity is configured to send back the same JMSCorrelationID, for
the Reply to match with the correct Server Request job.
Using Modularity with the Java Palette
Three application modules and one shared module demonstrate calling from a Java Invoke activity and
an Invoke activity through a Call Process.
Prerequisites
1. For the Java invoke to work, create a new application on https://apps.twitter.com/ and generate
Access Token, Access Token Secret, Consumer Key, Consumer Secret for the app created, and use it
in the parameters for SearchTwitter activity.
2. To create a token:
TIBCO ActiveMatrix BusinessWorks™ Samples
58
a.
Login to https://apps.twitter.com/ with your Twitter account.
b.
Click Create New App.
c.
Provide Name and Description and create your Twitter application. Your application is
successfully created.
d.
Go to the API Keys tab and click Create my access token. Your application access token is
successfully generated.
e.
Click Test OAuth. The OAuth Settings page is generated with the following tokens:
●
Consumer key
●
Consumer secret
●
Access token
●
Access token secret
Procedure
1. In the samples directory, select core > modularity > ProcessAndJavaCodeModularity. The
following projects are visible:
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.importpackage
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall
2. First click on tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared and then
click on the remaining three projects.
3. In Project Explorer, expand the
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app project. See Accessing
Samples for more information.
4. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
5. Fully expand the Processes directory and double-click Process.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app.application.
9. Click Debug. This will run the sample in Debug mode.
The console window shows the log messages such as application
successfully and application started successfully.
module started
10. Run
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.importpackage.application
and
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall.application in
a similar way, one after the other.
Result
You see the following files generated in the C:\tmp\ProcessAndJavaCodeModularity folder after
running all the projects one after the other.
TIBCO ActiveMatrix BusinessWorks™ Samples
59
●
AppModule-RequiredModules-Output.log
the Configuration section.
●
AppModule-ImportPackage-Output.log
Configuration section.
●
generated by Scenario 2 described in Understanding the
AppModule-SubProcessCall-Output.log
Configuration section.
generated by Scenario 1 described in Understanding
generated by Scenario 3 described in Understanding the
These files contains a collection of relevant Tweets matching a specified query. In this case, it is "Lady
Gaga".
TIBCO ActiveMatrix BusinessWorks™ Samples
60
Understanding the Configuration
The sample has three Application Modules and one Shared Module:
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app: This is an
application module that contains the TIBCO ActiveMatrix BusinessWorks ™ Processes. It
uses the Java invoke in the shared module
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared. The
application module refers to the shared module using the Require-Bundle Manifest header.
The sample Java Invoke activity uses the Java invoke to connect to Twitter to search for the
string "Lady Gaga". Twitter returns a payload of tweets matching the search string, which
the Write To File activity then writes to a file in a temporary directory.
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.importpackage: This is
similar to the tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app
module, except here the application module uses Imported Packages instead of Required
Modules in Module Descriptors > Dependencies.
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall: This is
an application module that calls the web service hosted in the shared module.
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared: This is a
shared module that contains code to make a REST call to Twitter to search for a specified
search term. Since this is a shared module it cannot be executed by itself. However, it can be
called from an application module such as
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app,
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.importpackage,
and
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall
. This functionality is exposed by the shared module both as a Java class and a web service,
which can be invoked by an Invoke activity.
Process
Scenario 1
Modules Executed
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.app
This scenario demonstrates calling Java invoke (in a Shared Module) from a Java Invoke
activity in an Application module. The dependency on the Java package in the Shared Module
is modeled using Required Modules in Module Descriptors > Dependencies.
Scenario 2
Modules Executed
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.importpackage
This scenario shows how to call the Java invoke (in a shared module) from a Java Invoke
activity in an application module. The dependency on the Java package in the shared module is
modeled using Import-Package in Module Descriptors > Dependencies.
Scenario 3
Modules Executed
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared
TIBCO ActiveMatrix BusinessWorks™ Samples
61
●
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall
This scenario shows how to call the Java invoke (in a shared module) from an Invoke activity
in the application module through a Call Process. There is no Java package or bundle
dependency on the shared module.
The following sub process is in the shared module:
TwitterSearch SubProcess: This subprocess is invoked from
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall.
this subprocess, there are two JavaInvoke Activities - OpenTwitterConnection and
SearchTwitter. The source code for these activities is located under src directory under
com.example.TwitterConnection package in the same project.
In
OpenTwitterConnection activity creates a TwitterConnection object which is then passed to
SearchTwitter activity. SearchTwitter activity requires the following 5 input parameters:
●
SearchString
●
AccessToken
●
AccessTokenSecret
●
ConsumerKey
●
ConsumerSecret
SearchString signifies the string used by the user to search tweets. In this project, the
SearchString is "Lady Gaga". This SearchString is passed from the main process in
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.subprocesscall.
AccessToken, AccessTokenSecret, ConsumerKey, and ConsumerSecret are required for
authentication to the Twitter Account.
The steps to generate these are described in the Prerequisites section. You can change the
values of these module properties from Module Descriptors > Module Properties.
The Java invoke uses Twitter API v1.1 which requires the request to be authenticated
using OAuth.
The process for Scenario 1 and Scenario 2 is very similar to the subprocess of Scenario 3, except
that Scenario 1 and 2 have a Timer activity as a process starter instead of a service.
TIBCO ActiveMatrix BusinessWorks™ Samples
62
Troubleshooting
If you open Application Modules especially subprocesscall application module before
the shared module, then you may encounter errors such as Import Configuration Error,
Process Reference configuration Error, Application configuration Error, and so on.
●
If you receive the following error message:
"401:Authentication credentials (https://dev.twitter.com/docs/auth) were
missing or incorrect. Ensure that you have set valid consumer key/secret,
access token/secret, and the system clock is in sync."
make sure you have generated Access Token, Access Token Secret, Consumer Key,
Consumer Secret as per the steps specified in the Prerequisites section
●
If you see any problem markers in the project, make sure
tibco.bw.sample.core.modularity.ProcessAndJavaCodeModularity.shared is
imported into the workspace as all other application modules depend on this shared
module.
Configuring a Conversation to Join a Wait for File Change Activity
The Wait For File Change activity initiates and joins conversation with a File Poller activity to
implement a process conversation.
Procedure
1. In the samples directory, select core > conversation > WaitForFileChange and double-click
tibco.bw.sample.core.conversation.WaitForFileChange. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco.bw.sample.core.conversation.WaitForFileChange project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand tibco.bw.sample.core.conversation.WaitForFileChange.application and double-click
Properties. The output file locations defined for the application displays in the dialog.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.core.conversation.WaitForFileChange.application.
8. Click Debug. This will run the sample in Debug mode.
9. After completing the Scenario1 and 2, click the Terminate
icon to stop the process.
Result
The request is Approved.
Understanding the Configuration
Procedure
1.
Trigger.bwp
process creates Trigger.log and this triggers a job.
TIBCO ActiveMatrix BusinessWorks™ Samples
63
2.
process creates Req.log and writes "Approved" in the same file. This triggers event
for the "Wait For File Change".
Trigger.bwp
3. When the Wait for File Change activity executes, the process instance suspends and waits for the
specified change to occur before resuming.
Output file gets created at: c:\tmp\WaitForFileChange\WaitForFileChange.log with content:
"The request is Approved."
4. The RemoveApprovalFile activity removes the Req.log file from c:\tmp\WaitForFileChange.
5. "TriggerAnotherJob": This activity triggers another job and process execution waits at
"WaitForFileChange" activity for matching the correlation keys.
6. If the user creates Req.log file at location c:\tmp\WaitForFileChange with content "Rejected",
then conversation gets executed successfully and the output file at c:\tmp\WaitForFileChange
\WaitForFileChange.log gets updated as mentioned below:
The request is Approved.
The request is Rejected.
Using an Asynchronous Event Handler to Implement a Simple Mortgage
Workflow
Mortgage application consumer and provider processes interact with each other through the message
correlation mechanism. The event handler invocation allows for asynchronous event processing and
executes the logic parallel to the main business logic of the process.
Procedure
1. In the samples directory, select core > event > AsyncEventHandler and double-click
tibco.bw.sample.core.event.AsyncEventHandler. See Accessing Samples for more information.
2. In Project Explorer, expand the tibco.bw.sample.core.event.AsyncEventHandler project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click the MortgageAppConsumer.bwp and the
MortgageAppProvider.bwp processes.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.core.event.AsyncEventHandler.application.
8. Click Debug. this will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
On the console, the log messages will be displayed similar to the following:
12:19:45.639 [bwThread:In-Memory STWorkProcessor-2] INFO
c.t.b.p.g.L.t.b.s.c.e.A.LogSubmitMortgage - ### Received SubmitMortgageApp()
12:19:45.670 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log
- Cancel Application F54734546
12:19:45.685 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log
- Cancel Application F54734546
TIBCO ActiveMatrix BusinessWorks™ Samples
64
12:19:45.685 [bwThread:In-Memory STWorkProcessor-4] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log
- Cancel Application F54734546
12:19:45.701 [bwThread:In-Memory STWorkProcessor-8] INFO c.t.b.p.g.L.t.b.s.c.e.A.Log
- ### Done, get Mortgage Rate: 9.1
Understanding the Configuration
There are two processes in the supplied project:
●
MortgageAppProvider: This is a Mortgage service with three operations, the
SubmitMortgageApp, SubmitFinDoc and the CancelMortgageApp operations defined in
the event handler container. Both the CancelMortgageApp and SubmitFinDoc operations
have a correlation key obtained from the response to the operation SubmitMortgageApp.
●
MortgageAppConsumer: The consumer invokes the CancelMortgageApp operation before
the operation SubmitFinDoc: This way, the service calls CancelMortgageApp after
receiving the correlation message key, mortgageAppID: The CancelMortgageApp activity
has the input properties configured as shown in the following image.
Using a Cross Process Conversation to Determine the Mortgage Rate
The process conversation mechanism is demonstrated using a mortgage rate calculation scenario that
performs the following:
●
A user passes the customer's name and credit profile information.
●
If the credit profile value of the customer is A, the mortgage lending rate is 3.5 and if the credit
profile is B, the lending rate is 2.0.
●
Depending on the mortgage lending rate calculated, the lending institution decides either to accept
or to reject the application. This particular lender decides to lend money only with the 3.5 mortgage
rate. If the calculated rate is lower for any credit profile, the application is rejected by the lender.
Procedure
1. In the samples directory, select core > conversation > CrossProcessConversation and double-click
tibco.bw.sample.core.conversation.CrossProcessConversation. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco.bw.sample.core.conversation.CrossProcessConversation
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click MortgageAppConsumer.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
TIBCO ActiveMatrix BusinessWorks™ Samples
65
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.core.conversation.CrossProcessConversation.application.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The CrossProcessConversation.log output file at C:\tmp\CrossProcessConversation is created
with the following content:
Received application from BWUser user with credit profile B
Mortgage Cancelled
### DONE
The console displays the following log message:
12:20:42.735 INFO [bwEngThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.c.c.C.SubmitMortgageAppLog - Received application from BWUser user
with credit profile B
12:20:42.779 INFO [bwEngThread:In-Memory STWorkProcessor-4]
c.t.b.p.g.L.t.b.s.c.c.C.CancelMortgageAppLog - Mortgage Cancelled
12:20:42.818 INFO [bwEngThread:In-Memory STWorkProcessor-5]
c.t.b.p.g.L.t.b.s.c.c.C.Log - DONE
Understanding the Configuration
Operations implemented in the Service Provider process are invoked from the Consumer
process. The following processes are implemented:
●
The MortgageAppConsumer process invokes different operations implemented in the
MortgageServiceProvider process. The SubmitFinDoc or CancelMortgage operation is
called, based on the mortgage rate returned by the SubmitMortgageApp operation for a
customer.
●
The MortgageServiceProvicer process implements the SubmitMortgageApp,
SubmitFinDoc, or CancelMortgage operation. The SubmitMortgageApp operation
generates and returns the mortgage app id and tentative mortgage rate, based on the
customer's credit profile. The SubmitFinDoc operation submits the final mortgage
documents. The CancelMortgage operation cancels the mortgage request.
For details about the conversation, select the Conversation tab for each of the following:
●
The SubmitMortgageAppOut Reply activity for initiating the conversation.
●
The SubmitFinDocIn Receive activity for joining the conversation.
●
The onEvent Event Handler for joining the conversation.
A conversation is evaluated to true if the value in Join matches the mortgageAppID generated
by the SubmitMortgageApp operation for each mortgage request. This way, the
mortgageAppID is used as a key to process a mortgage request for a customer.
TIBCO ActiveMatrix BusinessWorks™ Samples
66
Catching Activity Faults with Scope and Fault Handlers
A scope and fault handler is defined for activities within a process. The handler catches faults that have
been triggered within the scope.
If accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
Procedure
1. In the samples directory, select core > fault > ScopeAndFaultHandler and double-click
tibco.bw.sample.core.fault.ScopeAndFaultHandler.zip. See Accessing Samples for more
information.
2. In Project Explorer, expand the tibco.bw.sample.core.fault.ScopeAndFaultHandler project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ScopeFault.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.core.fault.ScopeAndFaultHandler.application.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The console displays the messages based on the value specified in "INPUT_XML_FILE" Module
Property.
●
If the correct location is specified for the MortgageRatesDB.xml file in "INPUT_XML_FILE" Module
Property property, the message, The mortgage rate is 3.5 displays.
●
If an incorrect location is specified for the MortgageRatesDB.xml file in "INPUT_XML_FILE"
Module Property, the following error message displays:
Caught FNF: < User_Defined_File_Location >\MortgageRatesDB.xml was not found.
The same message is written in a output.log file at C:\tmp\ScopeAndFaultHandler location.
Modularity Among Applications with a Shared Module Project
This sample shows how modularity can be achieved among two application module projects and a
shared module project.
Two scenarios in this sample show how a process in a shared module can be used by other application
modules, without requiring changes to the contents of the shared module. The scenarios are
demonstrated in the following projects:
Application Module Projects
●
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer
●
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent
Shared Module Project
TIBCO ActiveMatrix BusinessWorks™ Samples
67
●
tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule
Procedure
Scenario 1
1. In the samples directory, select core > modularity > AppsWithSharedModule and double-click
tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule. See Accessing
Samples for more information.
2. In Project Explorer, expand the
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and click MainProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer.applicatio
n.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Scenario 2
10. In the AppsWithSharedModule directory, double-click the
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent project.
11. Click Run > Debug Configurations.
12. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication
13. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent.applicat
ion.
14. Click Debug. This will run the sample in Debug mode.
15. Click the Terminate
icon to stop the process.
Result
Scenario 1
The following messages are written by the shared module and application module to the
helloWorldServiceConsumer.log file at c:\tmp\AppsWithSharedModule location.
●
--> LogMessage from HelloWorldServiceProcess for John
●
--> Hello John from HelloWorldServiceProcess
Scenario 2
The following messages are written by the shared module and application module to the
timerEvent.log file at c:\tmp\AppsWithSharedModule location.
TIBCO ActiveMatrix BusinessWorks™ Samples
68
●
--> LogMessage from TimerEventProcessTimerEventProcess
●
--> Hello TimerEventProcess--> from LogMessage from TimerEventProcess
Understanding the Configuration
Scenario 1: The MainProcess included in the
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.HelloWorldConsumer
application module, invokes the HelloWorldServiceProcess in the
tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule. The Write To
File activity logs the output from the calling process, HelloWorldServiceProcess.
Scenario 2: The Process included in the
tibco.bw.sample.core.modularity.AppsWithSharedModule.App.TimerEventComponent
application module invokes the TimerEventProcess in the
tibco.bw.sample.core.modularity.AppsWithSharedModule.SharedModule.
Load Balancing an Application Using an AppSpace
This process demonstrates the concept of an AppSpace for scaling an application.
Prerequisites
●
TIBCO Enterprise Message must be running.
●
TIBCO Designer 5.x must be installed. It is used to send messages to the application.
●
PostgreSQL Database should be installed and running on the machine. Create tables by using the
related scripts for the engine database.
●
Sample uses default queue - 'queue.sample' of EMS server running on localhost.
Procedure
Setup the Domain
1. In a terminal, navigate to TIBCO_HOME\bw\n.n\bin and type bwadmin.
2. Create a Domain, AppSpace and AppNode:
bwadmin[admin]> create domain MyDomain
bwadmin[admin]> cd MyDomain
bwadmin[[email protected]]> create appspace MyAppSpace
bwadmin[[email protected]]> cd MyAppSpace
bwadmin[[email protected]/MyAppSpace]> create –httpPort 9999 appnode MyAppNode
Create the config.ini File
3. Copy TIBCO_HOME\bw\n.n\config\appspace_config.ini_template to a temporary location.
4. Rename the appspace_config.ini_template file to config.ini.
a) Uncomment the following property and change the value to group.
bw.engine.persistenceMode=group
b) Set the datastore configuration with values similar to:
# BW Engine Database Driver.
bw.engine.db.jdbcDriver=org.postgresql.Driver
# BW Engine Database URL.
bw.engine.db.url=jdbc:postgresql://localhost:5432/postgres1
# BW Engine Database User Name.
bw.engine.db.userName=postgres
# BW Engine Database User Password.
TIBCO ActiveMatrix BusinessWorks™ Samples
69
bw.engine.db.password=root
# BW Engine Database Connection Pool Size.
bw.engine.db.maxConnections=10
c) Save the config.ini file.
5. Push the configuration to the AppSpace running the following command in the bwadmin terminal:
bwadmin[[email protected]/MyAppSpace]> config -cf <temporary_location>/config.ini
6. In the bwadmin terminal, upload and deploy the EAR file into the AppSpace:
bwadmin[[email protected]/MyAppSpace]>upload
TIBCO_HOME\bw\x.x\samples\core\admin\ears\samples
\tibco.bw.sample.core.scalability.LoadBalancingUsingAppSpace.application_1.0.0.ea
r
bwadmin[[email protected]/MyAppSpace]> deploy -as
tibco.bw.sample.core.scalability.LoadBalancingUsingAppSpace.application_1.0.0.ear
7. Start the AppSpace using the following command:
bwadmin[[email protected]/MyAppSpace]> start appspace MyAppSpace
Configure and Start the Client
8. Start TIBCO Designer and click New Empty Project.
9. Click Project > Import and import the client project, TIBCO_HOME\bw\n.n\samples\core
\scalability\LoadBalancingUsingAppSpace
\bw5\tibco.bw.sample.core.scalability.LoadBalancingUsingAppSpace.client.
10. Update the JMS shared resource configuration and verify the Host and Port values.
11. In TIBCO Designer, click Tools > Tester > Start. Wait for 30 seconds before completing the next
steps.
Create a Second AppNode
12. In the bwadmin terminal, create a second AppNode in MyAppSpace. Execute the create command
to create the AppNode and then the start command to start the AppNode:
The TIBCO ActiveMatrix BusinessWorks ™ JMS application should be deployed to
MySecondAppNode automatically by the AppSpace.
bwadmin[[email protected]/MyAppSpace]> create –httpPort 9996 appnode MySecondAppNode
bwadmin[[email protected]/MyAppSpace]> start appnode MySecondAppNode
13. Open the bwappnode.log files on each node located under <DomainLocation>/<appnodes>/
<appspace>/<nodename>/bin [Example: <DomainLocation>/appnodes/betaappspace/
betaappnode1/bin]
and monitor the messages flow.
14. Stop the second AppNode using the following command:
bwadmin[[email protected]/MyAppSpace]> stop appnode MySecondAppNode
Result
Before stopping the second AppNode, the application is active on both the nodes. After stopping the
second AppNode, the application is active only on the first AppNode. See the bwappnode.log file to
monitor the messages processed by AppNode1.
Invoking Subprocesses
In this sample, the MakeNoise process calls the Invoke subprocess multiple times which in turn calls
another subprocess Log.
If accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
TIBCO ActiveMatrix BusinessWorks™ Samples
70
Procedure
1. In the samples directory, select core > soa > CallProcessAndInvoke and double-click
tibco.bw.sample.core.soa.CallProcessAndInvoke. See Accessing Samples for more information.
2. In Project Explorer, expand the tibco.bw.sample.core.soa.CallProcessAndInvoke project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click MakeNoise.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.core.soa.CallProcessAndInvoke.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The output.log file is generated in the C:\tmp\CallProcessAndInvoke directory. This file contains
output from MakeNoise process and Log sub process.
Understanding the Configuration
This is a hands-on and simple demonstration for the Design time experience with simple
Invoke services. The MakeNoise process calls the Invoke process with a single operation and a
simple string message. The Invoke process simply returns the Input as the Output.
Dynamically Invoking Subprocesses Using SetEPR Activity
This sample illustrates the Dynamic Invocation of the Subprocess using SetEPR activity. The SetEPR
activity generates the Endpoint Reference and determines the service to be invoked at runtime. In this
sample, the Service Consumer and Service provider reside in different applications.
Setup
Import the sample project into the workspace. Ensure that both applications are in the workspace. See
Accessing Samples for more information.
Description of the Project
This sample comprises two applications. Service Provider (Provider.bwp) and Service Consumer
(Consumer.bwp).
●
The Service Consumer invokes the service using Dynamic Process Reference, which is located in the
Service Provider application.
●
Service Consumer has one process, Consumer.bwp. This process has the Dynamic Reference to the
Service. The Consumer process contains a Sleep activity which ensures that consumer waits to
invoke the service, till the service gets deployed and is ready to process the request.
●
Service Provider has one process, Provider.bwp. This process uses the Hello.wsdl file to implement
the service and sends a response message to the incoming request.
TIBCO ActiveMatrix BusinessWorks™ Samples
71
Every application requires at least one Component to deploy the application. In this sample, the
Activator.bwp process is used in the service provider application for the Provider.bwp to be deployed
without configuring the binding.
The following image shows the configuration details of the Set EPR activity in the Consumer.bwp.
The following image shows the details of consumer using the Dynamic Process Reference as the
Reference Type.
TIBCO ActiveMatrix BusinessWorks™ Samples
72
Procedure
1. In the samples directory, select core > dynamic > processInvocation and double-click
tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer.
2. In Project Explorer, expand the
tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and click Consumer.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer and
tibco.bw.sample.core.dynamic.processInvocation.ServiceProvider applications.
8. Click Debug. This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
A output.log file is created with the content "Hello from the ServiceProvider".
TIBCO ActiveMatrix BusinessWorks™ Samples
73
Troubleshooting
If the service consumer starts before the service provider, then increase the value in the Sleep
activity in the Consumer.bwp.
TIBCO ActiveMatrix BusinessWorks™ Samples
74
Policy Feature
This section includes a set of samples that demonstrate how to enforce security policies to services and
bindings.
Enforcing Basic Authentication with LDAP Authentication
This sample describes how access to an HTTP service can be managed by enforcing Basic
Authentication on a process starter activity. In this sample, the Basic Authentication Policy is associated
with the HTTP Receiver Activity and configured to verify user credentials using LDAP authentication.
Prerequisites
You must be connected to an LDAP server and have user and group information stored in that server.
Procedure
1. In the samples directory, select policy > basicauthentication > HTTPReceiver and double-click
tibco.bw.sample.policy.basicauthentication.HttpReceiver.zip. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.policy.basicauthentication.HttpReceiver.zip
project.
3. In the Project Explorer pane, click Resources >
tibco.bw.sample.policy.basicauthentication.httpReceiver > defaultLdapProvider.ldapResource.
4. Fully expand the Processes directory and double-click HttpReceiverProcess.bwp .
5. In the Resource Editor, configure the following properties in the LDAP Authentication section
under the Connection tab:
●
●
Server URL: LDAP Server Location, such as, ldap://localhost:389
User Search Expression: search expression for the user, such as (&(cn={0])
(objectclass=user))
●
User DN Template: user distinguished name template, such as
cn={0},cn=users,dc=na,DC=tibco,DC=com
6. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
7. Fully expand the Processes directory and double-click HttpReceiverProcess.bwp .
8. Click Run > Debug Configurations.
9. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
10. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.policy.basicauthentication.HttpReceiver.application .
11. Click Debug.
This will run the sample in Debug mode.
12. Launch Google Chrome browser and enter the following URL http://localhost:9393/request.
The Google Chrome page displays a window asking you to enter your user name and password.
TIBCO ActiveMatrix BusinessWorks™ Samples
75
13. Enter your LDAP user name and password and click OK.
Result
After the request is authenticated successfully, the following message displays in the browser:
This is from HTTP Receiver Process. The request is successful.
Understanding the Configuration
In the HttpReceiverProcess.bwp process , the Basic Authentication policy is configured to
verify user credentials using LDAP Authentication and is associated with the HTTP Receiver
activity
Enforcing Basic Authentication on a REST Service Binding
In this sample, the Basic Authentication policy is enforced on a REST service. The REST service uses the
GET method to retrieve information from a file stored on your local machine.
Procedure
1. In the samples directory, select policy > basicauthentication > RestBinding and double-click
tibco.bw.sample.policy.basicauthentication.RestBinding.zip . See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.policy.basicauthentication.restbinding project.
3. Fully expand the Processes directory and double-click RestBindingProcess.bwp .
4. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.policy.basicauthentication.RestBinding.application .
8. Click Debug.
This will run the sample in Debug mode.
9. Launch a REST client, such as Postman Extension, on Chrome, and enter the request URL, for
example http://localhost:7777/resources, in the Enter request URL here field.
TIBCO ActiveMatrix BusinessWorks™ Samples
76
10. Click the GET operation.
11. Enter your user name and password under the BasicAuth section.
12. Click Update Request.
13. Click Send to test your application.
Result
GET books returns an output similar to the following:
<?xml version="1.0"?>
<purchaseOrder xmlns="http://tempuri.org/po.xsd" orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<billTo country="US">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo>
<comment>Hurry, my lawn is going wild!</comment>
<items>
<item partNum="872-AA">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<comment>Confirm this is electric</comment>
</item>
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
TIBCO ActiveMatrix BusinessWorks™ Samples
77
Understanding the Configuration
In this sample, a Basic Authenticaiton policy is associated with the REST service binding and
configured to verify user credentials using an XML Authentication resource.
The XML Authentication resource references an XML file that contains information about
users, groups, and roles. A user is a person with an authenticated credentials. A group is a
collection of users . Roles can be assigned to users to grant them permission to perform a
collection of tasks. Authorization, or permission, to access services can be assigned to both
users and groups.
In this sample, XML file is within workspace. The content of the XML file used by the XML
Authentication resource is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<realm xmlns="http://xsd.tns.tibco.com/trinity/realm/2013"
hashAlgorithm="PBKDF2WithHmacSHA256" repetitionCount="10240"
xsi:schemaLocation="http://xsd.tns.tibco.com/trinity/realm/2013 Realm.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<users>
<user>
<name>john</name>
<plaintext>password</plaintext>
<!-- attributes are optional -->
<attribute name="some-name" oid="some:thing">some-value</attribute>
</user>
<user>
<name>alex</name>
<plaintext>password</plaintext>
</user>
</users>
<group-mapping>
<group-name>managers</group-name>
<user-name>alex</user-name>
</group-mapping>
<group-mapping>
<group-name>administrators</group-name>
<user-name>alex</user-name>
<user-name>john</user-name>
</group-mapping>
</realm>
Enforcing Basic Credential Mapping on an Outbound Request
In this sample, basic credential mapping is enforced when InvokeRestApiProcess.bwp process makes a
client call to the RestBindingProcess.bwp process.
Procedure
1. In the samples directory, select policy > basiccredentialmapping > InvokeRestAPI and doubleclick tibco.bw.sample.policy.basiccredentialmapping.InvokeRestAPI.zip . See Accessing Samples
for more information.
2. In Project Explorer expand the tibco.bw.sample.policy.basiccredentialmapping.InvokeRestAPI
project.
3. Fully expand the Processes directory and double-click InvokeRestApiProcess.bwp and
RestBindingProcess.bwp .
TIBCO ActiveMatrix BusinessWorks™ Samples
78
4. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
tibco.bw.sample.policy.basiccredentialmapping.InvokeRestAPI.application.
8. Click Debug.
This will run the sample in Debug mode.
Result
The client is successfully invoked and the file invokeRest.log is generated at C:\tmp\policy on a
Windows system, or at /tmp/policy on a Unix system.
Understanding the Configuration
The following processes interact with each other in this project:
●
RestBindingProcess.bwp: To ensure the message recieved from InvokeRestApiProcess is
sent by an authenticated user, the service side of this process is associated with a Basic
Authentication policy that is configured with XML file authentication. The XML file is
included in the sample project and stored in your workspace.
●
InvokeRestApiProcess.bwp: To ensure credentials are provided in the request message
sent to RestBindingProcess, a Basic Credential Mapping policy configured for fixed
credential mapping is associated with the InvokeRESTAPI activity in this process.
Enforcing SOAP Security to Enable Confidentiality and Integrity on
Message Exchanges
This sample describes how WSS Provider and WSS Consumer policies can be enforced on SOAP/HTTP
message exchanges to ensure confidentiality and integrity.
In this sample, the following processes communicate with each other:
●
ServiceProvider.bwp: Provides a SOAP service.
●
ServiceConsumer.bwp: Consumes the SOAP service provided by the ServiceProvider process.
Also service provider asks to decrypt message from consumer and verify signature of consumer.
Prerequisites
Procedure
1. In the samples directory, select policy > confidentialityintegrity > SoapHttp and double-click
tibco.bw.sample.policy.confidentialityintegrity.SoapHttp.zip . See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.policy.confidentialityintegrity.SoapHttp project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Click Run > Debug Configurations.
TIBCO ActiveMatrix BusinessWorks™ Samples
79
5. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
6. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.policy.confidentialityintegrity.SoapHttp .
7. Click Debug.
This will run the sample in Debug mode.
Result
The ServiceConsumer process sucessfully calls the ServiceProvider process.
The file ConfidentialityIntegrity.txt is generated in the C:\tmp\policy directory on Windows
platform, or /tmp/policy directory on Unix platform.
Open the ConfidentialityIntegrity.txt file in a text editor. The default contents of the file are
outlined below.
The Request From Service Consumer: Bob The Response from Service Provider:
Welcome you Bob
Understanding the Configuration
The following processes interact with each other in this project:
●
ServiceProvider.bwp: To ensure decryption and signature verification on the incoming
request message, a WSS Provider policy configured for confidentiality and integrity is
associated with the service side of this process.
●
ServiceConsumer.bwp: To ensure the outbound request message to ServiceProvider is
encrypted and signed, a WSS Consumer policy configured for confidentiality and integrity
is associated with the reference side of this process.
Enforcing SOAP Security to Enable SAML Authentication and SAML
Credential Mapping
In this sample, SOAP message exchanges are secured with SAML Credential Mapping, user name
token-based authentication, and SAML authentication.
The following processes communicate with each other in this sample:
●
ClientProcess.bwp: Simulates a client call to Process1 to request a response from Process1
●
Process1.bwp: Calls Process2
●
Process2.bwp: Returns a response to Process1
Procedure
1. In the samples directory, select policy > samlcredentialmapping > SoapHttp and double-click
tibco.bw.sample.policy.samlcredentialmapping.SoapHttpBinding.zip . See Accessing Samples for
more information.
2. In Project Explorer expand the tibco.bw.sample.policy.samlcredentialmapping.SoapHttpBinding
project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Click Run > Debug Configurations.
5. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
TIBCO ActiveMatrix BusinessWorks™ Samples
80
6. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to
ttibco.bw.sample.policy.samlcredentialmapping.SoapHttpBinding.application.
7. Click Debug.
This will run the sample in Debug mode.
Result
Process1 call Process2 successfully
The file SamlCredentialMapping.txt is generated in the C:\tmp\policy directory on Windows
platform, or /tmp/policy directory on Unix platform.
Open the SamlCredentialMapping.txt file in a text editor. The default contents of the file are outlined
below.
Congratulations! This is response from Process2. SAML request is successful!
Understanding the Configuration
The following processes interact with each other in this project:
●
Process2.bwp: The service side of Process2 is associated with a WSS provider policy
configured for SAML authentication.
●
Process1.bwp: To ensure the outbound request to Process2 contains the credentials
authenticated in Process1, the following policies are enforced on Process1:
●
—
A WSS Consumer policy configured for SAML credential mapping is associated on the
reference side.
—
A WSS Provider policy configured for user name token authentication is associated
with the service side.
ClientProcess.bwp: To simulate a client call to Process1, a WSS Consumer policy,
configured for user name token credential mapping, is associated with the reference side of
ClientProcess.
TIBCO ActiveMatrix BusinessWorks™ Samples
81
Palettes Features
This section shows the use of palette activities by providing a large set of samples for using FTP, REST/
JSON, JAVA, JDBC, parse, XML, SOAP and REST binding.
Creating an Order Processing Service
This sample describes a simple order processing service where a File Poller activity waits for the
file to be updated. After an update is detected, the process creates an empty
approval file and calls a sub process to calculate the shipping costs. The process then waits for the
empty approval file to be updated. Finally, the BW_customer_notification.txt file with data in XML
format is created in the c:\tmp\OrderProcessing folder of the default location, or the path you
specified earlier that gives the customer the relevant shipping information.
BW_new_order.xml
In a real system, tasks such as database queries, email acknowledgment, and so on would be used to
implement this scenario. However, we have chosen to use files for this service to highlight the use of
the activities in the file palette.
If you are accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
Procedure
1. In the samples directory, select palette > file > OrderProcessing and double-click
tibco.bw.sample.palette.file.orderprocessing. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.file.orderprocessing project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ProcessOrder.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.file.orderprocessing.application.
8. Click Debug.
This will run the sample in Debug mode.
TIBCO ActiveMatrix BusinessWorks™ Samples
82
9. Click the Terminate
icon to stop the process.
Result
A BW_customer_notification.txt file is created in the c:\tmp\OrderProcessing folder of the
default location, or the path you specified earlier. This file contains the information similar to the
following:
●
Hank Hill, Your order has been approved. The cost is as follows, Purchase cost :
$123 Shipping costs : $40 Total Cost : $163
The BW_approve_order.txt file is deleted.
Understanding the Configuration
The following file names are defined as Module Properties and can be changed in the Module
Properties dialog.
●
BW_new_order.xml points to the XML file that contains the new order details and triggers
the process initially as Include Existing Files check box option is selected. For consecutive
triggers, the file must be updated (overwritten or modified) each time for the sample
process to run or the process will not start.
●
BW_shipping_costs.xml
●
BW_customer_notification.txt
contains shipping cost information.
complete shipping details.
●
BW_approve_order.txt
execution.
is created by the process to notify the customer of the
is created by the process. The file is deleted during process
Using FTP to Put and Get Files
This sample service invokes the FTP put and get commands. The service reads a file and places it on the
specified FTP server. The FTP get command is issued after a short pause and the file contents are
written back to the local storage.
Prerequisites
Copy the ftp_put_file.log file included in this sample to the c:\tmp directory. If the directory is not
available, refer to the steps listed in the Understanding the Configuration section.
Ensure that the following FTP server information is available:
TIBCO ActiveMatrix BusinessWorks™ Samples
83
●
FTP server name or IP address
●
FTP server port (default is 21)
●
FTP username
●
FTP user password
Procedure
1. In the samples directory, select palette > ftp > PutAndGet and double-click
tibco.bw.sample.palette.ftp.PutAndGet. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.ftp.PutAndGet project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Copy the ftp_put_file.log file to c:\tmp.
5. Fully expand the Resources directory and then double-click FTPConnectionResource.ftpResource.
Specify valid values for your FTP connection in the Host, Port, User Name, and Password fields.
Click Test Connection to verify your FTP connection.
6. Click File > Save.
7. Fully expand the Processes directory and double-click FTP_Put_and_Get.bwp.
8. Click Run > Debug Configurations.
9. At left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select
BWApplication.
10. Click theApplications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.ftp.PutAndGet.application.
11. Click Debug.
This will run the sample in Debug mode.
12. Monitor the log/trace and after a minute, verify whether the PutAndGet.log file has been created at
c:\tmp\PutAndGet.
13. Click the Terminate
icon to stop the process.
TIBCO ActiveMatrix BusinessWorks™ Samples
84
Result
●
The file specified by the module property BW_ftp_put_file is copied to the FTP server.
●
The file specified by the module property BW_ftp_get_file is written to c:\tmp\PutAndGet by the
FTP server. The default name is PutAndGet.log.
Understanding the Configuration
The sample project has default values for the file names. You can change the defaults, if needed
for your environment.
1. Under Module Descriptors, click the configuration file.
2. Modify BW_ftp_put_file to point to the input file.
3. Modify BW_ftp_get_file to point to the output file that will be written to on disk.
Using HTTP to Send and Receive Dynamic Headers
A request is sent to the server by the client. The server accepts the request and the HTTP connection is
then closed by the response activity. Dynamic headers are added on both the client request and server's
response.
The server process listens for requests and sends a response from the server.
The client process sends a request to the server.
Procedure
1. In the samples directory, select palette > http > DynamicHeaders and double-click
tibco.bw.sample.palette.http.DynamicHeaders. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.DynamicHeaders project.
TIBCO ActiveMatrix BusinessWorks™ Samples
85
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click DynamicHeadersClientProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.http.DynamicHeaders.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
A DynamicHeaders.log file is created at c:\tmp\DynamicHeaders with the following output:
Headers Received at the Server Side are:
arraydata: 1
arraydata: 2
arraydata: 3
content-type1: found_ContentType1_firstTime
content-type1: found_ContentType1_SecondTime
Accept-Charset: iso-8859-1,*,utf-8
Content-Type: text/plain
Headers Received at the Client Side are:
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 12
connection: close
company: TIBCO India Pvt Ltd
company: TIBCO Inc, USA
server: Jetty(8.1.13.v20130916)
testing-mydata: Done Setting data
testing-mydata: Done Setting Dynamic Value
TIBCO ActiveMatrix BusinessWorks™ Samples
86
Understanding the Configuration
The ListeningHTTPConnection and the RequestingHTTPConnection is defined to listen on
port 13009. To change the port, specify a new Port value in the Module Properties dialog. You
can also change the default location of the OUTPUT_FILE file, by specifying it in the Module
Properties dialog.
The Incoming HTTP Request process starter listens on the connection specified by the
ListeningHTTPConnection shared resource.
In the DynamicHeadersClientProcess, the ArrayData element in the Input Editor of the Send
HTTP Request activity has Cardinality defined as Repeating. The dynamic header value for
the same is provided from the Input tab under the DynamicHeaders element. The dynamic
headers Content-Type1 and Content-Type are defined under the same.
In DynamicHeadersServerProcess, the Testing-MyData element in the Input Editor of the
Send HTTP Response activity has Cardinality defined as Repeating. The dynamic header
value for the same is provided from the Input tab under the DynamicHeaders element. The
dynamic headers StatusLine and Company are defined under the same.
The Send HTTP Request activity sends the request to the server. The HTTP Receiver activity
accepts the request. The Send HTTP Response activity closes the HTTP connection that has
been established by the Incoming HTTP Request process starter.
HTTP Sending and Receiving MIMEAttachments
This sample shows how the HTTP Receiver, HTTP Response, and HTTP Request activities can be used
to send MIME attachments over HTTP.
The sample proceeds as follows:
●
The Client process sends a HTTP Request with three attachments.
●
The Server process responds with a HTTP Response with two attachments.
Prerequisites
Copy the TIBCO_HOME\bw\n.n\samples\palette\http\MIMEAttachment\attachment1.gif file to
the c:\tmp folder on Windows or the /tmp folder on UNIX.
Procedure
1. In the samples directory, select palette > http > MIMEAttachment and double-click
tibco.bw.sample.palette.http.MIMEAttachment. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.MIMEAttachment project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Client.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.http.MIMEAttachment.application.
8. Click Debug.
This will run the sample in the Debug mode.
TIBCO ActiveMatrix BusinessWorks™ Samples
87
9. Click the Terminate
icon to stop the process.
Result
The mimeattachment.log output file at C:\tmp\MIMEAttachment should have the following content:
[Server] Received attachment of content-type: image/gif
[Server] Received attachment of content-type: text/plain
[Server] Received attachment of content-type: image/gif
Reply sent with attachment
[Client] Received attachment of content-type=: text/plain
[Client] Received attachment of content-type=: image/gif
Also, the large_files folder at C:\tmp\MIMEAttachment\download should have four files generated
with the attachment content received from the client side.
Understanding the Configuration
The Client Process sends a HTTP Request with following three attachments:
●
textContent
●
binaryContent
●
fileName
The Server Process responds with a HTTP Response with following two attachments:
●
textContent
●
binaryContent
Using HTTP or SOAP to Get Information from MySQL
Several processes are defined that show how to get information from MySQL and Sakila, which is a
sample database (included with MySQL) that has default schemas and tables.
Prerequisites
Ensure to install JDBC Drivers for Design time and Run time.
Refer to Bindings and Palettes Reference for details on JDBC Connection under Shared Resources.
Procedure
1. In the samples directory, select palette > http > MultiEndpointApp and double-click
tibco.bw.sample.palette.http.MultiEndpointApp. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.MultiEndpointApp project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Resources directory and then double-click
HTTPConnectorResource.httpConnResource. Verify that the Host and Port values are correct.
5. Double-click JDBCConnectionResource.jdbcResource and verify the database connection
properties. Click the Test Connection button to verify your database configuration.
TIBCO ActiveMatrix BusinessWorks™ Samples
88
6. Fully expand the Processes directory and double-click ActorService.bwp, FilmService.bwp, or
SakilaService.bwp.
7. Click Run > Debug Configurations.
8. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
9. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.palette.http.MultiEndpointApp.application.
10. Click Debug.
This will run the sample in Debug mode.
11.
By complying to the instructions mentioned above, you can run the client and server only
in TIBCO ActiveMatrix BusinessWorks 6.x.
To run TIBCO ActiveMatrix BusinessWorks 5.x client do the following:
a) Unzip, open, and run bw5/tibco.bw.sample.palette.http.MultiEndpointApp.bw5_client
in the TIBCO Designer.
b) Click the Tester tab and then click the green button. Select the check box next to the process and
Select All > Load & Start Current.
12. Click the Terminate
icon to stop the process.
Result
The expected outcome for the file identified in the OUTPUT_FILE property is:
Actor Name: CUBA OLIVIER
Film Title: ALIEN CENTERDescription: A Brilliant Drama of a Cat And a Mad Scientist
who must Battle a Feminist in A MySQL Convention CUBA OLIVIER
TIBCO ActiveMatrix BusinessWorks™ Samples
89
Understanding the Configuration
Three processes are defined:
●
ActorService Process: contains the HTTP Receiver requests the input query to retrieve actor
information using JDBC Query Activity. The response is provided back to HTTP Response
activity.
●
FilmService Process: this process has logic similar to the ActorServer process to fetch film
information using the JDBC Query activity.
●
SakilaService Process: returns the actor information using the SOAP service, which invokes
a JDBC Query and returns the result.
There are corresponding clients for sending HTTP requests and invoking the SOAP service
created in ActiveMatrix BusinessWorks 5.x and ActiveMatrix BusinessWorks 6.x.
The ActiveMatrix BusinessWorks 5.x clients demonstrate interoperability between
ActiveMatrix BusinessWorks 5.x and ActiveMatrix BusinessWorks 6.x.
1. Extract the ActiveMatrix BusinessWorks 5.x project
tibco.bw.palette.http.MultiEndpointApp.bw5client.zip
project in TIBCO Designer.
into a folder and open the
2. Update the Shared Resource configurations for JDBC and HTTP:
●
JDBC: Verify the database connection properties and then click the Test Connection
button to verify your database configuration.
●
HTTP: Verify the Host name and Port.
3. If you change the HTTPConnector.httpConnResource Host name or Port in the
ActiveMatrix BusinessWorks 6.x project, then update the same in the ActiveMatrix
BusinessWorks 5.x client activities (Send HTTP Request and SOAP Request Reply)
configuration.
4. If you have made any change in WSDL operations or schema used in WSDL, you must
regenerate the concrete WSDL for the Sakila service and then import the WSDL in the
ActiveMatrix BusinessWorks 5.x client project SOAP Request Reply activity.
5. You can run the client to invoke the endpoints exposed in the ActiveMatrix BusinessWorks
6.x project in the following three ways:
●
●
Use ActiveMatrix BusinessWorks 5.x to trigger the jobs.
Use localhost:13001/actor/getActor/? id=15 and localhost:13001/film/
to send HTTP requests from your browser for the ActorService and
FilmService processes respectively. To send SOAP requests use the generated concrete
WSDL in ActiveMatrix BusinessWorks 6.x project in a third party SOAP client such as
SOAPUI.
getFilm/?id=15,
●
Run the ActiveMatrix BusinessWorks 6.x project as it has the designed Client process.
Using the HTTP Persistent Connection Feature
The PersistentConnectionClientProcess sends five simultaneous HTTP requests. Each
SendHttpRequest activity in the PersistentConnectionClientProcess is configured with a
TIBCO ActiveMatrix BusinessWorks™ Samples
90
ClientPCMConnection shared resource. The HttpReceiver in ServerProcess listens on connection
specified by ServerConnection shared resource.
Procedure
1. In the samples directory, select palette > http > PersistentConnection and double-click
tibco.bw.sample.palette.http.PersistentConnection. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.PersistentConnection project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click PersistentConnectionClientProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.http.PersistentConnection.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The PersistentConnection.log file is created at C:\tmp\PersistentConnection location. The file
content is similar to the following:
Response received for Request2 at Wed, 11 Jun 2014 20:56:06 GMT
Response received for Request1 at Wed, 11 Jun 2014 20:56:06 GMT
Response received for Request4 at Wed, 11 Jun 2014 20:56:16 GMT
Response received for Request3 at Wed, 11 Jun 2014 20:56:16 GMT
Response received for Request3 at Wed, 11 Jun 2014 20:56:26 GMT
Sending a Request and Getting a Response from a Web Site
Using the HTTP palette activities you can configure requests to a web server and manage the response.
Prerequisites
Your computer must be connected to the Internet.
TIBCO ActiveMatrix BusinessWorks™ Samples
91
Procedure
1. In the samples directory in the File Explorer view, expand palette > http > RequestResponse and
double-click tibco.bw.sample.palette.http.RequestResponse. See Accessing Samples for more
Information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.RequestResponse to expand it in the
Project Explorer.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Expand the tibco.bw.sample.palette.http.RequestResponse folder.
5. Fully expand the Processes directory and double-click HTTP.Request.Response.Example.bwp to
open it in the Process Editor pane.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.http.RequestResponse.Application.
9. Click Debug.
This will run the sample in Debug mode.
10. Open the request_news.html file found in File Explorer undersamples\palette\http
\RequestResponse.
11. Click the Get News from Google! button to request headlines from the associated web page.
12. Click the Terminate
icon to stop the process.
The Google News web page displays in your default browser. The Response
successfully!! message will print in the TIBCO Business Studio™ console.
sent
TIBCO ActiveMatrix BusinessWorks™ Samples
92
Understanding the Configuration
The Incoming HTTP Request process starter listens on the connection specified in
The request_news.html file contains a form
and clicking the Get News from Google! button sends the corresponding text string (Google)
to the Incoming HTTP Request activity.
ListeningHTTPConnection.httpConnResource.
The conditional transition routes the request to the Send HTTP Request activity, which sends
the request to the host using ListeningHTTPConnection. Finally, when the response comes
from the remote site, the Send HTTP Response activity closes the HTTP Connection
established by the Incoming HTTP Request process starter.
An internet connection is required for the sample to connect to Google News. The
ListeningHTTPConnection listens on port 13008. Change the LISTENING_PORT value in the
Module Properties dialog. You must also change the Port defined in the request_news.html
file to the same value.
Sending a Secured Request and Getting a Secured Response From a Web
Site
A secured HTTP request is sent to a web server. Mutual authentication takes place between the web
server and client. After the authentication is successful, the web server sends valid response to the
client completing the handshake.
Prerequisites
Your computer must be connected to the Internet.
Copy the certificates to the c:/tmp folder on Windows and /tmp folder on Unix by unzipping the JKS
folder packaged with the sample.
Procedure
1. In the samples directory, select palette > http > SecuredRequestResponse and double-click
tibco.bw.sample.palette.http.SecuredRequestResponse. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.palette.http.SecuredRequestResponse project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click ClientRequest.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.http.SecuredRequestResponse.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
A SecuredRequestResponse.log file is created at C:\tmp\SecuredRequestResponse directory unless
you have changed its location in the Module Properties dialog. The following is the expected output:
Response received from BW HTTPS Server!!!
TIBCO ActiveMatrix BusinessWorks™ Samples
93
Understanding the Configuration
The HttpClientResource and the HttpConnectorResource is defined to listen on port 13003. To
change the port, specify a new Port value in the Module Property dialog. If you want to change
the default location of the OUTPUT_FILE, KEYSTORE_URL_CLIENT,
KEYSTORE_URL_SERVER and HOST, specify it in the Module Property dialog.
The HTTP Receiver process starter listens on the connection specified by the
HTTPConnectorResource shared resource. Verify the path of the client and server certificates
defined in the Module Properties dialog.
For the SSLClientResource and the SSLServerResource make sure you have provided correct
entries for all the fields as shown in the following image.
The secured HTTP request is sent to the server. Mutual authentication happens between the
Server and Client. After a successful authentication, the Server sends a valid response to Client,
completing the handshake.
TIBCO ActiveMatrix BusinessWorks™ Samples
94
Invoking Custom Code to Complete a Purchase Order
The Java Invoke activity can be used to write custom code to get information from a legacy system,
retrieve binary data, and so on.
Assume, for example, information from an ERP system is sent to a business partner using a B2B XML
protocol such as CXML or RosettaNet. If some fields required by the protocol are not available from the
ERP system, the missing information can be retrieved using the Java Invoke activity. The activity can
access, for example, a CSV file. You can then combine the information coming from the ERP system and
the CSV file and send it to the business partner.
If you are accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.
Procedure
1. In the samples directory, select palette > java > InvokeCode and double-click
tibco.bw.sample.palette.java.InvokeCode. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.java.InvokeCode project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click JavaProcess.bwp.
TIBCO ActiveMatrix BusinessWorks™ Samples
95
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button. Select the check box next to
tibco.bw.sample.palette.java.InvokeCode.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The process combines the purchase order information in the PO.xml file and customer information in
csvFile.log file present in BW_HOME\samples\palette\java\InvokeCode folder and writes it to the
C:\tmp\InvokeCode\CompletePo.xml file.
Understanding the Configuration
The sample uses the Read File activity to read and parse an XML file into an XML tree. The
Java Invoke activity gets customer information from the csvFile.log file and makes it
available to the process. A Map activity combines the Read File and Java Invoke output to
build a complete schema, which contains the purchase order and customer information. The
combined information is passed to the RenderPOXML activity that converts the information to
XML string, using the specified schema. The process then publishes the XML string by writing
it to the CompletePo.xml file in C:\tmp\InvokeCode.
The example requires the following schema files:
●
PurchaseOrderSchema used by ParsePO XML, which parses the PO.
●
CustomerSchema referenced by CompletePO, which contains customer information.
●
CompletePO used by Render PO XML and has information on both the purchase order and
the customer. CompletePO is a combination of PurchaseOrderSchema and
CustomerSchema.
To view the Java source, fully expand the src directory and double-click
JavaProcessJavaCode.java.
Troubleshooting
If any problem markers are visible in the project, close and re-open the project or import the
project in a clean new workspace.
Using Java Activities to Publish Information
Using several Java activities, you can invoke a method on a Java object and translate the resulting data
into an XML document. The data can then be made available to other activities.
Procedure
1. In the samples directory of the File Explorer view, expand palette > java > InvokeMethod and
double-click tibco.bw.sample.palette.java.InvokeMethod to expand it in the Project Explorer. See
Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.java.InvokeMethod project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
TIBCO ActiveMatrix BusinessWorks™ Samples
96
4. Fully expand the Processes directory and double-click PublishAllBalances.bwp to open it in the
Process Editor pane.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.java.InvokeMethod.Application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate icon to stop the process.
A log is displayed in the Console view.
Result
Three log files are created in c:\tmp\InvokeMethod:
●
for the PublishAllBalances process: has customer account information,
such as customerLastName, accountId, and checkingBalance.
●
PublishBalance.log for the PublishBalance process: has customer account details, such as
checking and savings balances.
●
PublishJavaInfo.log
PublishAllBalances.log
for the PublishJavaInfo process: has system information such as,
javaHome, javaVersion, and javaVendor.
TIBCO ActiveMatrix BusinessWorks™ Samples
97
Understanding the Configuration
The following three Java activities are used in this sample.
●
The Java Invoke activity invokes a method on a Java object.
●
The Java To XML activity translates data from a Java object into an XML document that can
be later used in other activities.
●
The XML To Java activity supplies data to an XML schema to construct an instance of the
desired Java object.
The source code for the Java objects, LocalBank, Account, Balance, and SystemProperties is in
the src directory in the project.
This project has the following three processes:
●
PublishBalance
●
PublishAllBalances
●
PublishJavaInfo
The PublishBalance process executes as follows:
1. The CreateLocalBank activity is a Java Invoke activity that constructs an instance of the
LocalBank object. This object contains the getBalance(...) method that the process later
invokes to retrieve the balance.
2. The CreateAccount activity is an XML To Java activity that creates an instance of the
Account object and sets the object's data using an XML schema.
3. The getBalance activity is a Java Invoke activity that invokes the getBalance(...) method on
the LocalBank object created by the CreateLocalBank activity. The Account object created
by the CreateAccount activity is also passed as a parameter to the getBalance(...) method.
The method returns an instance of the Balance object that contains the balances for the
specified account.
4. If the getBalance activity returns an exception, the error is published by the
PublishException (if the exception is InvalidAccount) or PublishError activity (in the event
of any other exceptions).
5. If the getBalance activity executes without any exception, the Balance activity is a Java To
XML activity that takes the Balance object produced by the getBalance activity and converts
the object's data to an XML document.
6. The PublishBalance activity takes the data produced by the Balance activity and publishes
the account and balance information by writing it to a file in a tmp directory.
The PublishAllBalances process executes as follows:
1. The getAllBalance activity is a Java Invoke activity that constructs an instance of the
LocalBank object and invokes the getAllBalance() method on that object. The output of the
method is an instance of the java.util.ArrayList class that contains a collection of all
balances.
2. The CollectionToArray activity invokes the toArray method of java.util.ArrayList to
convert the collection to an array of objects.
3. The group then iterates over each object in the array. The Balance activity takes the current
object in the array and converts its data to an XML document. The PublishBalance activity
publishes the data from the output of the Balance activity.
The PublishJavaInfo process allows a Java To XML activity to make the well-known Java
system properties available as well as the host name and address. This process executes as
follows:
TIBCO ActiveMatrix BusinessWorks™ Samples
98
1. The SystemProperties activity is a Java To XML activity that constructs an instance of the
SystemProperties object and provides the data in the class as an XML schema.
2. The PublishJavaInfo activity uses the data produced by the SystemProperties activity and
publishes the Java information by writing it toa file in a tmp directory.
The filenames used in this sample are specified in the Module Descriptors > Module
Properties.
Troubleshooting
●
If the Output tab of Java To XML activity is not populated, then press the Reload button
next to the Class Name in Java To XML activity.
●
If any problem markers are visible in the project, close and re-open the project or import the
project in a clean new workspace.
Using Java Invoke that Makes a REST call to Search Twitter
In this sample, Java Invoke makes a REST call to Twitter to search for a specified term. The application
module contains the user-written code, user jars, and processes. There is no dependency on a Shared
Module.
Prerequisites
1. Create new app on - https://apps.twitter.com/ and generate Access Token, Access Token Secret,
Consumer Key, Consumer Secret for the app created and use it in the parameters for SearchTwitter
Activity.
2. To create a token:
a.
Login to https://apps.twitter.com/ with your Twitter account.
b.
Click Create New App.
c.
Provide Name and Description and create your Twitter application. Your application is
successfully created.
d.
Go to API Keys Tab and click Create my access token. Your application access token is
successfully generated.
e.
Click Test OAuth. You should see the OAuth Settings page which has the following tokens
generated - Consumer key, Consumer secret, Access token, Access token secret.
Procedure
1. Browse the samples directory in File Explorer and select palette > java > RESTInvokeToTwitter.
Double-click tibco.bw.sample.palette.java.RESTInvokeToTwitter to import the sample to your
workspace. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.java.RESTInvokeToTwitter project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click RESTInvokeToTwitter.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
TIBCO ActiveMatrix BusinessWorks™ Samples
99
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.java.RESTInvokeToTwitter.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
A Search_Output.log is generated in C:\tmp\RESTInvokeToTwitter folder as per the value specified
in the Module Property.
This file contains a collection of relevant Tweets matching a specified query. In this case, it is "Lady
Gaga".
TIBCO ActiveMatrix BusinessWorks™ Samples
100
Understanding the Configuration
The project contains the following process:
RESTInvokeToTwitter Process: This process has two Java Invoke activities:
OpenTwitterConnection and SearchTwitter. The source code for these activities is located
under src directory under com.example.TwitterConnection package in the same project.
OpenTwitterConnection activity creates a TwitterConnection object which is then passed to
SearchTwitter activity.
SearchTwitter activity requires the following 5 input parameters:
●
SearchString
●
AccessToken
●
AccessTokenSecret
●
ConsumerKey
●
ConsumerSecret
SearchString is the string for which user wants to search tweets. In this project the
SearchString is "Lady Gaga".
AccessToken, AccessTokenSecret, ConsumerKey,
and ConsumerSecret are required for
authentication to the Twitter Account. The steps to generate these is mentioned in the
Prerequisite section.
The Java invoke uses Twitter API v1.1 which requires this request to be authenticated using
OAuth.
Troubleshooting
If you receive an error message such as:
401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or
incorrect. Ensure that you have set valid consumer key/secret, access token/
secret, and the system clock is in sync.
Then, ensure that you have generated Access Token, Access Token Secret, Consumer Key, and
Consumer Secret as per the steps specified in Prerequisites section.
TIBCO ActiveMatrix BusinessWorks™ Samples
101
Using a Custom Process Starter in a Project That Gets Information about a
Checking Account
Java Event Source allows you to create a custom process starter written in Java.
Prerequisites
Copy the AccountInformation.txt file from TIBCO_HOME\bw\n.n\samples\palette\java
\JavaEventSource to c:\tmp directory on Windows and /tmp on UNIX.
Procedure
1. In the samples directory, select palette > java > JavaEventSource and double-click
tibco.bw.sample.palette.java.JavaEventSource. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.java.JavaEventSource project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click PublishAllBalances.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.java.JavaEventSource.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The process writes the customer last name, account ID, and checking balance to the
file at c:\tmp\JavaEventSource.
PublishEvnSourceBalance.log
Understanding the Configuration
This sample uses the Java objects such as, LocalBank, Account, Balance, and SystemProperties.
The source for these objects is in the src directory.
The process executes as follows:
1. The Java Event Source activity reads balances from the AccountInformation.txt and
outputs an instance of the java.util.LinkedList class that contains a collection of all
balances.
2. The CollectionToArray activity invokes the java.util.LinkedListtoArray method to convert
the collection to an array of objects.
3. The group then iterates over each object in the array.
4. The Balance activity takes the current object in the array and converts its data to an XML
document.
5. The PublishBalance activity publishes the data from the output of the Balance activity.
TIBCO ActiveMatrix BusinessWorks™ Samples
102
Troubleshooting
●
If the Output tab of Java To XML activity is not populated, then press the Reload button
next to the Class Name in Java To XML activity.
●
If any problem markers are visible in the project, close and re-open the project or import the
project in a clean new workspace.
Using JDBC Query - Process in Subsets and JDBC Update - Batch Updates
This sample shows how to use the Advanced tab options of JDBC Query and JDBC Update activities.
Prerequisites
Install the PostgreSQL Database:
1. Download and install PostgreSQL from http://www.postgresql.org/download/.
2. Go to SQL Shell (psql) from the installed program.
3. The PostgreSQL command line window starts.
Run createTestTables.sql on the PostgreSQL database to create test tables. The script is located in
the samples directory under the path TIBCO_HOME\bw\n.n\sample\palette\jdbc\Advanced
Procedure
1. In the samples directory, select palette > jdbc > Advanced and double-click
tibco.bw.sample.palette.jdbc.Advanced. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jdbc.Advanced project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand Module Descriptors under tibco.bw.sample.palette.jdbc.Advanced and double-click
Module Properties. The JDBC properties defined for the application are defined in the dialog.
Provide a valid username, password, and database URL to connect to your PostgreSQL database.
5. Update the values under Module properties and save your project.
The values in Advanded.application properties are updated and the connection to the database
will be successful.
6. Verify your JDBC connection.
TIBCO ActiveMatrix BusinessWorks™ Samples
103
a)
b)
c)
d)
e)
Fully expand the Resources directory.
Double-click JDBCConnection_PostgreSQL.jdbcResource.
In JDBC Driver, click Click here to set preferences.
Set the JDBC driver folder directory preference and click Apply. Click OK.
Click the Test Connection button to verify the connection.
7. Click File > Save to save the project.
8. Fully expand the Processes directory and double-click ProcessInSubsets.bwp and
BatchUpdates.bwp.
9. Click Run > Debug Configurations.
10. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
11. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jdbc.Advanced.application.
12. Click Debug.
This will run the sample in Debug mode.
13. Click the Terminate
icon to stop the process.
Result
For the ProcessInSubsets.bwp process, the processInSubsets.log output file at c:\tmp
\JDBC_Advanced shows all the records retrieved from the SRC_ORDER_TABLE table.
For the BatchUpdates.bwp process, the batchUpdates.log output file at c:\tmp\JDBC_Advanced
shows the number of updates and all records retrieved from the DEST_ORDER_TABLE table.
TIBCO ActiveMatrix BusinessWorks™ Samples
104
Understanding the Configuration
This sample shows:
●
JDBC Query - Process in Subsets: This activity allows users to process the result set in
smaller subsets, rather than processing the entire result set at once. It uses the
ProcessInSubsets process.
●
JDBC Update - Batch Updates: This activity is configured to perform multiple statements in
one batch. It uses the BatchUpdates process.
The ProcessInSubsets process is configured to process query in subsets.
The BatchUpdates process is configured to perform multiple insert statements in one batch.
ProcessInSubsets executes as follows:
●
QuerySrcOrderTab is a JDBC Query activity configured to retrieve subsets of the result set
of SRC_ORDER_TABLE table
●
Check the Process In Subsets field on the Advanced tab.
●
Set the subsetSize input item to the number of records you want to process for each
execution. In this sample, it is set as a module property named SUBSET_SIZE.
●
For the ProcessSubset 'For Each' group processes, each subset writes its records to an output
file, a module property named PROCESS_IN_SUBSETS_OUTPUT_FILE.
To retrieve subsets of the result set, you must use a Repeat group to iterate until the entire
result set is processed. For this, both QuerySrcOrderTab and ProcessSubsets are grouped into
processInSubsets Repeat group with the exit condition: $QuerySrcOrderTab/lastSubset =
true().
BatchUpdates executes as follows:
TIBCO ActiveMatrix BusinessWorks™ Samples
105
●
QuerySrcOrderTab is a JDBC Query activity to retrieve the entire result set of
SRC_ORDER_TABLE table in one batch.
●
The DeleteRecordsIfAlreadyExists activity deletes the records that are already in the
database.
●
BatchUpdates is a JDBC Update activity configured to perform multiple insertions in one
batch. It inserts all the records of the SRC_ORDER_TABLE table to the
DEST_ORDER_TABLE table.
—
Check the Batch Update field on the Advanced tab.
—
Map the $QuerySrcOrderTab/Record to the Record input repeating element.
●
Write $BatchUpdates/noOfUpdates to an output file, a module property named
BATCH_UPDATES_OUTPUT_FILE.
●
QueryDestOrderTab retrieves the entire result set of DEST_ORDER_TABLE table at once.
●
ProcessResultSet 'For Each' group processes the result set to write its records to the same
output file, a module property named BATCH_UPDATES_OUTPUT_FILE.
Setting Up a JDBC Connection to Query and Update Tables
After setting up a JDBC connection, a process executes the SELECT and UPDATE queries.
Prerequisites
Install the PostgreSQL database:
1. Download and install PostgreSQL from http://www.postgresql.org/download/.
2. Go to SQL Shell (psql) from the installed program.
3. The PostgreSQL command line window starts.
Run JDBC.sql on the PostgreSQL database to create test tables. The script is located in the samples
directory under the path TIBCO_HOME\bw\n.n\samples\palette\jdbc\Basic.
Procedure
1. In the samples directory, select palette > jdbc > Basic and double-click
tibco.bw.sample.palette.jdbc.Basic. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jdbc.Basic project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand Module Descriptors under tibco.bw.sample.palette.jdbc.Basic and double-click
Module Properties. The JDBC properties defined for the application are defined in the dialog.
Provide a valid username, password, and database URL to connect to your PostgreSQL database.
TIBCO ActiveMatrix BusinessWorks™ Samples
106
5. Fully expand the Processes directory and double-click JDBC_TEST.bwp.
6. Verify your JDBC connection.
a) Fully expand the Resources directory.
b) Double-click JDBCConnection_PostgreSQL.jdbcResource.
c) In JDBC Driver, click Click Here to Set Preferences.
d) Set the JDBC driver folder directory preference and click Apply. Click OK.
e) Click the Test Connection button to verify the connection.
7. Click File > Save to save the project.
8. Click Run > Debug Configurations.
9. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
10. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jdbc.Basic.application.
11. Click Debug.
This will run the sample in Debug mode.
12. Click the Terminate
icon to stop the process.
TIBCO ActiveMatrix BusinessWorks™ Samples
107
Result
●
The order_description record in the sub_order table is updated to TESTING
JDBC CONNECTION.
●
The JDBC_Basic.log output file at C:\tmp\JDBC_Basic shows that one record was written.
Understanding the Configuration
The JDBC_TEST.bwp process uses the JDBC Connection in the Resources folder to establish a
connection to the database and execute SELECT and UPDATE queries. First it queries the table
for a specific record using the JDBC_Query activity and then it updates another table using the
JDBC_Update activity. Finally it updates a file indicating the number of records written.
Both activities use prepared parameters as input. This shows the ability to execute the same
statement with multiple values by caching the statement at runtime.
Using Oracle Objects and Collections in JDBC Call Procedure and JDBC
Query Activities
The JDBC Call Procedure activity calls a database procedure. The JDBC Query activity performs the
specified SQL SELECT statement.
This sample has the following processes:
●
The CreateCustomer and SelectCustomer processes show how to use Oracle Objects.
●
The CreateCustomerMultiAddress and SelectCustomerMultiAddress processes show how to use
Oracle Collections.
Prerequisites
●
You must have credentials that allow you to run scripts against your Oracle database.
●
Run the jdbc_object_collection.sql file against your Oracle database to create the test objects.
The file is located in the samples directory under the path TIBCO_HOME\bw\n.n\samples\palette
\jdbc\Collection.
●
Ensure to install Drivers for Design time and Run time.
For detailed information about installing Drivers, refer to JDBC Connection section of
Shared Resources in Bindings and Palettes Reference.
Procedure
1. In the samples directory, select palette > jdbc > Collection and double-click
tibco.bw.sample.palette.jdbc.Collection. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jdbc.Collection project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand tibco.bw.sample.palette.jdbc.Collection.application and double-click Properties.
The JDBC properties defined for the application are shown next. Provide a valid username,
password, and database URL to connect to the Oracle database in your environment.
TIBCO ActiveMatrix BusinessWorks™ Samples
108
5. Verify your JDBC connection:
a) Fully expand the Resources directory.
b) Double-click OracleConnection-OracleThinDriver.jdbcResource.
c) In JDBC Driver click, Click Here to Set Preferences.
d) Set the JDBC driver folder directory preference and click Apply. Click OK.
e) Click the Test Connection button to verify the connection.
6. Click File > Save to save the project.
7. Click Run > Debug Configurations.
8. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
9. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jdbc.Collection.application.
10. Click Debug.
This will run the sample in Debug mode.
11. Click the Terminate
icon to stop the process.
Result
●
On successful completion, the CreateCustomer and CreateCustomerMultiAddress processes insert
a row each in the database.
●
On successful completion, the SelectCustomer and SelectCustomerMultiAddress processes display
the data that was inserted by each process in the Output tab.
●
The JDBC_Collection.log output file at C:\tmp\JDBC_Collection shows the Customer details
with Single and Multiple addresses.
TIBCO ActiveMatrix BusinessWorks™ Samples
109
Understanding the Configuration
The sample consists of the following processes:
●
CreateCustomer: In this process, the JDBCCallProcedure activity
ADD_SINGLE_ADDRESS_CUSTOMER inserts a record containing Oracle Objects into the
database.
●
CreateCustomerMultiAddress: In this process, the JDBCCallProcedure activity
ADD_MULTI_ADDRESS_CUSTOMER inserts a record containing Oracle Collections into
the database.
●
SelectCustomer: In this process, the JDBCQuery activity queries the database for the record
added using the CreateCustomer process and displays the record in the Output tab.
●
SelectCustomerMultiAddress: In this process, the JDBCQuery activity queries the
database for the record added using the CreateCustomerMultiAddress process and displays
the record in the Output tab.
Setting Up and Executing JDBC Activities with Eclipse Using DTP
Using JDBC palette activities, you can setup JDBC connections and execute JDBC activities to run
queries and display the results. This sample shows how to execute SQL calls and edit data with Eclipse
DTP at Design time.
Prerequisites
Install the Sakila Sample Database.
●
Download and install the Sakila sample database from http://dev.mysql.com/doc/index-other.html.
●
Installation information is available from http://dev.mysql.com/doc/sakila/en/sakilainstallation.html.
●
Ensure to install Drivers for Design time and Run time.
For detailed information about installing Drivers, refer to JDBC Connection section of Shared
Resources in Bindings and Palettes Reference.
Procedure
1. In the samples directory, select palette > jdbc > EclipseDTPIntegration and double-click
tibco.bw.sample.palette.jdbc.EclipseDTPIntegration. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.palette.jdbc.EclipseDTPIntegration project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your JDBC connection.
a) Fully expand the Resources directory.
b) Double-click JDBCConnectionResource.jdbcResource.
c) In JDBC Driver, click Click here to set preferences.
d) Set the JDBC driver folder directory preference and click Apply. Click OK.
e) Click the Test Connection button to verify the connection.
TIBCO ActiveMatrix BusinessWorks™ Samples
110
5. Fully expand the Processes directory and double-click EclipseDTP.bwp.
6. In the Process Editor, click JDBCQuery and then click Properties > Statement tab.
7. Click SQL. This launches the SQL Query Builder. In SQL Query Builder, update or edit the
statement, execute it, and view the result.
a) Modify the statement by removing "where title=?" and click Execute the query to execute the
statement at Design time by using DTP.
In the SQL Results tab, the history for all operations displays at the left and Status, Result, and
Parameters display at the right.
b) Click the Data Source Explorer tab to view the connected database,
BWProfiletibco.bw.palette.jdbc.eclipsedtpintegration.JDBCConnectionResource. Right-click
on the table and select Data > Edit to edit the data.
TIBCO ActiveMatrix BusinessWorks™ Samples
111
c) Open the scrapbook to edit and run the SQL statements by clicking the icon available in the Data
Source Explorer view.
d) The entry for any SQL for default tables is available in the Sakila schema. Right-click and select
Execute All. You will see the results in the SQL Results view.
TIBCO ActiveMatrix BusinessWorks™ Samples
112
e) Double-click JDBCQuery. Click Statement in the Properties tab. Modify the statement by
adding "where title=?" at the end in statement.
8. Click File > Save to save the project.
9. Click Run > Debug Configurations.
10. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
11. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jdbc.EclipseDTPIntegration.application.
12. Click Debug.
This will run the sample in Debug mode.
13. Click the Terminate
icon to stop the process.
Result
The console log will contain messages similar to: INFO
c.t.b.p.g.L.t.b.s.p.j.E.Log -
FILM_ID-10001: Inventory of film id [17] in store id = [1] is 2.
Understanding the Configuration
The EclipseDTP.bwp process uses the JDBC Connection in the Resources folder to establish a
connection to the database and executes SELECT and STORED PROCEDURE queries.
It queries the table for a specific record using the JDBC Query activity and then returns the
available copies of a specified film in stock using the JDBC Call Procedure activity.
Finally it displays a number of records with MessageID in console.
Both activities use prepared parameters as Input. This shows the ability to execute the same
statement with multiple values by caching the statement at runtime.
Sending and Getting JMS Messages
A process can send JMS messages and get JMS messages from a queue in a loop.
TIBCO ActiveMatrix BusinessWorks™ Samples
113
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > GetQueueMessage and double-click
tibco.bw.sample.palette.jms.GetQueueMessage. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.GetQueueMessage project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click GetQueueMessage.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.GetQueueMessage.application.
9. Click Debug.
This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
Result
The Console displays messages similar to the following:
16:08:26.242 [PVM:In-Memory STWorkProcessor:1] INFO c.t.b.p.g.L.t.b.p.j.G.Log Message=Sending 5 Queue Messages
16:08:26.292 [PVM:In-Memory STWorkProcessor:1] INFO c.t.b.p.g.L.t.b.p.j.G.Log1 Message=Finished sending 5 Queue messages. Getting 5 Queue messages...
16:08:26.303 [PVM:In-Memory STWorkProcessor:3] INFO c.t.b.p.g.L.t.b.p.j.G.Log2 Message=Received message number 1. Message = This is message number 1
16:08:26.307 [PVM:In-Memory STWorkProcessor:5] INFO c.t.b.p.g.L.t.b.p.j.G.Log2 Message=Received message number 2. Message = This is message number 2
16:08:26.311 [PVM:In-Memory STWorkProcessor:1] INFO c.t.b.p.g.L.t.b.p.j.G.Log2 Message=Received message number 3. Message = This is message number 3
16:08:26.315 [PVM:In-Memory STWorkProcessor:3] INFO c.t.b.p.g.L.t.b.p.j.G.Log2 Message=Received message number 4. Message = This is message number 4
16:08:26.318 [PVM:In-Memory STWorkProcessor:5] INFO c.t.b.p.g.L.t.b.p.j.G.Log2 Message=Received message number 5. Message = This is message number 5
The GetQueueMessage.log output file at C:\tmp\GetQueueMessage shows the following information
of sending five Queue messages and getting five messages.
Sending 5 Queue Messages
Finished sending 5 Queue messages. Getting 5 Queue messages...
TIBCO ActiveMatrix BusinessWorks™ Samples
114
Received message number 1. Message = This is message number 1
Received message number 2. Message = This is message number 2
Received message number 3. Message = This is message number 3
Received message number 4. Message = This is message number 4
Received message number 5. Message = This is message number 5
Understanding the Configuration
The JMS Send Message activity sends the messages with the message style set to Queue.
The Get JMS Queue Message activity receives the JMS messages from a Queue in a loop. The
activity is placed in a group and the group action is set to Repeat.
The condition loops five times and receives five messages.
Using JMS Message Selector
The JMS Send Message activity sends five queue messages and sets an application property with the
index. The Get JMS Queue Message activity selects the third message using message selector.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > MessageSelector and double-click
tibco.bw.sample.palette.jms.MessageSelector. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.MessageSelector project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click MessageSelector.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.MessageSelector.application.
9. Click Debug.
This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
Result
The Console displays a message similar to the following:
11:54:01.283 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.j.M.Log
- Sending 5 Queue Messages
TIBCO ActiveMatrix BusinessWorks™ Samples
115
11:54:01.409 INFO [bwThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.p.j.M.Log1 - Finished sending 5 Queue messages. Selecting 3rd
Message...
11:54:01.475 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.j.M.Log2 - Selected 3rd message,. Message = This is message
number 3
The MessageSelector.log output file is generated at C:\tmp\MessageSelector folder containing
following information based on the message selector.
Sending 5 Queue Messages.
Finished sending 5 Queue messages. Selecting 3rd Message...
Selected 3rd message,. Message = This is message number 3
Understanding the Configuration
The process sends five Queue messages and selects one message using the selectors. This
process definition executes as follows:
●
The JMS Send Message activity sends five messages in a loop. It also sets the index of the
loop to an application property called myselector.
●
The Get JMS Queue Message activity uses the message selector myselector='3' to pick the
third message.
Receiving a JMS Message from a Queue and Responding to the Message
The JMS Queue Receiver and Reply to JMS Message activities can be configured to receive and
respond to JMS messages.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > QueueReceiver and double-click
tibco.bw.sample.palette.jms.QueueReceiver. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.QueueReceiver project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click QueueReceiver.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.QueueReceiver.application.
TIBCO ActiveMatrix BusinessWorks™ Samples
116
9. Trigger the application by sending a request. You can use the
tibco.bw.sample.palette.jms.SenderAndSignalIn sample to send the request (see Sending a JMS
Message to a Queue and Waiting for a Response). The applications can run in the same or separate
TIBCO Business Studio instance. If you run the applications in the same instance, load the
application before clicking Debug.
10. Click Debug.
This will run the sample in Debug mode.
11. Click the Terminate
icon to stop the process.
Result
When both applications are running in the same TIBCO Business Studio instance, information similar
to the following is displayed in the console:
14:32:46.402 [bwThread:In-Memory STWorkProcessor-2] INFO c.t.b.p.g.L.t.b.s.p.j.Q.Log
- Received a Queue Message. Request = This is a test request. JMSMessageID = ID:EMSSERVER.25FC52F2890A46:6. JobId [bw0a101], ProcessInstanceId [bw0a101], Activity
[Log], Process [tibco.bw.sample.palette.jms.queuereceiver.Process], Module
[tibco.bw.sample.palette.jms.QueueReceiver:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.QueueReceiver.application:1.0].
14:32:46.419 [bwThread:In-Memory STWorkProcessor-3] INFO
c.t.b.p.g.L.t.b.s.p.j.S.Log1 - Received the response. Response = This is a test
response. JMSCorrelationID = ID:EMS-SERVER.25FC52F2890A46:6. JobId [bw0a100],
ProcessInstanceId [bw0a100], Activity [Log1], Process
[tibco.bw.sample.palette.jms.senderandsignalin.Process], Module
[tibco.bw.sample.palette.jms.SenderAndSignalIn:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.SenderAndSignalIn.application:1.0].
The QueueReceiver.log output file in C:\tmp\QueueReceiver directory shows that the message has
been received and the reply is sent.
Understanding the Configuration
The sample uses the JMS Queue Receiver activity to get messages off the queue. The Reply to
JMS Message activity responds to the incoming JMS message and automatically uses the
JMSReplyTo header to get the reply destination.
Sending a JMS Message and Receiving a Response in a Process
The JMS Request Reply activity sends a request to a JMS queue and waits for the response. After
receiving the response, the activity makes the output available.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > RequestReply and double-click
tibco.bw.sample.palette.jms.RequestReply. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.RequestReply project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
TIBCO ActiveMatrix BusinessWorks™ Samples
117
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click RequestReply.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.RequestReply.application.
9. Trigger the application by sending a request. You can use the
tibco.bw.sample.palette.jms.QueueReceiver sample to send the request (see Receiving a JMS
Message from a Queue and Responding to the Message). The applications can run in the same or
separate TIBCO Business Studio instance. If you run the applications in the same instance, load the
application before clicking Debug.
10. Click Debug.
This will run the sample in Debug mode.
11. Click the Terminate
icon to stop the process.
Result
When both applications are run in the same TIBCO Business Studio instance, information similar to the
following is displayed in the console:
14:41:00.532 [bwThread:In-Memory STWorkProcessor-2] INFO c.t.b.p.g.L.t.b.s.p.j.Q.Log
- Received a Queue Message. Request = This is a test request. JMSMessageID = ID:EMSSERVER.25FC52F2890A4F:5. JobId [bw0a101], ProcessInstanceId [bw0a101], Activity
[Log], Process [tibco.bw.sample.palette.jms.queuereceiver.Process], Module
[tibco.bw.sample.palette.jms.QueueReceiver:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.QueueReceiver.application:1.0].
14:41:00.548 [bwThread:In-Memory STWorkProcessor-3] INFO
c.t.b.p.g.L.t.b.s.p.j.R.Log1 - Received the response. Response = This is a test
response. JobId [bw0a100], ProcessInstanceId [bw0a100], Activity [Log1], Process
[tibco.bw.sample.palette.jms.requestreply.Process], Module
[tibco.bw.sample.palette.jms.RequestReply:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.RequestReply.application:1.0].
The RequestReply.log output file at C:\tmp\RequestReply shows that the message is sent to the
queue and the response is received.
Sending a JMS Message to a Queue and Waiting for a Response
After sending a JMS message, the JMSSignalIn activity gets the response and filters it as required.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > SenderAndSignalIn and double-click
tibco.bw.sample.palette.jms.SenderAndSignalIn. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.SenderAndSignalIn project.
TIBCO ActiveMatrix BusinessWorks™ Samples
118
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click QueueSenderWait.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.SenderAndSignalIn.application.
9. Trigger the application by sending a request. You can use the
tibco.bw.sample.palette.jms.QueueReceiver sample to send the request (see Receiving a JMS
Message from a Queue and Responding to the Message). The applications can run in the same or
separate TIBCO Business Studio instance. If you run the applications in the same instance, load the
application before clicking Debug.
10. Click Debug.
This will run the sample in Debug mode.
11. Click the Terminate
icon to stop the process.
Result
When running both applications in the same TIBCO Business Studio instance, the Console displays the
information similar to the following:
14:46:23.347 [bwThread:In-Memory STWorkProcessor-2] INFO c.t.b.p.g.L.t.b.s.p.j.Q.Log
- Received a Queue Message. Request = This is a test request. JMSMessageID = ID:EMSSERVER.25FC52F2890A57:6. JobId [bw0a101], ProcessInstanceId [bw0a101], Activity
[Log], Process [tibco.bw.sample.palette.jms.queuereceiver.QueueReceiver], Module
[tibco.bw.sample.palette.jms.QueueReceiver:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.QueueReceiver.application:1.0].
14:46:23.365 [bwThread:In-Memory STWorkProcessor-3] INFO
c.t.b.p.g.L.t.b.s.p.j.S.Log1 - Received the response. Response = This is a test
response. JMSCorrelationID = ID:EMS-SERVER.25FC52F2890A57:6. JobId [bw0a100],
ProcessInstanceId [bw0a100], Activity [Log1], Process
[tibco.bw.sample.palette.jms.SenderAndSignalIn.QueueSenderWait], Module
[tibco.bw.sample.palette.jms.SenderAndSignalIn:1.0.0.qualifier], Application
[tibco.bw.sample.palette.jms.SenderAndSignalIn.application:1.0].
The output.log output file at C:\tmp\SenderAndSignalIn shows that the message has been sent to
the queue and the response has been received using Signal-In activity.
TIBCO ActiveMatrix BusinessWorks™ Samples
119
Understanding the Configuration
The QueueSenderWait process sends a Queue message and listens for a response. This process
definition executes as follows:
1. The JMS Send Message activity sends a Queue message. It also sets a static reply
destination in the advanced tab. The responder will use this reply destination to reply the
message.
2. The JMS SignalIn activity uses Conversation mechanism wherein a conversation is
initiated by the Correlation Key, which is JMSMessageID sent by the JMS Queue Sender
activity. Conversation "Join" uses JMSCorrelationID to filter the correct response with the
correct job.
Sending a JMS Message and Receiving a Durable Response
The JMS Receiver Event Source activity can be configured as a Durable Subscriber. If the subscriber is
offline, the subscriber's messages are stored by the JMS server and delivered when the subscriber is
online.
Prerequisites
TIBCO Enterprise Message Service must be running.
Procedure
1. In the samples directory, select palette > jms > TopicDurableSubscriber and double-click
tibco.bw.sample.palette.jms.TopicDurableSubscriber. See Accessing Samples for more
information.
2. In Project Explorer expand the tibco.bw.sample.palette.jms.TopicDurableSubscriber project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Verify your TIBCO Enterprise Message Service connection.
a) Fully expand the Resources directory.
b) Double-click JMSConnectionResource.jmsConnResource.
c) In the Basic Configuration dialog, click the Test Connection button to verify the connection.
5. Fully expand the Processes directory and double-click TopicPublisher.bwp.
6. Click Run > Debug Configurations.
7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
8. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.jms.TopicDurableSubscriber.application.
9. Click Debug.
This will run the sample in Debug mode.
10. Click the Terminate
icon to stop the process.
Result
On Windows: The TopicDurableSubscriber.log output file at C:\tmp\TopicDurableSubscriber
shows that the message is published to a topic and a topic subscriber has received the message from the
topic.
On UNIX: /tmp/TopicDurableSubscriber
TIBCO ActiveMatrix BusinessWorks™ Samples
120
The Console displays a message similar to the following:
15:46:34.903 [PVM:In-Memory STWorkProcessor:1] INFO c.t.b.p.g.L.t.b.p.j.D.Log Message=Publishing a Topic Message, MessageId=
15:46:35.043 [PVM:In-Memory STWorkProcessor:2] INFO c.t.b.p.g.L.t.b.p.j.D.Log Message=Received a Topic Message. Message = This is a test Topic Message, MessageId=.
Understanding the Configuration
The JMS Send Message activity sends a message to the topic.sample topic. The JMS Receive
Message activity subscribes to the topic.sample topic. Additionally, the JMS Receive Message
activity is configured as durable, allowing messages to be received later if the receiver is offline.
Sending Mail Using HTML
A process sends an email formatted in HTML and includes embedded images as an attachment.
Prerequisites
You must have the account settings for your mail server.
On Windows, copy the input folder from $TIBCO_HOME\bw\n.n\samples\palette\mail
\attachment_files to C:\tmp.
On Unix, copy the input folder to /tmp.
Procedure
1. In the samples directory, select palette > mail > HtmlMailWithImage and double-click
tibco.bw.sample.palette.HtmlMailWithImage. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.HtmlMailWithImage project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click Sender.bwp.
5. Click Run > Debug Configurations.
TIBCO ActiveMatrix BusinessWorks™ Samples
121
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.HtmlMailWithImage.Application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
Your mail client receives an email showing the attachments, embedded in an HTML formatted
message.
On Windows, the output.log output file is created in the c:/tmp/HtmlMailWithImage folder.
On UNIX, the output file is created in the \tmp\HtmlMailWithImage folder.
Sending Mail Using MIME
This sample shows how to send mail with attachments using MIME format.
The MailSender process sends mail with attachments and the MailReceiver process receives the mail.
MailSender Process
MailReceiver Process
TIBCO ActiveMatrix BusinessWorks™ Samples
122
Prerequisites
You must have the account settings for your mail server.
On Windows, copy the input folder from $TIBCO_HOME\bw\n.n\samples\palette\mail
folder to C:\tmp.
\attachment_files
On UNIX, copy the input folder to /tmp.
Procedure
1. In the samples directory, select palette > mail > MIMEAttachment and double-click
tibco.bw.sample.palette.mail.MIMEAttachment. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.mail.MIMEAttachment project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click MailSender.bwp and MailReceiver.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.mail.MIMEAttachment.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The MailSender process sends the mail and the MailReceiver process receives the mail.
On Windows, the MIMEAttachment.log output file is created at c:/tmp/MIMEAttachment.
On UNIX, the output file is created at \tmp\MIMEAttachment.
The Console shows the messages similar to:
13:25:01.277 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.m.M.Log
- Sending the mail with attachment
13:25:03.984 INFO [bwThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.p.m.M.Log1 - Mail has been sent with attachment
TIBCO ActiveMatrix BusinessWorks™ Samples
123
13:25:13.471 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log
- Received Mail with subject: Test Mail With Attachment
13:25:13.476 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.m.M.Log1 - Mail Body: Hello World
13:25:13.538 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.m.M.Log2 - Attachment [1] data:
13:25:13.591 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.m.M.Log3 - Test Attachment Data
13:25:13.631 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.m.M.Log2 - Attachment [2] data:
13:25:13.656 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.m.M.Log4 - R0lGODlheQA2APcAAAAAAP///
wBtpQ8KCxALDBMODxYREhcSExoVFhAMDRMPEBQQERgUFRkVFhoWFxANDhEODxUSExYTFBcUFRkWFx0aGyAdHiMgISYjJ
Qk1NUEdHSVJSVPX1+pKSlV5eYFpaXFlZW1VVV3Z2eHJydGlpa2ZmaGVlZ5mZm5GRk4qKjIeHiYWFh4KChIGBg35+gHFx
vv7/Pr6+/n5+vb29/X19u/
v8Nzc3dHR0piYmerr9O3u9unr82tsb4GChZSVmLu8v93i7uPn8evu9ebq8ltcXmFiZHd4enR1d3N0dm5vcY2OkIiJi7q
AwszX6JianfHz9pav0L7O4qe/2XScxISoy46uzo6QkouNj4WHiYKEhpaYmkhJSq
+xs19gYXx9fnl6e2prbKeoqZmam5WWl5SVloyNjoWGh/X29/Hy8/Dx8uvs7enq6+bn6OXm5+Pk5eLj5N/
g4d7f4N3e39zd3trb3Nna29fY2dbX2NTV1tPU1dLT1M/
Q0c7P0M3Oz8rLzMjJysbHyMPExcLDxLu8vbm6u7e4uba3uLKztLCxsqusra3F3KC
+2GKXwWaawmmcw4200ZS300mLuV6XwHuqy4OwzwBjnwBfnSJ4rC58rzqGtVOTvQBnogBoogBooQBmoQBloAN
pogVqow5vpxFwpxdzqSl+sABspQBrpABqo7y+v7S2t97g4drc3cfJygBxqO/x8f7///z9/fv8/
Pj5+ff4+PT19fP09PDx8e3u7ujp6czNzfj6+fHy8QwICP7+/vv7+/Pz8+vr6////
yH5BAEAAP8ALAAAAAB5ADYAAAj/
AAMIHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnPlwmc2bNpU9avSM
XEkxIEOZgSKmbLigQMZSopkIKCCSyqB9iYdcuOm4joByJMjL1cNGTVu1x6J0yZg3LZmAlv14sX9zKYIec7s/
+KOSJZAYBR6DISF4oO58b4yOblwoErBeVgmWNgSzJ6Yd2Kc4osb/gTwhRb6CbHLPF/
gIwsVLuijAysB4OKHIIQQYpxyHG4T3TfbWOOIM9sIcB1ChySwB0LoqScQeyGUUhAxGWhg3kBaPDBCIgsd0oA
G5xwUSwkJABFGKnu84UklG3KY3DjcQBNJOdpYo4gz2GCD3UFTPHAFi+mth0IIZRT0jg8H
+DEQIA18kMtCtXywwSEJ0QKCBIAE0EsggNTSpJPIkROOItaQg42V1EizpUFdfnlQi2KSaRAnC2gYQD0ydBAI
Q1cM0EUYCoGigA5mueOORccBmpw2yEDDjQDcRP9yjKIINQqmiwHAWCZBX0RhQJ4B9MGADvMsZAoPDgSpECsh
VMAjRqmqKkA2kiAjjQDlhONINYlx6eWtke46kC4fYHCLQJw8AApDsXiwgioMCaFAcdBKi9w2xzRDnQCIQRJN
rd8+GuaLY5oy0BeJuPAAFgKR0oSzDAVxgBcNEfKAHRlFC2g21cThTDn3LtPIv946ahCkL2qggR1abCLEESnY
UIhZAZwiAwZ
+LoRGAU80FAwHuKIqLTndHPMIyMhJA40kJDMa8MkD55qCBQ4g0EADDOxHoUCruJDCKwzpocAmDfXSAMX1qqqlIt8gPY4
ooUHGkzRTgD2jGAjQ0kUgDFDiUzwQ8aqejiENdkkh801cIDTrdMmF4RyrhiUMEZBuYzgADEBHKsCLwx5okDQ
CRlTQB6QO3moGsmUmBw5ijQzzaJ0P+151LBgIEOxBRkjQRNxScGBMQzpooIIMi5kRQErpq1cOdTAwQw241j
+TByJAk9Q3VDfbTzyBMnCAghagZLAFgyhIsIF6ixEBg8RqKn9cuBQhCO8QY7kZAsO0NiGlgDWOYJ8rnjHM4g
rXBACVwTgFhr4wI0U0okBNNAg5+hAC+D1P7wgYw7UQBpysIEMOHyDHCcqGbhetD6D/MICOGCHQLZAAB
+QYiHCqIAH/
3aRkFIw4QFW0Ei0oBQNNVjjVcnJhjNecI1tWMd8A0Hf8NRXAnkUhAxdGADDBJKKHDxgE6NLiDugQAAekLAgX
+BEAVxgwdqZKBkveIbulkONODwCfFdk4AxBl4NStMMdpXhFMXago1YQ5B4jUMAR+MA
+gYCBFv0IQCow8QAbCOMdBLkFFAyggWFsZFrZ4IYzkACNwuyFG82QAzW2kRdaHQQU
+hijQYKhgMcJJBYquIAJdmACGXhgAg5gwiwMIgsmMKADN8jCJwoxBSs0gQWxCYAsgGAAB8RAD4RAQycwkIAQ
9IEj4hAHNZwhB0VUI53wpIYyAiAJasTzEQgRhAeSgP+QX9TgDgNxRQ5GAAMXuGAEOrjCL
+CBkHjwQQorUIEDJNABFXwACvUYyBg8oQMMVEACDrjACPbwRo2kYQ1zYEQ71BCHOazhpSh9wRdcCtM5IAEh
+UBHRg8yhlYUSCBhYMUqhsoKe4CKIe5oBS
+GUQxh8KIVRyWIPGxhjmIMYxenoIlWtRqP6m01APuoBSq0WohLlNUQpkgE2RpShkK4IRA7JckUeIAIgryCEB
ltBeog4gtB5M8ixRiECEKRCTIMgwsGIog7ojqQW
+DAE1GIwlHfAUqwHmQflqzsQPhhkC9EdQwxICJBzgEBSgRAGCQYyD44a9mD5IISbriEIy0SBk3/1BEYR6BEJ/
Y6Cy1sYVMEyUUUAhALI8DrD3nIgylZMQkxrKITtgiAG85FjCc8IX/
TIBCO ActiveMatrix BusinessWorks™ Samples
124
zqIIdQlGQXzyBC4UIwDuSEAI26IIgfVhCD1hhDhMI5B5PyEMS3gGGKtAiAFqQSh/
8cIZJDGIRsLjIPGaQDoHwYQSy
+MURyuCOJQRCFUzoBUFoUQJRNKFniLCBK2hhhHu8QwmuIAYRCNGPGNjDFUuQhTnowI8ywAANNBPIK0jwi1M0
QSqv0EEwfjgQY2QhE6NAxA4CQI8m
+IEUUaCTFQphCjrgIQBPCEYAggEIPmBkwAUOwDlooEkmpMIeIrhCEvLwLIHQ4gaTMEY+AhAKJwgE/
wpoCIAoLjEJQGghE2RLRBHcQAk70MMfR5jtQIShBM5OArHxmEF0CWIMJ7QDCpU4wQU1URpjMCEAiMhCH/
5ACV/
YoUxf6EdcBAyEWAikD4hdRRNUEQ8eZCIAZRBDcH3AUIEM4whkKMMOpMwLHrShHpw4wi8qpANHlskeQNAKQWzBA7BFgZ/
yAMIZCgII+gVjBRSzRxPepAX7nCIPUmiFMehwiY7IYwuzTUQWNMkGeAGjB06whLgCQIs7lEYg/
BAFGzoxhbjEgwmGCIAgiAVWKvRgC+H9dkkFMogobCELmSTDE5Y52iR+AQ9SEEgxevCEO+xKFHXQ5g0k/
NWSm/zkKBtPucpXzvKWu/zlMI+5zGdO85rb/OY4zzlHAgIAOw==
Sending and Receiving Mail
A process sends an email to a user and another process receives the email, by either sending a response
to the sender, or writing it to a log in the console.
This process contains Send Mail and Receive Mail activities.
Prerequisites
You must have the account settings for your mail server.
Procedure
1. In the samples directory, select palette > mail > SendAndReceive and double-click
tibco.bw.sample.palette.mail.SendAndReceive. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.mail.SendAndReceive project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click EmailExample.bwp and
MailSendReceive.bwp.
5. Click Run > Debug Configurations.
6. At left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select
BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.mail.SendAndReceive.application.
TIBCO ActiveMatrix BusinessWorks™ Samples
125
8. Click Debug.
This will run the sample in the Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The SendAndReceive.log output file is created in SendAndReceive folder at c:/tmp
Depending on your actions:
●
If userA sends an email to the user configured in the Receive Incoming Email task with the subject
"Send Response from BW", the mail account specified by the reply_email_address module property
receives an email and the following message is visible in the console:
13:49:35.053 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.S.Log
●
Mail sent to user. 13:49:39.613 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.p.m.S.Log
●
Response sent to user1.
●
If userA sends an email to the user configured in the Receive Incoming Email task with another
subject, the console shows the following message:
13:49:35.053 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.S.Log
●
Mail sent to user. 13:49:39.613 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.p.m.S.Log -No subject match
Troubleshooting
If the process does not receive the mail, verify the following whether:
●
The email server and user information are correctly configured for your system.
●
The reply_email_address module property refers to the mail account you are checking.
If the process after receiving the mail did not send a response, verify the following whether:
●
The subject used in the email matches the incoming_email_subject module property. If it
does not match, then find an appropriate message in the console.
●
You have specified the Host correctly. If not, then it throws an error.
Publishing and Subscribing to TIBCO Rendezvous Messages
Rendezvous programs use messages as the common currency to exchange data. The Rendezvous
palette includes activities that allow you to easily setup subjects to send and receive messages. This
sample shows how to use Rendezvous activities.
Prerequisites
TIBCO Rendezvous™ must be running on the machine.
To run this sample you can either use TIBCO ActiveMatrix BusinessWorks 6.x client or TIBCO
ActiveMatrix BusinessWorks 5.x as a client.
Refer to Configure the Client in TIBCO Designer section to configure client in TIBCO ActiveMatrix
BusinessWorks 5.x.
TIBCO ActiveMatrix BusinessWorks™ Samples
126
Procedure
1. In the samples directory, select palette > rendezvous > RPC and double-click
tibco.bw.sample.palette.rendezvous.RPC. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.rendezvous.RPC project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory and double-click PublishRVmessageProcess.bwp,
RendezvousRPC.bwp, and SubscribeRVMessageProcess.bwp.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.rendezvous.rpc.application.
8. Click Debug.
This will run the sample in Debug mode.
Configure the Client in TIBCO Designer
9. In TIBCO Designer, import the client project, TIBCO_HOME\bw\n.n\samples\palette\rv\RPC
\bw5\tibco.bw.sample.palette.rendezvous.RPCClient.
10. Click Global Variables and select the OUTPUT_FILE variables to get the location of the output file.
11. Click Tools > Tester > Start.
12. In TIBCO Business Studio, click the Terminate
icon to stop the process.
Result
The Console displays the message similar to the following:
10:49:55.611 INFO [bwThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.p.r.rpc.Log - Message Published to BW.Start
10:49:57.745 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.p.r.rpc.Log - TestCase Completed
10:50:02.759 INFO [bwThread:In-Memory STWorkProcessor-5]
c.t.b.p.g.L.t.b.s.p.r.rpc.Log - Recieved Response HELLO WORLD
The output.log file is generated at C:\tmp\RPC that contains the following data:
Message Published to BW.Start
Subscriber to Bw.Start invoked and Message Published on BW.Results
Process completed.Final output is--->>HELLO WORLD
TIBCO ActiveMatrix BusinessWorks™ Samples
127
Understanding the Configuration
The Subscribe to BW.Start Rendezvous Subscriber activity listens on the BW.Start subject. On
receiving the message on that subject, the process starts the:
●
Wait_for_BW.Request activity, that is listening to the BW.Request subject.
●
Reply_to_BW.Request activity, that is listening on the BW.Request subject and BW.Reply
subject.
The Wait for Rendezvous Request activity receives the message from the Send Rendezvous
Request activity and sends a reply message to the Rendezvous Request activity. A final result
message is delivered by the publisher on the subject BW.Result.
Managing TCP Connections
The TCP activities are designed to work with custom applications that communicate with other
applications via TCP. This sample shows how to perform common tasks, such as opening a connection,
writing data to it, and closing the connection.
Procedure
1. In the samples directory, select palette > tcp > Basic and double-click
tibco.bw.sample.palette.tcp.Basic. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.tcp.Basic project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory. You will see multiple sample sub packages, each comprising
a Client.bwp and Server.bwp process. Double-click each process to view the activities defined.
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.tcp.Basic.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The TCP_Basic.log file is generated at C:\tmp\TCP_Basic contains the following data.
Test Request Data by iterationLoop- 1
Test Request Data by iterationLoop- 2
Test Request Data by iterationLoop- 3
Test Request Data by iterationLoop- 4
Test Request Data by noSeparator
Test Reply Data by noSeparator
Test Request Data by preDefinedSeparator
Test Reply Data by preDefinedSeparator
TIBCO ActiveMatrix BusinessWorks™ Samples
128
Test Request Data by userDefinedSeparator
Test Reply Data by userDefinedSeparator
Test Request Data by binarySeparator
Test Reply Data by binarySeparator
The Console displays the output similar to the following.
10:40:20.505 INFO [bwThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by iterationLoop- 1
10:40:20.545 INFO [bwThread:In-Memory STWorkProcessor-5]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by iterationLoop- 2
10:40:20.568 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by iterationLoop- 3
10:40:20.593 INFO [bwThread:In-Memory STWorkProcessor-8]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by iterationLoop- 4
10:40:20.618 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest 10:40:21.447 INFO [bwThread:In-Memory STWorkProcessor-1]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by noSeparator
10:40:21.491 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.p.t.B.PrintReply - Test Reply Data by noSeparator
10:40:22.428 INFO [bwThread:In-Memory STWorkProcessor-4]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by preDefinedSeparator
10:40:22.460 INFO [bwThread:In-Memory STWorkProcessor-3]
c.t.b.p.g.L.t.b.s.p.t.B.PrintReply - Test Reply Data by preDefinedSeparator
10:40:23.429 INFO [bwThread:In-Memory STWorkProcessor-2]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by userDefinedSeparator
10:40:23.445 INFO [bwThread:In-Memory STWorkProcessor-6]
c.t.b.p.g.L.t.b.s.p.t.B.PrintReply - Test Reply Data by userDefinedSeparator
10:40:24.429 INFO [bwThread:In-Memory STWorkProcessor-7]
c.t.b.p.g.L.t.b.s.p.t.B.PrintRequest - Test Request Data by binarySeparator
10:40:24.467 INFO [bwThread:In-Memory STWorkProcessor-8]
c.t.b.p.g.L.t.b.s.p.t.B.PrintReply - Test Reply Data by binarySeparator
TIBCO ActiveMatrix BusinessWorks™ Samples
129
Understanding the Configuration
The following TCP palette activities are used in this sample:
●
TCP Receiver: The process starter starts a new process, when a client requests a TCP
connection.
●
Wait for TCP Request: The activity waits for a TCP client connection request.
●
TCP Open Connection: The activity opens a connection to a TCP server.
●
TCP Close Connection: The activity closes a TCP connection opened by a previously
executed activity or process starter.
●
Write TCP Data: The activity sends data on the specified TCP connection.
●
Read TCP Data: The activity reads data from an open TCP connection.
The processes show the use of Binary and Text modes.
Binary mode:
●
The binarySeparator sub-package shows the use of user-defined binary separator in binary
mode.
●
The iterationLoop sub-package shows the use of an iteration loop.
●
The noSeparator sub-package shows the use of no separator in binary mode.
Text mode:
●
The preDefinedSeparator sub-package shows the use of a pre-defined text separator in text
mode.
●
The userDefinedSeparator sub-package shows the use of a user-defined text separator in
text mode.
Sharing a TCP Connection Across Multiple Processes
A TCP connection can be shared across multiple processes or jobs. This simple sample shows the
connection sharing across jobs. In a real-world scenario, the application implementation would handle
the ordering or synchronization of request and responses when the connection is shared.
The process contains:
●
Server: Receives multiple requests from the client processes and logs the request.
●
Initialize Connection: Opens a TCP Connection to the server and sets the connection to a Shared
variable.
●
Client A/Client B/Client C: Client processes that use the shared connection to send requests.
Procedure
1. In the samples directory, select palette > tcp > SharedTCPConnection and double-click
tibco.bw.sample.palette.tcp.SharedTCPConnection. See Accessing Samples for more information.
2. In Project Explorer expand the tibco.bw.sample.palette.tcp.SharedTCPConnection project.
3. Set the default ApplicationProfile to match the OS you are running on. Refer to Setting the Default
Application Profile for details.
4. Fully expand the Processes directory. Two sub-packages are available, one containing the server
and another containing three client processes and the initialize TCP connection process. Explore
each process by double-clicking it.
TIBCO ActiveMatrix BusinessWorks™ Samples
130
5. Click Run > Debug Configurations.
6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and
select BWApplication.
7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
Select the check box next to tibco.bw.sample.palette.tcp.SharedTCPConnection.application.
8. Click Debug.
This will run the sample in Debug mode.
9. Click the Terminate
icon to stop the process.
Result
The result, similar to the following, is written to the SharedTCPConnection.log file at C:\tmp
\SharedTCPConnection.
Text 1 from Client A
Text 2 from Client B
Text 3 from Client C
Understanding the Configuration
The following properties are defined and the default values can be changed:
●
The TCPConnectionProperty that points to the TCP shared resource connection.
●
The FilenameProperty that points to the Output_File. This file is created by the sample
process and contains the output. The default value is C:\tmp\SharedTCPConnection
\SharedTCPConnection.log.
TIBCO ActiveMatrix BusinessWorks™ Samples
131
Migrating Projects
TIBCO ActiveMatrix BusinessWorks 6.x provides an easy way to migrate TIBCO ActiveMatrix
BusinessWorks 5.x projects by using the Migrate BW Projects menu option in TIBCO Business Studio.
You can also use the Eclipse import mechanism to migrate the projects.
Migrating the Project Using TIBCO Business Studio
Procedure
1. In TIBCO Business Studio, go to Project > Migrate BW Projects....
2. In the BusinessWorks Migration Tool wizard, specify the relevant information in the following
fields.
a) Click Browse in the BusinessWorks 5 Project Folder field and provide the location of the
ActiveMatrix BusinessWorks 5.x project that you want to migrate. The tool scans the
ActiveMatrix BusinessWorks 5.x projects in the specified folder location and displays the list of
projects.
b) In the Migrated Project Folder field, click Browse and provide the location where you want to
migrate the project.
c) Select the Add External JARs check box if the ActiveMatrix BusinessWorks 5.x project is using
external JAR files in context with Java activities.
It is a best practice to place the external JAR files in a single location. These JAR files can then be
in-lined in the migrated ActiveMatrix BusinessWorks 6.x project.
d) Click Browse in the Jar Location field and provide the location of the JAR files on disk.
3. In the BusinessWorks 5 Projects area, select the projects you want to migrate and click Migrate.
The migrated projects are visible in the Migration Output area.
4. Click Close after the migration is complete.
You can alternatively migrate the projects using the File > Import menu option. Select
Migrate BW Projects... > Next in the Import dialog.
TIBCO ActiveMatrix BusinessWorks™ Samples
132
Manual Task During Migration
Some of the sample require certain manual steps to be performed while migrating the samples.
You can refer to the steps mentioned in the listed samples.
HTTP Basic Sample
This topic describes migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO
ActiveMatrix BusinessWorks 6.x.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
Procedure
1. Click the Incoming-HTTP-request (HTTP Receiver) activity and click the General tab.
2. In the Parameter table, change the Parameter Cardinality from Required to Optional.
3. Click the Send-Request-to-Wiki-News (Send HTTP Request) activity and specify the following
three values on Input tab.
Input Type
Values
RequestURI
"/wiki/Main_Page"
TIBCO ActiveMatrix BusinessWorks™ Samples
133
Input Type
Values
Accept-Encoding
"text/*, text/html, text/html;level=1"
Content-Type
"text/html;charset=UTF-8"
4. Click the Send-Response-from-Wiki-News (Send HTTP Response) activity and specify the value
for Content-Type on the Input tab as shown in the following image.
HTTP Persistent Connection
This topic describes migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO
ActiveMatrix BusinessWorks 6.x.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
Procedure
1. In the HTTP Client shared resource, Client.ClientProcess-Send-HTTP-RequestHttpClientResource, provide the specified details in the following fields.
Field
Value
Maximum Total Connections
3
Maximum Total Connections Per Host
2
Connection Timeout (ms)
20000
2. Provide the same HTTP Client shared resource Client.ClientProcess-Send-HTTP-RequestHttpClientResource to the following activities in the process, ClientProcess.bwp.
a)
b)
c)
d)
Send-HTTP-Request-1
Send-HTTP-Request-1-1
Send-HTTP-Request-1-2
Send-HTTP-Request-1-3
TIBCO ActiveMatrix BusinessWorks™ Samples
134
JAVA Method Project
This topic describes migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO
ActiveMatrix BusinessWorks 6.x.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
Procedure
1. Go to PublishBalance.bwp and perform Check and Repair for the InvalidAcctExp and
PublishException activities.
2. In the Mapper Check and Repair wizard, check for jmexample.InvalidAccountException.
3. Run the sample.
JMS Message Selector Project
This topic describes migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO
ActiveMatrix BusinessWorks 6.x.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
Procedure
1. Open QueueMessageSelector.bwp, click on the JMS-Queue-Sender activity and click the
Advanced tab.
2. Click Application Properties Type, open the Select Schema Type Definition wizard and select
JMSApplicationProperties.
TIBCO ActiveMatrix BusinessWorks™ Samples
135
3. Delete the Body element from the Input tab in the JMS Queue Sender activity two body elements
are generated after migration.
4. Provide a value in the Body element.
5. Do Check and Repair to remove all the problem markers.
6. Run the process.
HTML Mail with Image
Migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO ActiveMatrix
BusinessWorks 6.x involves certain manual steps to be performed. This topic provides information
about the manual steps involved for a successful migration.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
TIBCO ActiveMatrix BusinessWorks™ Samples
136
Procedure
1. Go to Sender.bwp and click on Send-Mail activity.
2. Do Check and Repair.
Mail with Simple Attachment
This topic describes migrating this project from TIBCO ActiveMatrix BusinessWorks 5.x to TIBCO
ActiveMatrix BusinessWorks 6.x.
Prerequisites
Migrate the TIBCO ActiveMatrix BusinessWorks 5.x project.
Procedure
1. After migrating the project, select the Sender.bwp process, click on Send-Mail activity and do
Check and Repair.
2. Select the Receiver.bwp process and go to Write-binary-attachment-content activity's Input tab
and do Check and Repair.
TIBCO ActiveMatrix BusinessWorks™ Samples
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement