Professional Documents
Culture Documents
JCJR 9YVSER Workbook
JCJR 9YVSER Workbook
Contents
LAB 1 GETTING STARTED .......................................................................................................................................... 6
1.1 BUILDING AND EXECUTING A SIMPLE INTEGRATION APPLICATION ................................................................... 6
1.2 GETTING TO KNOW THE IBM INTEGRATION TOOLKIT .................................................................................... 6
1.3 BUILDING A SIMPLE APPLICATION ............................................................................................................. 11
1.4 TEST THE FLOW USING THE FLOW EXERCISER .......................................................................................... 27
1.5 MESSAGE MODELS AND WORKING WITH XML MESSAGES ........................................................................... 42
1.6 USING THE XML PARSER ....................................................................................................................... 42
1.7 USING MESSAGE MODELS ....................................................................................................................... 52
1.8 PROJECT REFERENCES .......................................................................................................................... 68
1.9 TEST AGAIN USING THE FLOW EXERCISER ................................................................................................ 69
LAB 2 CONTENT-BASED ROUTING.......................................................................................................................... 79
2.1 OVERVIEW ............................................................................................................................................ 79
2.2 ADD ROUTING LOGIC .............................................................................................................................. 79
2.3 TEST CONTENT-BASED ROUTING USING THE FLOW EXERCISER ................................................................... 96
2.4 GENERATING DOCUMENTATION FROM YOUR APPLICATION OR SERVICE....................................................... 113
2.5 A CLOSER LOOK AT THE DEPLOYMENT PROCESS ...................................................................................... 117
2.6 LAB CLEAN-UP ..................................................................................................................................... 125
LAB 3 USING PATTERNS TO WORK WITH FILES ................................................................................................. 128
3.1 SELECTING AND CONFIGURING THE FILESYSTEM LOCATION ....................................................................... 128
3.2 PREPARING THE IIB TOOLKIT WORKSPACE ............................................................................................. 128
3.3 CONFIGURING AND GENERATING THE PATTERN INSTANCE ......................................................................... 131
3.4 RUNNING THE GENERATED IIB APPLICATION ........................................................................................... 134
3.5 SUMMARY ........................................................................................................................................... 137
3.6 INSTALLING A NODE.JS RUNTIME............................................................................................................ 137
3.7 DEPLOYING THE MOCKNODEJS IIB APPLICATION .................................................................................... 139
LAB 4 MODELING FIXED-LENGTH DATA USING A COBOL COPYBOOK ........................................................... 142
4.1 INTRODUCTION .................................................................................................................................... 142
4.2 CREATING A MESSAGE MODEL FROM A COBOL COPYBOOK ..................................................................... 142
4.3 TESTING THE MESSAGE MODEL .............................................................................................................. 163
4.4 USING THE TRACE FACILITY .................................................................................................................. 171
LAB 5 WEB ADMINISTRATION INTERFACE AND FILE-BASED SECURITY ........................................................ 177
5.1 INTRODUCTION .................................................................................................................................... 177
5.2 PREPARE THE IB10NODE APPLICATIONS .............................................................................................. 179
5.3 OVERRIDING BAR FILE ......................................................................................................................... 186
5.4 EXPLORE WEB ADMIN INTERFACE (NO SECURITY) ................................................................................... 188
5.5 INTEGRATION NODE AND SERVER PROPERTIES........................................................................................ 192
5.6 CONFIGURE ROLE-BASED SECURITY FOR WEB USERS............................................................................... 196
5.7 USING THE WEB ADMIN INTERFACE WITH SECURITY ................................................................................. 201
5.8 INTEGRATION TOOLKIT AUTHORIZATION .................................................................................................. 219
5.9 RESOURCE STATISTICS......................................................................................................................... 223
5.10 SUMMARY ........................................................................................................................................... 228
LAB 6 IMPLEMENTING A SERVICE INTERFACE ................................................................................................... 229
6.1 IIB CONFIGURATION ............................................................................................................................. 230
6.2 IMPLEMENTING A SERVICE INTERFACE LAB WORKSPACE ........................................................................... 230
6.3 IMPLEMENTING A SERVICE INTERFACE LAB DEPLOYMENT .......................................................................... 235
6.4 IMPLEMENTING THE SERVICE INTERFACE ................................................................................................ 236
6.5 DEPLOY THE EMPLOYEESERVICE_SOAP INTEGRATION SERVICE ............................................................. 264
6.6 EXPLORE INTEGRATION SERVICE USING WEB ADMIN ............................................................................... 282
6.7 SUMMARY ........................................................................................................................................... 285
LAB 7 CREATING A REST API SERVICE................................................................................................................ 286
7.1 IIB REST API CONFIGURATION ............................................................................................................ 287
7.2 REST API LAB WORKSPACE ................................................................................................................. 287
7.3 REST API LAB DEPLOYMENT ................................................................................................................ 292
7.4 EXPLORE THE EMPLOYEESERVICEV1 JSON DOCUMENT ......................................................................... 295
7.5 USING THE SWAGGER EDITOR ............................................................................................................... 297
7.6 CREATE THE REST API SERVICE .......................................................................................................... 308
7.7 DEPLOY THE EMPLOYEESERVICE_REST REST API .............................................................................. 354
Contents Page 3
IBM Software
Icons
Trouble- This symbol indicates that you can fix a specific problem by
shooting completing the associated troubleshooting information.
Icons Page 5
IBM Software
An Application is a container that holds all the artifacts that make up an Integration
Solution.
The Integration Application you build will be deployed to an Integration Server, where it will execute. The
unit of deployment is a Broker Archive (BAR) file. Broker Archive files have a file extension of “.bar”, and
are essentially a .zip file with a deployment descriptor. The deployment descriptor allows certain
properties of the message flow to be overridden. Once deployed, the flow will then be available to
process requests, messages, events, and more.
There is no need to restart the Integration Node or the Integration Server for the deployment of a
new or changed message flow.
Broker Archive (BAR) files and their use are explained in more detail at the end of Lab 2.
As a convention for these labs, a red box will be used to identify a particular area, and when information
is to be entered or an action is to be taken, it will be in bold characters. Red arrows or lines may be
used to indicate where nodes are to be placed when building your message flow.
A number of sections will be labeled “Key Idea” or “Key Concept”. Be sure to review these sections when
you come across them, as they will explain concepts of IBM Integration Bus (IIB) that you will explore in
some detail in the early labs, but in more detail as you continue to work through the more advanced labs.
The following screen is displayed when starting the IBM Integration Toolkit.
You are prompted to select an Eclipse Workspace. Select the default here, but be aware that this
facility allows you switch between workspaces when starting or using the toolkit.
Click OK.
__a. From the Menu bar select File > Switch Workspace > Other
__c. The current workspace will be saved, and the Toolkit will restart with the new workspace.
__3. If this workspace is being opened for the first time, you will see the Welcome screen.
The Integration Toolkit is based on Eclipse and includes components from IBM Rational® Application
Developer. It provides several perspectives specifically for IBM Integration Bus as well as additional
perspectives from Rational Application Developer and Eclipse. This system is using the default
installation. During the labs and lectures, you will be learning more about the components in a typical
development and runtime environment.
The screenshot above is of the Integration Development perspective. It is divided into multiple views (or
panes). Each view is identified by a tab at the top of the view. On the lower left are several additional
views, such as the Integration Nodes view.
On the upper left is the Navigator view, which has tabs for projects (Application Development) and
patterns (Patterns Explorer). The Navigator view contains the projects that are available within the
Eclipse workspace. In this screenshot there are no projects at present; so what you see are a set of New
Project wizards, for kick-starting the development of Applications, Integration Services, REST APIs and
Libraries. You can also access these by right-clicking in the white space of the Application Development
view.
The area below the Navigator view is the summary area. Several views are present in this region—the
Integration Nodes view will show all defined local nodes as well as connections to remote nodes that
have been created. Integration Servers and the resources deployed, as well as their status, will be
shown here as well (the default integration server is shown in the screenshot above).
The large area on the right is used by the resource editors. When an editor has opened a resource, it
will also be represented by a tab. Below the editor view is a pair of views for Properties and Problems.
At upper right are tabs for the one or more Perspectives that have been opened. To switch between
Perspectives, you can simply click the desired tab.
The Integration Toolkit also provides links to a number of predefined patterns. In later labs you will
explore how these are used.
Eclipse is project oriented; artifacts are organized into projects. A project is typed. Project types that are
specific to IBM Integration Bus include Applications, Integration Services, REST APIs and Libraries.
Also, legacy projects of type Message Flow Project and Message Set Project can be created or imported
into the toolkit. Since they predate the concept of Applications and Libraries, they will be visible in the
hierarchy in a folder called “Independent Resources”.
Alternatively, you can click File on the menu bar, and select New > Application, or use the
drop-down list under File. Use these when you want to create project types other than those
represented by the four wizards.
The options for the New action will be different depending on how the request is made. For
example, when using File > New from the Menu bar, all of the options will be listed. However, if
you start from an Application, as you did in this case, the only options shown are those that are
related to the selected project type.
Click Finish.
You should see the first of several editors you will use. This one is the Message Flow Editor,
which is used for message flow composition.
__11. Click the white space in the Message Flow Editor. Information about the message flow will
appear in the Properties pane.
Enter Introduction to IBM Integration Bus V10 for the Short description field.
A message flow must begin with an input node. An input node establishes the runtime context
for the flow. There is an input node for each of the many protocols that IBM Integration Bus
supports. You will process an HTTP request with this flow so you need an HTTPInput node.
__16. Hover over the node. You will see a brief description of the node’s function.
__17. Click the node, and either drag it to the canvas or move the mouse to the canvas
and click again.
When a node is initially added, its name can be changed immediately by typing over the default
name or by entering a new value in the node name field in the Description tab of the Properties.
A best practice is to provide a new name for each node that is descriptive of the function that it
provides. For most of the labs, you will be renaming the nodes.
Note:
If you use the names as suggested it will make it easier to
follow this lab guide.
The Path suffix for URL in the node properties must be set. Mandatory fields that are not set
are indicated by a message in red.
Click this for a brief description of the node’s function. In addition, there is a hyperlink provided to
the Help section that describes the node in detail.
__21. Hover over the icon that appears. Field-level help is available by clicking on these when they
appear.
Note:
This name is case sensitive.
The path suffix must begin with “/”.
__23. Select the Description tab. This section is used for documentation. The name of the node may
also be changed. The node name is shown in the message flow editor. It does not affect the
operation of the message flow.
__25. Enter your choice of text for the Long description (Getting Started is shown in the screen
shot).
__26. In the flow editor, hover the mouse pointer over the node name.
The information in the Short description field is displayed. When there are multiple nodes on the
canvas, if you move from node to node with the mouse, the same tab in the Properties will be
displayed.
Hover over the node to see a brief description of the node’s function.
__28. Select the node and place it on the canvas to the right of the IntroLab_Listener node.
You do not need to rename the Trace node.
__32. Use the pull down list on the Destination field to select File.
The information in the Pattern box tells the node what information to produce in the trace output.
If you type a line of raw text, it is echoed to the output.
Note: You can actually enter any free-form text you like. You are doing this to make it easier to
separate trace entries in the trace file, but this is not a requirement.
In the Pattern box, enter the string ${Root} exactly as indicated – this tells the trace node to
dump out the entire contents of the message syntax tree that enters the node.
Note:
The pattern uses curly braces, not parentheses!
The pattern is case sensitive!
The expression between the curly braces will be evaluated at run time.
Review the values you entered into the Pattern box. Does it match what you see below?
__35. Double-check that Destination is set to File, the File path and name are valid (for example,
there are no embedded spaces), and that the Pattern is specified exactly as ${Root}
__36. On the Palette, return to the HTTP drawer and open it.
__39. Press Enter to accept the default node name of HTTP Reply.
__41. Review the properties for this node. You will be using the default values.
The nodes for this flow are configured. Next you will wire the flow together using the Node
Terminals.
As you work with the various nodes, you will also be working with their Input and Output terminals. Input
terminals are typically named In. Most nodes have an Output terminal named Out. They may have
several others.
You can hover the mouse pointer over the node terminals to see their names.
Some of these will have common names such as Failure or Catch and others will be unique to that
particular node. Some nodes allow you to define the terminals. The terminals are given a name when
they are defined.
The lab instructions will identify the output terminal to be used when connecting nodes together. If you
hover the mouse pointer over a terminal, a small popup will appear that identifies the name of the
terminal.
You will now wire the nodes together to create a path of control for the message to follow through the
message flow.
Wire the Out terminal of the IntroLab_Listener node to the In terminal of the Trace node. There are two
techniques that can accomplish this:
One – position the mouse over the Out terminal (second from the top), click and drag to the
target and click again.
Two – right-click a node and select Create Connection. What follows is an example of terminal
selection presented as a result of using Create Connection.
The rest of the Lab instructions show the second method for wiring.
The list of the available output terminals for the selected node is shown on the left.
A list of available input terminals for the nodes in the flow is shown on the right.
The same steps will be used to make a connection from the Trace node to the HTTP Reply
node.
Your message flow should now look like the above diagram.
Notice the small asterisk next to the message flow name. This indicates that the message flow
has not been saved to disk.
__52. It is time to save your work. Hold down the Ctrl key and press the S key to save the message
flow. You can also click the “diskette” icon or use File > Save to perform a save.
The following graphic will be used as a reminder when it is time to save your work.
The IBM Integration Bus Flow Exerciser provides the ability to capture a "snapshot" of the message
assembly as it is processed from node to node in a flow. These snapshots capture the state of the
message, as well as other structures in the message assembly, highlighting the path of control through
the message flow, providing an easy, visual way to test new or modified flows.
The recorded snapshot includes all syntax trees in the message assembly—message, local environment,
environment and the exception list—as well as several other properties such as a sequence number that
give more context to the recorded message.
When using the Flow Exerciser, recorded messages are displayed using an XML representation, which
shows the structure and content of the logical tree at each point in the message flow. This provides a
convenient visualization of the logical tree, and is a simplified version of the internal representation that
IIB uses to represent the logical tree.
Fields in the message tree can be modified, providing an easy way to exercise different paths in the
message flow.
A Flow Exerciser toolbar is located at the top of the flow editor. It has several icons, as described below.
Start the Flow Exerciser. Once started, clicking this icon again will stop it.
Create a message (or select an existing message or recorded message) to send through the flow.
Using this toolbar, message recording and display can be performed with only a handful of mouse clicks.
This toolbar is activated when the user clicks the button to put the flow into record mode. This will deploy
the message flow, along with any dependent resources, and enable recording. Once the message flow
has been invoked, either by using an external client or injecting a message, the recorded message
assembly at each stage in the flow can be displayed.
Message injection is a feature of the Flow Exerciser that provides the ability to "inject" recorded
messages back into a flow, bypassing their normal transport method. For example, messages can be
injected in the MQTT subscribe node even when an MQTT server is unavailable.
When recorded messages are displayed, those that are valid for injection include a "Save" icon in the
top-right corner. Messages are saved to the same project as the message flow and can be shared with a
project interchange file or backed up to a repository for use in a test environment.
Input nodes will only process injected messages if they have no incoming data via their regular transport.
Output nodes "know" that a message has been injected and will deal with it differently from a normal
message.
In this section, you will use the Flow Exerciser to test your message flow.
__53. Click the Start control on the Flow Exerciser toolbar to start recording.
__54. If you did not save the flow before starting the Flow Exerciser, the following window will be
displayed:
Click OK.
__55. The application must be deployed to the default Integration Server of TESTNODE. This will be
done automatically for you by the Flow Exerciser:
__56. Once the application has been deployed, the following window will be displayed.
__57. You are now ready to start recording. You will notice two changes:
1) The application has been deployed to the default Integration Server of TESTNODE. You
can see this by looking at the Integration Nodes view at the bottom left of the Toolkit:
2) The message flow is now “locked” – the background color of the flow editor has changed,
and you cannot modify the flow:
__58. To select a message to send, click the Send Message control on the Flow Exerciser toolbar.
__59. In the Send Message dialog, click the New message control.
__60. A new message (by default called new message 1) will be created.
__61. Change the name to “Test message,” select Import from file, and click File system.
__62. In the Import from file dialog, navigate to C:\student\IntroLabMessage, select the
IN_Request.xml file, and click Open.
__64. The Flow Exerciser will start the flow, inject the message into the flow, and capture the HTTP
reply message for viewing.
__65. When returned to the flow, you will be pointed to the injected message for analysis, capture
(saving), or both.
This icon means the recorded message can be viewed, changed and/or saved.
__66. The Flow Exerciser will retrieve the recorded message tree, parse the folders that make up the
tree, and render them in XML format for easy viewing:
__67. When complete, the message tree will be displayed, with the Message portion of the tree
expanded.
Expand the other folders in the tree and examine them if you like.
You can see the folders representing the message Properties, followed by the HTTP Input
header, followed by the payload (in the <BLOB> folder).
__70. Use the Windows Explorer to locate the file the Trace node was configured to write to.
__71. Recall that you configured the Trace node to capture the “IIB-internal” view of the message tree.
Examine the Trace output. You see IIB-supplied parsers for interpreting the Properties
(“WSPROPERTYPARSER”) and HTTP Input Header (“WSINPHDR”). Trace output allows you to
see more detail about the structure of header and message fields, such as their type (for
example, CHARACTER, INTEGER, or BOOLEAN).
Although you see here IIB-supplied parsers for Properties (“WSPROPERTYPARSER”) and
HTTP Input Header (“WSINPHDR”), what is missing is a parser for the payload. Because “none”
is supplied, IIB treats the payload as a BLOB.
The next section will show how to tell IIB the payload is XML.
__73. Return to the recorded message, and click the save icon in the upper right corner.
Note: If the recorded message is closed, you can double-click the icon to reopen it.
__74. Save the recorded message with the name “Test message 1”, and click OK.
__76. In the Application Development pane, expand the Other Resources folder under the IntoLab
project. You will see the recorded message you saved, with the name
IntroMessageFlow_recordedMessage.xml.
__78. The XML editor will open. You can see the name you assigned to the recorded message.
__82. The Flow Exerciser is stopped, and the message flow is returned to editable mode.
Continue to the next section to see how to tell IIB that the payload is XML.
The recorded message, as well as the trace file contents, will be viewed to see the difference.
__84. Click the IntroLab_Listener node to bring its properties into view.
The message flow will be modified so that it uses the XMLNSC parser to process the input
message.
__85. On the Properties view at the bottom of the screen, click the Input Message Parsing tab.
Since nothing was specified when the node was added, the Message domain (i.e. the parser)
defaults to BLOB – which you saw in the Flow Exerciser as well as the Trace file.
__86. Click the pull-down for the Message domain. The various parsers are listed along with a short
description. Depending on the Message domain selection, the other fields may be enabled or
disabled.
__87. Select the XMLNSC parser. The XMLNSC parser is the most modern and most efficient of the
three XML parsers supplied with IBM Integration Bus, and should be the parser of choice for
most if not all message flows that handle XML messages. The other parsers are there for
backwards compatibility.
As discussed previously, IBM Integration Bus supplies a range of parsers to parse message content and
serialize message trees in different formats.
A parser is called when the bit stream that represents an input request or event must be converted to the
format that is used internally by the broker; this process is known as parsing. The input is a bit stream,
and the output is a logical message syntax tree representation of the bit stream.
A parser is also used to serialize a logical syntax tree structure into a bit stream (for example on an
output node). This process is known as serializing.
Each parser is suited to a particular class of messages, known as a message domain. The following list
contains some examples of the message domains used in IBM Integration Bus:
● XMLNSC – for XML documents
● DFDL – for general text or binary data streams including industry standards
● JSON – for JSON documents
● DataObject – for data without a stream representation (used by adapters and connectors)
Now, with the parser for the payload identified, re-run the Flow Exerciser.
__90. If the flow needs to be saved you will see this pop-up. Click OK.
__94. The Input message from the previous run is still available. Click Test message.
__96. The Flow Exerciser will run. Once it stops, click Close.
__98. Note the difference between this run and the previous one.
The Properties and HTTPInputHeader folders are there as before. But this time, instead of BLOB
and UnknownParserName, you see the XMLNSC parser was used to successfully parse the
message payload.
__99. Save this recorded message by clicking on the save icon in the upper right corner.
Note: If the recorded message is closed, you can double-click the icon to reopen it.
__100. Call this recorded message “Test message 2” and click OK.
__102. Use the Windows Explorer to locate the file that the Trace node was configured to write to.
Again you see the IIB-supplied parsers for interpreting the Properties and HTTP Input Header.
But now you also see XMLNSC rather than BLOB for the payload parser, and you see the
payload has been parsed and interpreted.
One thing you will notice here is that all the XML fields are CHARACTER.
Without a schema, IIB has no way to tell if any of the fields are another type.
Next you will supply a schema and tell IIB to validate the payload against that schema.
__107. The Flow Exerciser is stopped, and the message flow is returned to editable mode.
__108. In the Application Development pane, expand the Other Resources folder. Double-click the
IntroMessageFlow_recordedMessage.xml file.
__109. The XML editor will open. You should now see two testData messages, with the names you
assigned to each.
The next section will show how to tell IIB to use a message model (XML schema) to validate the
message contents.
This is needed in this case because the XML data contains three fields that are not CHARACTER data.
A message model is needed for the XMLNSC parser to be able to correctly identify those fields.
Much of the business world relies on the exchange of information between applications. This information
is contained in messages that have a defined structure that is known and agreed by the sender and the
receiver.
Applications typically use a combination of message formats, including those message formats that are
defined by the following structures or standards:
● Comma separated values (CSV)
● COBOL, C, PL1, and other language data structures
● Industry standards such as SWIFT, X12 or HL7
● XML including SOAP
● REST APIs using JSON
You can model a wide variety of message formats so that they can be understood by IBM Integration
Bus message flows. When the message format is known, the broker can parse an incoming message bit
stream and convert it into a logical message tree for manipulation by a message flow.
Some message formats are self-defining and can be parsed without reference to a model. However,
most message formats are not self-defining, and a parser must have access to a predefined model that
describes the message if it is to parse the message correctly.
JSON is an example of a self-defining message format. Another is XML. With self-defining formats, the
message itself contains metadata in addition to data values, and it is this metadata that enables JSON
and XML parsers to understand these messages even if no model is available.
Examples of messages that do not have a self-defining message format are CSV text messages, binary
messages that originate from a COBOL program, and SWIFT formatted text messages. None of these
message formats contain sufficient information to enable a parser to fully understand the message. In
these cases, a model is required to describe them.
Even if your messages are self-defining, and do not require modeling, message modeling has the
following advantages:
● Runtime validation of messages. Without a message model, a parser cannot check
whether input and output messages have the correct structure and data values.
● Enhanced parsing of XML messages. Although XML is self-defining, all data values are
treated as strings if a message model is not used. If a message model is used, the parser
is provided with the data type of data values, and can cast the data accordingly.
● Code completion assistance when coding transformation. When you are creating
ESQL or Java code as part of your message flows, the language editors can use
message models to provide code completion assistance.
● Re-use of message models, in whole or in part, by creating additional messages that are
based on existing messages.
● Generation of documentation.
Provision of version control and access control for message models by storing
them in a central repository.
Message models allow the full use of the facilities that are offered by IBM Integration Bus.
To speed up the creation of message models, importers are provided to read metadata such as C
header files, COBOL copybooks, and EIS (Enterprise Information System, such as SAP) metadata, and
to create message models from that metadata. Additionally, predefined models are available for
common industry standard message formats such as SWIFT, EDIFACT, X12, FIX, HL7, and TLOG.
The XML Parser was run in programmatic mode where it parsed the XML message, so it assumed
everything was a string. By parsing with a model, you can get a message with typed elements and one
that is subject to constraints (such as required fields or max field lengths). The toolkit provides wizards
to import your existing models (such as WSDLs, XSDs or copybooks).
__111. In the Application Development view (project navigator) on the left, right-click the whitespace.
Click Next.
__114. Select the I already have an XML schema for my data radio button.
Click Next.
__115. Click the New button next to the Application or Library field.
Click OK.
__117. In the New Library dialog, type “IntroLab_Lib” as the Library name.
Select the Static Library radio button. This means the contents of this library will not be shared
across applications and services.
Click Finish.
__118. Back in the message model wizard, select the radio button Select file from outside workspace.
Select IN_Request.xsd.
Click Open.
You now have a Library project with the XML message model for the input message.
Applications and libraries are deployable containers of resources: The contents of these can include
message flows, message definitions (DFDL, XSD files), JAR files, XSL style sheets, and WebSphere®
Adapters files.
A library is a logical grouping of related code, data or both. A library contains references to reusable
resources, such as a message model or map. A library can refer to a resource that is contained in
another library. Libraries are optional. They are typically used to reuse resources. Use multiple libraries
to group related resources (for example, by type or function).
Libraries can be either static (embedded in the applications or services that use them) or shared
(meaning they can be referenced across multiple applications or services).
Consider using libraries if you want to share routines and definitions across multiple teams, projects or
brokers. Libraries are also useful if you need to use different versions of a coherent set of routines and
definitions.
Using a library is typically not necessary if you do not need to regularly reuse IBM Integration Bus
routines or definitions.
__122. The XML Schema Editor should be opened for you after import.
__123. The message model should now be visible in the XML Schema Editor.
__124. Double-click the (IN_RequestType) title bar to expand the schema view.
__125. Note that some elements, such as customerNumber and customerCreditScore, are integers
(ints) and not strings.
Now, in the message flow, you need to tell the parser to run in schema-driven mode, rather than
operate in programmatic mode.
__127. Click the IntroMessageFlow tab to bring the message flow into view.
__128. Click the IntroLab_Listener node to bring its properties into view.
Select the Build tree using XML schema data types check box.
__132. Note that when the flow is saved, a warning appears on the Input node.
__133. Hover the mouse pointer over the node to see the warning.
__134. You can also see this warning if you click the Problems tab in the lower right window.
You could resolve this warning, but for now ignore it.
However, this is a good point to spend a minute reviewing how IBM Integration Bus handles parsing.
Parsers such as the XMLNSC parser simplify your integration projects by allowing you to work with the
logical message tree, as opposed to having to work directly with the wire-format message. And parsers
that support messages models such as XMLNSC and DFDL can also be used to validate the structure or
content of messages.
However, in many integration projects there is no need to parse the entire message. For example, you
may be simply routing a message based on a small subset of the information in the message (you will
see an example of this in the next lab). Or, you may be modifying the message, but only in a trivial way.
In such cases, parsing the entire message may incur needless overhead.
For this reason, IBM Integration Bus gives you the ability to dictate when and to what extent parsing is to
be performed. One example of this is parse timing.
By default, Integration Bus will use on-demand parsing. This means the message will only be parsed if
elements within it are referenced, the parsing will occur at the time of reference (“on demand”), and the
message will only be parsed up to the point of reference. In many cases, on-demand parsing will save
memory and processor overhead, particularly if referenced fields are near the beginning of a message.
On-demand parsing involves a trade-off, though: If a message is malformed, that fact may not be
discovered, as the malformation may be at a point in the message for which parsing was avoided.
Similarly, if validation is requested, it will only be performed for those parts of the message that are
parsed, and so an invalid message may not be detected.
The latter situation is the reason for the warning you see on the IntroLab_Listener node. As the warning
indicated, you requested that validation be performed on the content of the message, but the parse
timing was set to its default value of “On Demand”, creating the possibility that validation errors would not
be
detected.
If Parse Timing were set to “Immediate,” the result would be that the entire message would be parsed,
allowing validation to be performed against the full message.
As mentioned, you could resolve this warning, but for now ignore it. You will explore dealing with errors
and problem determination in a later lab, including parsing errors.
__135. In the Application Development pane, right-click the IntroLab application, and select Manage
Library References from the menu.
Click OK.
__137. In the Application Development pane, you should now see that IntroLab includes a reference to
the IntroLab_Lib library.
You are now ready to test the application again, using the Flow Exerciser.
__138. In the IBM Integration Toolkit, click the IntroMessageFlow tab to bring the message flow into
view.
__140. If the flow needs to be saved you will see this pop-up. Click OK.
__144. The Input message from the previous tests is still available. Click Test message.
__146. The Flow Exerciser will run. Click Close after it stops.
__148. Note that the elements the XML schema identified as integers look no different here than in your
previous test.
But that is correct, because the Flow Exerciser renders the message tree using an XML
representation, regardless of their format, and elements in those messages as strings, again
regardless of their actual type.
We can return to the Trace file to see the actual physical representation of tree elements, to see
if the schema was in fact used when parsing the message.
__149. Save this recorded message by clicking on the save icon in the upper right corner.
Note: If the recorded message is closed, you can double-click the icon to reopen it.
__150. Call this recorded message Test message 3 and click OK.
__152. Use the Windows Explorer to locate the file the Trace node was configured to write to.
__153. Scroll to the bottom of the Trace file (or use Ctl+End) to view the new trace output
Again you see the IIB-supplied parsers for interpreting the Properties and HTTP Input Header.
And you see XMLNSC for the payload parser, and you see the payload has been parsed and
interpreted.
However, this time the parser used the schema when constructing the message tree, and
correctly identified the type as “integer” for the three indicated elements.
__157. The Flow Exerciser is stopped, and the message flow is returned to editable mode.
END OF LAB 1
2.1 Overview
In this lab, you will modify the flow you created in Lab 1 to perform simple routing. Input messages will
be sent to one of two destinations depending on the country code. Addresses in the United States will
be routed to a US reply path, while addresses in Canada will be routed to a Canadian reply path.
You will also include some basic exception handling, to deal with addresses that are not in the United
States or Canada.
__2. Select the IntroMessageFlow message flow in the message flow editor.
__4. Click the Out -> In connector shown – the connector will turn blue. Press the Delete key to
remove the connector.
__5. Click the other Out -> In connector shown – the connector will turn blue. Press the Delete key to
remove the connector.
__6. Leave the Trace node unwired for now. Do not delete it. You will be repurposing it in a later lab.
__8. Select a Route node and place it between the IntroLab_Listener and HTTP Reply nodes.
__11. Select an HTTPReply node and place it beneath the existing HTTP Reply node.
Do not rename the new HTTP Reply node; you will be renaming them both shortly.
Terminals will now be added to the CheckCountry routing node for US and Canadian addresses.
Click OK to continue.
Click OK to continue.
__17. Notice that the shape of the CheckCountry node has changed slightly.
Once there are too many terminals to display discretely, they will be grouped together.
__18. Change the name of the HTTP Reply node to “Reply if US.”
__19. Change the name of the HTTP Reply1 node to “Reply if Canada.”
Note:
Two HTTPReply nodes are not actually necessary – a
single one could have been used. But separate nodes
were used here for clarity, as well as to make the flow
more self-documenting.
__21. Another way to make a connection is just to click the terminal itself.
Try this by selecting the Out terminal (second from the top) of the IntroLab_Listener node.
__22. Wire the Out terminal of the IntroLab_Listener node to the In terminal of the CheckCountry
node.
__23. Hover the mouse pointer over the connector to verify that the correct terminals are wired.
__24. Click the group of output terminals on the CheckCountry route node.
__27. Again click the group of output terminals on the CheckCountry route node.
Click OK.
The criteria to be used by the CheckCountry routing node must now be specified.
Click Add.
__31. Use the drop down menu to select the US terminal as the Routing output terminal.
Click Edit.
Note:
If you do not see In_Request in the list, then you
must add a reference to the library by right-clicking
the IntroLab application and selecting Manage
Library references.
Click OK to continue.
Select the customerCountry element and drag it into the XPath Expression dialog box.
__35. Drag an equal sign from the Operators pane to the end of the expression.
Append the letters ‘US’ (including the single quotes) after the equal sign.
The filter pattern for the US terminal should now be visible. The process will now be repeated to
create a Filter table entry for the Canada terminal.
__37. Click Add to enter a filter pattern for the Canada terminal.
__38. Use the drop down menu to select the Canada terminal as the Routing output terminal.
Click Edit.
__39. Expand Root > tns:In_RequestcustomerDetails. Tip: If you do not see In_Request in the
viewer, re-add it as explained in steps 31-32.
__40. Select the customerCountry field and drag it to the XPath Expression window.
The filter pattern for the Canada terminal should now be visible.
Verify that the two Filter table entries appear as shown below.
Note: The Trace node is still unwired. But this will not cause any problems.
__47. The Input message from the previous tests is still available. Click Test message.
Click Send.
__49. The Flow Exerciser will run. Click Close after it stops.
__50. The Flow Exerciser shows the path the US message took through the flow.
__52. Note that the Recorded Message does reflect the change you made.
__53. Save this recorded message by clicking the save icon in the upper right corner.
Click OK.
__56. Repeat these steps to test the Canada path in the message flow.
Click Send.
__58. The Flow Exerciser will run. Click Close after it stops.
__59. This time the Flow Exerciser shows that the CA path was taken.
__61. Note that the Recorded Message does reflect the change you made.
__62. Save this recorded message by clicking the save icon in the upper right corner.
Click OK.
__66. In the XML Editor, expand the two most recent testData entries. You should see the recorded
messages for US and CA.
__68. You have tested your two expected paths (US and CA). But what will happen if some other
customerCountry value is received by the message flow?
__70. Click Test message. Change the customerCountry to “MX”. Click Send.
__71. Note that the message was sent but no HTTP Reply was received.
Click Close.
__72. In the Flow Exerciser, notice that control reached the CheckCountry node. But it stopped there.
Why did it stop?
__75. The Flow Exerciser is stopped, and the message flow is returned to editable mode.
● US and Canada are wired. But MX is not going to match either of those.
● There was neither a match nor a failure.
● Default would be the terminal normally taken when there was no match. But this was not
wired. Therefore, the message was discarded. This might not be what you want to
happen.
One approach would be to wire the Default terminal to an “Unsupported Country” path.
But many things could potentially go wrong in a message flow. Rather than wire every possible
exception path on every node in a flow, you will explore approaches to dealing with situations
like this one in a later lab.
In a later lab you will explore one approach for dealing with unexpected conditions such as this one, as
well as how to implement some basic flow-level exception handling.
The Document Generation feature of the toolkit uses information such as metadata from flows and other
development artifacts, as well as description information specified by solution developers.
This documentation can be combined with test messages and results to create a package of
documentation, testing artifacts and scenarios.
__79. In the Application Development pane, select the IntroMessageFlow.msgflow file, right-click the
file, and select Generate Documentation from the menu.
Click Next.
__81. Make sure Generate documentation from the selected resource is selected.
Click Next.
__84. Review the generated report (the first page of which is shown here).
Notice how the Toolkit uses both flow metadata as well as descriptions you entered, version
numbers, and additional information to generate the report.
Many of these fields were left blank in the labs you did, but a best practice would be for you to
make the fullest use possible of these fields, in order to make your integration solutions as well-
documented and maintainable as possible.
The next section will take a closer look at the deployment process.
When you create an application, Integration Service or REST API project in the IBM Integration Toolkit,
you must distribute them to the Integration Nodes where you want them to run. Artifacts for message
flows and associated resources are packaged in a broker archive (BAR) file before being deployed to the
integration server.
Depending on your work patterns, you might use all these methods at different times.
The Integration Toolkit provides an Integration Nodes view in the lower left hand corner of the Integration
Development perspective. If you expand an Integration Node, all the Integration Servers in that node are
displayed, as well as deployed applications, services, REST APIs, and their underlying message flows
and their associated resources. You can drag an application or library, message flow, or a broker
archive (BAR) file from the Application Development view onto an Integration Server to deploy it.
Alternatively, you can right-click an Integration Server to select an application or library, message flow, or
BAR file to deploy to the selected Integration Server.
If you are working with an application and want to deploy and test it quickly, you can deploy just that
resource. Drag the resource onto the Integration Server to which you want to deploy it. A BAR file is
generated automatically and deployed. If static libraries are referenced, they are added automatically to
the BAR file and deployed. If a message flow contains a subflow that is defined in a “.subflow” file, the
subflow is automatically included in the BAR file, and deployed with the message flow. If you drag a flow
that is contained in an application or library, you will see a message saying that the whole application or
library will be deployed, because you cannot deploy a message flow on its own if it belongs to an
application or library.
The Broker Archive (BAR) file is a .zip file that contains the flows, models, .jar files, maps, and any other
resources in the workspace needed to run your applications. The BAR file also contains a deployment
descriptor .xml file, which exposes flow and node properties for override at build or deploy time. The
following sequence of events illustrates how to deploy with a BAR file:
1. Create a broker archive.
2. Add applications, libraries, services, REST APIs, message flows and other flow
dependencies to the broker archive.
3. If necessary, edit the configurable properties of the message flows or applications in the
broker archive.
4. Deploy the BAR file by sending it to an Integration Server.
__88. Enter “Lab2” as the name of the new broker archive file.
Click Finish.
__90. Select the Message flows, static libraries and other message flow dependencies radio
button.
Look at the Properties view below to see what properties are exposed in order to be overridden
within the BAR file. For example, select the IntroLab_Listener node. You can see that the
“Path suffix for URL” property can be overridden at deployment time.
To deploy, find the Lab2.bar file in the navigator in the BARs container.
__97. Once deployment is complete, click the default integration server to open it and see the assets
deployed to it.
The IntroLab application has been deployed, which included the IntroMessageFlow message
flow. The IntroLab_Lib static library, which contains the IN_Request XML Schema, has also
been deployed.
Note too that the deployment date and time should reflect the actual time of deployment.
Close all the open editor tabs but leave the Toolkit running.
The following steps will delete the run-time artifacts from the TESTNODE server.
This will make things less cluttered while you continue through the remainder of the labs.
__98. In the Application Development pane, collapse any folders that are currently expanded.
__99. In the Integration Nodes pane, right-click the default Integration Server, and select
Delete > All Flows And Resources.
__102. All deployed objects should be cleared from the default Integration Server.
__103. Close all the open editor tabs but leave the Toolkit running.
END OF LAB 2
You will use the default integration node with a name starting with TESTNODE and the integration server
named default.
__1. Create or select a directory where IIB will read the input file and make note of its path (e.g.
C:\student10\Lab3). Under that path, create a subdirectory named file_to_http_sample .
__2. Set the MQSI_FILENODES_ROOT_DIRECTORY environment variable to the path in the prior
step. For example, on Windows, navigate to Control Panel > All Control Panel Items >
System, click Advanced system settings, then Environment Variables, then set this variable
as a system variable. Log out and log back in. (This step may already be done, depending on
the machine you use for this lab.)
This environment variable sets the starting point for the relative file paths (for example,
file_to_http_sample) used in this lab’s implementation.
__3. Double-click the desktop shortcut for the IIB V10 Toolkit. When prompted for a workspace, enter
a path for an empty workspace then click OK.
__5. In the Toolkit’s upper left, click the Patterns Explorer tab. Then select Pattern Repositories >
Experimental OT4I GitHub Pattern Repository > File Processing > Record Distribution >
HTTP one-way to open the Pattern Specification editor for Record Distribution to HTTP: one-
way pattern. The Patterns Explorer view should indicate that this pattern currently is not
installed.
__6. In the lower right of the Pattern Specification editor, click Download and Install.
__7. Let the download complete. If prompted with a security warning, click OK to proceed. Upon
completion of the download, the Patterns Explorer should indicate that the HTTP one-way
pattern is now installed.
__8. Read all of the information on the Pattern Specification view for this pattern, including the links in
the Message Flows and Related Tasks sections.
__9. As mentioned in the Solution section of the above Pattern Specification, use of this pattern
requires installation of the Node.js runtime. Alternatively, you may elect to deploy an IIB
application that serves as an equivalent of the Node.js application. Choose between these two
options and follow the instructions for that choice. If you chose the Node.js application, follow
the instructions in section 3.6; if you chose the IIB application, follow the instructions in section
3.7.
__12. On the Pattern Configuration editor, specify exactly the values shown in the screen capture
below. If you elected to use the IIB application as a substitute for the Node.js application, modify
the port number in each of the three URLs below with the value noted in Appendix B. Then click
Generate in the lower left of the panel and wait until pattern generation is complete.
__13. Select Window > Reset Perspective. In the Reset Perspective window, click Yes.
__14. If you elected to use the Node.js application rather than the IIB application as the web service
provider, start it now. Open a command prompt to the current workspace for the IIB Toolkit (for
example, C:\student10\workspaces\Lab3) then navigate to <pattern instance name>_HTTP-
oneway_sample/webserver. From there, run the start_server.<ext> script appropriate for your
platform; for example, start_server.bat on Windows. The first time you run the command, you
will see the messages preceded with dashes in the screen capture below. The “Listening on port
3000” message indicates that the web service is up and ready.
If you elected to use the IIB application as a web service provider, you should have followed the
instructions in Appendix B so that it is already deployed and running.
__16. With the RecordDistributor message flow still open in a message flow editor, click the red Flow
Exerciser button. If the toolkit presents a Ready to record message panel, select the box for Do
not show this message again then click Close.
__17. In the Integration Nodes view in the Toolkit’s lower left, confirm that the <pattern instance
name>_HTTP one-way application deployed.
__18. Run the flow. In the Application Development view, navigate to Independent Resources >
<pattern instance name>_HTTP-oneway_sample and select the Record1.json file. Right-click
then select Copy to copy the file. Paste the file into the file_to_http_sample directory polled by
the flow’s File Input node. The RecordDistributor flow will read the file, route it based upon the
country value in the JSON, and send the request to the corresponding URL.
__19. Confirm that the web service has received the request sent by the IIB flow. If you are using the
Node.js application, look in the start_server window for the Record Saved message shown below.
If you are using the MockNodeJs IIB application, open the WebService.dat file in the out
subdirectory to see similar output from that web service.
__20. Examine the path that the file data took through the message flow. At the top of the message
flow editor for the RecordDistributor flow, click the View Path icon.
Green highlighting will appear to indicate the path the previous file data took through the flow.
Click the envelope icon on the wire between the File Input and Record Processor nodes.
View the message data in the Recorded Message dialog. In particular, notice the value of the
country field.
Click the envelope icon on the green wire between the Route node and the HTTP Request 0
node. View the data in the new Recorded Message dialog. The Route subflow routed the
message through this path of the flow based upon the value of the country field.
__21. Rerun the RecordDistributor flow with different files. Repeat the prior three steps using the files
Record2.json and Record3.json. Because each of these files has a different country value, they
will take different paths through the flow.
3.5 Summary
This lab has provided an illustration of how to start from, configure, and instantiate a pattern. It has also
illustrated file processing, content-based routing, and file-to-HTTP protocol switching.
__23. In the Downloads section of that webpage, click the link to download the Node.js installer for
your operating system. For example, if you are running 64-bit Windows, click the link indicated
in the screen capture below.
__25. As shown on the Node.js window below, choose to do a complete installation of Node.js.
__26. Follow the remaining screens to complete installation of the Node.js runtime. Upon completion,
click Finish in the window below.
__27. Obtain the project interchange file named MockNodeJs_pi.zip from the IBM person leading
your workshop. Save it to a temporary directory on the machine where your IIB Toolkit runs.
__28. Within the IIB Toolkit workspace, import that project interchange file. Navigate to File > Import >
IBM Integration > Project Interchange and click Next. On the Import Project Interchange
Contents panel, set From zip file: to the full path of the project interchange file and make sure
that the MockNodeJs project is selected. Click Finish.
__30. In the Application Development view in the upper left of the toolkit, select the MockNodeJs
application, right-click, select Deploy, select the default integration server on the Deploy
panel, and click Finish. You should see the MockNodeJs application deployed to the default
integration server.
__31. Use the mqsireportproperties TESTNODE -e default –o HTTPConnector –n port command from
an IBM Integration Console to determine the HTTP listener port (port 7800 in the example
shown).
Make a note of this port number. During pattern generation, you will need to update the pattern’s
three URLs with this port number.
END OF LAB 3
4.1 Introduction
In this lab, you will create a message model from a COBOL Copybook. Then you will use the
DFDL Test Tooling to test parse valid and malformed data files. In the last part of the lab you will
investigate the trace facility.
__1. To start the IBM Integration Toolkit, click the icon shown below:
The following screen is displayed when starting the IBM Integration Toolkit.
You may have already used another workspace for other labs. If so, choose File > Switch
Workspace > Other.
__5. You will see radio buttons to choose “Shared Library” or “Static Library”. For this lab you will use
a shared library.
Click Finish.
__7. In the message model wizard, select COBOL and click Next.
__9. Use the Browse button to set the Application or Library to “MessageModellingLibrary”.
Click Next.
__11. Click the >> button to select all found objects (just one in this case) and click Next.
__12. Leave most of the default values, but select Recognize null values for all fields and Create
value constraints from level 88 VALUE clauses.
Click Next.
__14. The DFDL editor opens with the newly created DFDL message model called PURCHASES.xsd.
__15. Note that the wizard automatically added a file called "CobolDataDefinitionFormat.xsd" under the
Schema Definitions in MessageModellingLibrary.
__16. Expand the Other Resources folder under the MessageModelingLibrary library.
Expand the importFiles folder and you will see the PURCHASES.cpy file that the wizard has
automatically imported.
__18. Switch to the DFDL editor. For the PURCHASES.xsd this shows the string fields, defined as
"PICX_string" by the import wizard:
__19. In the DFDL Editor click the CustomerLastName field to see its properties:
In the properties view, look for the Content section. Note that the field was modeled as "text"
representation, with a fixed (explicit) length of 20 bytes, because the cpy file defined it as a "PIC
X(20)".
__20. In the DFDL Editor, click the PurchaseCount field to see its properties:
This field, which was defined as binary in the copybook file ("PIC 9(3) USAGE COMP"), was
created as "PIC9_Comp_short" by the Import wizard.
You can see the details of this field in the properties view, where its length is set to "2", its length
units to "bytes" and its representation to "binary".
Also, in the "Binary Content" section, its binary number representation is set to binary. This
property can take four different values:
● packed: represented as a packed decimal. Each byte contains 2 decimal digits except for
the least significant byte, which contains a sign in the least significant nibble.
● bcd: represented as a binary coded decimal with 2 digits per byte
● binary: represented as 2' complement for signed types and unsigned binary for unsigned
types
● ibm4690Packed: used by the IBM 4690 retail store devices
Note that it is defined as a decimal field, with text representation and a length of 10 bytes (8
integers and 2 decimal places).
Note that the "Number Representation" is defined as "zoned", with a pattern of 8 integer
numbers and 2 decimal places.
The letter “V” in the Number Pattern is an implied decimal point (common in COBOL copybooks).
__25. Look for the Occurrences section inside the properties view, and expand the Occurs Count
Kind property.
This property, as defined by the DFDL specification, can take different values:
fixed: uses the "maxOccurs" property
expression: uses the value defined by the expression in "occursCount" property
parsed: the number of occurrences is determined by normal speculative parsing
implicit: uses “minOccurs” and “maxOccurs” properties with speculative parsing
In this case, the "OccursCountKind" property is set to "expression", and "occursCount" is set to
point to the "PurchaseCount" element. This means that the number of occurrences of the
"Purchase" repeating structure will be defined by the PurchaseCount element.
This was defined by the Import wizard to reflect the cpy file, which stated:
Also notice that the MinOccurs property is set to "0" and the MaxOccurs property is set to "99",
as the cpy file stated.
__26. Save your message model (PURCHASES.xsd) by pressing Ctrl+S, or File > Save.
__28. In the Parser Input section, select Content from a data file and click Browse.
__29. In the File Selection window, select Select an input file from the file system.
Click Browse.
Click Open.
__33. The DFDL Test perspective will open, with the Test Parse view in focus.
__34. Inspect the Test - Logical Instance view. Navigate through the message tree parsed from the
input file.
Note that the parser shows "10.30" (2 decimal places) because the COBOL field was defined as
PIC 9(8)V99.
__35. In the DFDL Editor, click any element on the message model and you will see the relevant data
underlined in the input text below:
Because it is a binary field, the highlighted value is not readable with this editor.
__37. Now click the Show hex button (top right of the lower pane, as highlighted below).
Note that the binary field is now readable, and has a value of "00 04" which corresponds to the 4
occurrences of the "purchase" element.
In the DFDL Test perspective, "DFDL Test - parse" view, click Browse.
__39. In the File Selection window, select Select an input file from the file system.
Click Browse.
Click OK.
__41. In the Offset textbox, enter "298", and scroll right to find the highlighted character (byte 298 will
be highlighted in blue).
Note that at this position (the "Price" element position) there is a string "MALFORMED!" instead
of the expected decimal number.
Now click the Run parser button to test the message model (green arrow shown below).
__42. An error message will appear with the cause of the failed parsing.
__43. Inspect the DFDL Test - Logical Instance; you will see that the parsed tree is not complete.
Go to the Purchase element, expand it, and check that it was correctly parsed until the "Amount"
element. The following field "Price" is empty.
__44. Now you will use the DFDL Test - Trace view, to better understand the problem.
__45. In the DFDL Test - Trace view, you will find an execution log of the parsing activities.
At the end of the trace, there are colored lines with the found error.
The first line states that it is starting to process the Price element.
In the third, it has found a string "MALFORMED!" as the value of the element.
Then the parser tries to convert the string to a decimal number, and an error appears.
__48. Place the cursor on the error icon and a message will appear, showing the same error displayed
in the trace view.
END OF LAB 4
5.1 Introduction
IBM Integration Bus V10 has enhanced the web browser user interface allowing administration of
Integration Nodes. This has replaced the majority of the admin function that was previously available in
the IB Explorer (IBX). A small amount of function was moved from the IBX to the Integration Toolkit –
Configurable Services, Policy sets.
The web user interface (known in this document as the Web UI) provides the following capabilities:
1.Ability to allow defined web users to perform administration at defined level
2.Ability to perform update actions (such as start and stop) against deployed resources
3.Ability to view trace and log files through the Web UI
4.Ability to view and update Node policy documents
5.Ability to deploy application BAR files
6.Resource statistics
This lab will demonstrate some of these points, while others are the subject of separate labs.
The first part of this lab assumes that security has not been activated for IB10NODE. If security has been
activated on your system, deactivate it now. To verify whether it security is activated, run the command
below in the Integration Console:
mqsireportbroker IB10NODE
To set security off, use the following commands in an Integration Command Console:
mqsistop IB10NODE
mqsistart IB10NODE
__1. One of the first enhancements that you will explore in the new Web UI is the ability to deploy
BAR files. If it is not already open, open the Web User Interface in your Browser.
From the Integration Toolkit, right-click IB10NODE and select Start Web User Interface:
__2. You may see an “untrusted connection error” when the browser opens.
__4. If you have done previous labs, you may already have resources deployed in this server. You
want to deploy fresh copies of the applications to the integration server, so delete any current
resources.
Under the “server1” Integration Server, expand Applications, click to open the context menu
available for the application and select Delete.
__5. Respond Yes when prompted to confirm the delete of the resource.
__9. A message is shown that there are “No configurable properties found” in this shared library. This
means that the shared library that is being deployed does not include any configurable
properties.
__10. Repeat steps 5 and 6. This time select EmployeeService.V10.bar and click Open.
In the Deploy BAR File preview window you will see that the Deploy Preview table has been
populated with properties existing in the BAR file. Note that you need to expand
EmployeeService.appzip to be able to see them.
In the Values column some of the properties show “<unset>”. This means that these properties
could be configured. This will be shown later in the lab.
__11. Repeat the above step and deploy EmployeeService_JSONClient.V10.bar. This time import
from C:\student10\Integration_service_JSONClient\solution folder.
Again, feel free to explore the properties and their values in the deployment table.
Please note that it may take a few seconds to see the updated view while the resources are
being deployed.
You should now have resources on server1 under the Services, Applications and Shared
Libraries categories:
__12. To see which applications or services reference the shared library, expand
EmployeeServiceInterface and then Referenced by. You will see the service and application
that you imported in the previous steps.
__13. The override file for this lab has been created and is provided for you.
__14. In the override file, the properties that will be overridden are specified following the message flow
name that they refer to.
For the URL property in addition to the message flow name, the (HTTP) Node name is specified.
The property names can be seen from the Deploy BAR File window (step 5.2.1.10)
No changes will be made here so close the window once finished viewing the file.
__15. In the Web UI click again on the context menu next to “server1” and then click Deploy.
Click Open.
__17. In the Deploy BAR File window you can see again the content of the BAR file. Expand
EmpServ_JSON_getEmployee.
In the Value column you are presented with the properties that can be configured.
“<unset>” refers to a property that has not been set. You can set the property using an override
file.
You will see two of the properties that were present in the override file.
__18. Scroll down and expand the HTTP Input node properties.
The URLSpecifier is the third property that you will override in the next step.
From the context menu next to “Overrides” click Select overrides file.
__21. To restore the original property values from the BAR file, click the down arrow beside
“Overrides”, click Clear overrides to cancel the deploy.
5.4.1 Administration
__22. You may have noticed in the top right corner of your web browser that you are logged in as a
“Default” user.
__23. Click IB10NODE. In Quick View, you will see that Admin Security is set to “Off”.
In this scenario, the default user has full update access to all deployed broker resources.
If you have enabled the web admin http listener, and security is not active for the node, then any
user will be able to access the Web UI.
__24. In the Servers section, expand server1. Expand the deployed applications and services. You
should see the applications you just deployed in the previous step.
__25. You will see that you can start and stop the services and applications, as well as any defined
server.
__26. Wait for it to show stopped (red down arrow). Notice that you are not able to view any services or
applications. This is similar to the Integration Toolkit when an Integration Server is stopped.
Select the context menu again and select Start. The server will start and show a green up
arrow.
__28. This will open a table with various Integration Node properties. You can change any of the
properties by clicking the button in the far right column of each property.
Click the button in the far right column to change the short description of the Integration Node.
__29. In the dialog box type “Workshop Node” and click OK.
__30. To save any changes that you have made to the Integration Node properties, click Save:
__31. Click server1 and then click the Edit button on the right, to view and edit properties for the
Integration Server:
__32. This will open a table with the Integration Server properties, which you can edit if required:
Previously, users of IBM Integration Bus were able to change these parameters in Integration
Explorer. IBM Integration Bus V10 has removed Integration Explorer, so all the administration is
available in the Web UI tool.
__33. You will not be making any changes here at this time, so when finished exploring click Cancel.
IBM Integration Bus V10 provides the ability to control access to Integration Node resources through the
Web user interface and REST application programming interface (API). All the node administration
functions can be viewed and controlled, as well as all the functionality that in previous IIB releases was
available through IBM Integration Explorer. Different web users can have different access rights across
these functions, and access can be granted, denied or revoked quickly.
IBM Integration Bus V10 allows role-based security to be achieved by using one of two options:
● Security functions based on Integration Bus and WebSphere MQ
● File-based security in IBM Integration Bus
The user has the option to choose how to implement the role-based security, based on their
infrastructure. However, this guide will show the new functionality for IBM Integration Bus V10: enabling
file-based security.
The access authorities are defined against a set of user definitions that represent the available security
roles. A role is a set of security permissions that control access to an integration node and its resources,
and each web user account is associated with a particular role. The permissions are checked to
determine a web user's authorization to perform tasks in the web user interface or the REST API. Each
web user is then defined to use one or more of these security roles.
For the purposes of this lab, you will create several user roles. Then you will create web users and
assign them to one of the defined roles:
1. iibRole1 (for Node administration access, read-only)
2. iibRole2 (for Node administration access, read, write functions)
3. iibRole3 (for Node administration access, all functionality)
__34. Open an Integration Console by double-clicking the desktop shortcut or from the Windows start
menu.
Security can only be activated while the integration node is shut down, so issue the following
command:
mqsistop IB10NODE
When you issue the mqsistop, you will see that the Browser page is greyed with a message
indicating that “Real-time updates are disabled”.
__35. Use the following command to view in the Integration Console the authorization mode and
whether the administration security is active:
mqsireportauthmode IB10NODE
Because the Integration Node has been created using a Queue Manager, its default
authorization mode is ‘mq’.
__36. Turn on the administration security and change the authorization mode with the command:
mqsistart IB10NODE
__37. After a short while, reload the browser page by clicking the reload icon in the address page.
__38. You are now presented with a sign-on screen because security has been activated.
Before you can continue, you must configure security so you are able to sign in.
You will now create administration roles and grant administration authorities to these roles. These will be
referenced by the Integration Bus web user definitions.
Three levels of authorization are supported for IBM Integration Bus administration security: read, write,
and execute. You can assign permissions to a role (user) by specifying the type of permission followed
by a plus (+) to grant permissions, or a minus (-) to revoke permissions.
The following table shows the file-based authorities that are required for different types of users in this
lab guide:
Role Authority
iibRole1 read
__39. Check if there are any roles defined on the Integration Node by running the command:
mqsireportfileauth IB10NODE –l
Response:
Response:
Response:
mqsireportfileauth IB10NODE –l
__44. Define an Integration Bus web user for read-only access. This user will be able to see which
applications are deployed, but will not be able to control the status of these applications.
This command will define a new web user, admin1. The user will have the security profile
defined by the associated role, which in this case will mean that the user can only view the
broker and any deployed applications.
__45. Define an Integration Bus web user for read/write access. This user will be able to see what
applications are deployed, and will have administration privileges to change properties on the
Integration Node and Integration Server.
This command will define a new web user, admin2. The user will have the security profile
defined by the associated role, which in this case will mean that the user will be able to view the
broker and execution groups, and edit their properties. Also, the user will be able to view the
deployed resources.
__46. Define an Integration Bus web user for all access. This user will be able to see what applications
are deployed, and will be able to control completely the resources (start, stop, deploy and
modify).
This command will define a new web user, admin3. The user will have the security profile
defined by the associated role, which in this case will mean that the user will be able to view the
broker and execution groups, and any deployed applications, as well as control their status.
mqsiwebuseradmin IB10NODE –l
Now that security has been configured for Web Admin users, you will log in as the admin1 user, which is
read-only, and see what the browser interface offers for someone who can only view the Integration
Node.
__48. You should have your Firefox web browser window still open with the IBM Integration login page.
Note that the Quick View will now show you that Admin Security is active.
__50. You will see that you are presented with the available servers but you are not able to view any of
the resources.
Although you gave the role iibRole1 “read” authorities, you specified this at a Node level. This
allows more granular approach by authorization for individual servers completed with a separate
command (shown in the next step).
__51. The IIB file-based authorization allows you to change the roles’ permissions without a restart of
the Integration Node—the changes are picked up dynamically.
The Integration Server has been specified with the parameter –e server1, which means that
now you are applying the permissions at the integration server’s level.
__52. Back in the browser, refresh the page and log in again as user admin1.
Note that to the left of “server1” there is now a twistie. If you click on the twistie you will be able
to view the resources in server1.
Expand server1.
__53. You can now view the resources on the Integration Server. Note that although you are able to
expand the server1 resources folders you do not have permission to start, stop or perform other
actions on the deployed artefacts.
__54. Click the arrow to the right of Servers and then click Create:
__55. In the opened dialog box type “admin1server” and click OK:
__56. You will see a message is shown above the Overview tab that the Integration Server cannot be
created. Hover with your mouse over the notification and you will notice that this is a hyperlink,
so click it.
__57. You will see a detailed message, explaining why the attempt has failed:
5.7.2 The Web Admin interface for user with write access
Now that security has been configured for Web Admin users, you will log in as the admin2 user, which is
the “read/write” user. This user has functionality for viewing resources, editing properties for Integration
Node and Integration Server, and for creating Integration servers.
__58. After exploring the facilities for admin1, log out admin1.
Click the pull-down menu next to the “Welcome, admin1” banner and select Log Out.
__60. Expand Servers and you will see that although you can view the available servers, the role to
which admin2 is associated is not authorized for server1.
This is because admin2 has read/write access for IB10NODE, but not for any servers.
This will allow this role to view the resources on server1, create and modify Integration Servers.
__62. In the Web UI, refresh the login for admin2 (press F5 or the refresh button).
You are now able to view the server resources as admin1 but again you are not able to perform
any administration on the resources.
Highlight server1. You will see there is an “Edit” button (which was not available for admin1).
__63. The table with server1’s properties is opened and the user admin2 has authority to change its
settings.
You will not make any changes here, so when finished reviewing, click Cancel.
The user admin2 has the same permissions for changing settings on the IB10NODE.
__64. Click the arrow on the right of “Servers” and then click Create:
__66. Soon, you will see that a new Integration Server has been created. The user admin2 has “write”
authorities, which allows creating a new server on the Integration Node.
However, even though this user has created the Integration Server, the administrator has to
authorize the role to which admin2 is associated to perform any actions on the new server such
as start or stop.
–p read+,write+
This sets the permissions for this role on the admin2server server as read and write.
__68. Refresh the browser window and log in as admin2 again (you may be automatically logged in
after the refresh).
Now, the web user is able to view the newly created server and its resources. Note that no
resources have been deployed at this point.
5.7.3 The Web Admin interface for a user with ‘all’ access
You will now log in as the admin3 web user, which has full authorities. This user has full functionality for
the resources including stop/start deployment of applications and start/stop statistics.
__70. Although admin3 has full authorities for the resources on the node, the administrator still has to
give permissions to the role, to which the web user is aligned for a particular Integration Server.
You may have noticed that now, on the right side of “server1” there is an arrow, which was not
there for admin1 and admin2 web users. Click the arrow.
__73. You will see that a new drop-down menu has opened showing all the administration tasks that
web user admin3 can perform. Click Stop to stop the Integration Server.
__74. After a few seconds you will see that the integration server has stopped, as indicated by a small
red arrow pointing down.
__75. Expand the menu again and click Start to start the Integration Server again. As expected, most
of the available actions have been greyed out because the server is stopped.
__76. When the Integration Server starts, expand the Applications group and then click the twistie
next to the EmployeeService_JSONClient application. From the pull-down menu, click Stop:
__77. The application and all its flows have been stopped, as indicated by red arrows pointing down:
__78. Expand the pull-down menu and click Start to start the application again.
__79. Once the application has started, click EmployeeService_JSONClient. On the right, expand
Advanced Properties and Deployed Properties.
The Quick View panel displays important information about the application such as its name,
UUID, and Run Mode.
In this part of the lab you will explore the administration of MQEndpoint Policy from users with different
permissions based on the roles they have been assigned to.
__81. In the Integration Console, navigate to c:\student10\webadmin\Install and type the following
command:
-f MQEndpointSample.xml
Under IB10NODE, expand Operational Policy > MQEndpoint and click the newly created
policy.
This user has “read-only” permission and is only able to view the defined values.
The values specified have been taken from the policy configuration file.
This user has all permissions and is able to re-configure the policy details and delete the policy.
__84. In the Integration console run the command from step 5.7.4.81, but this time use the flag –i to
specify a user, their password and hostname.
-i tcp:\\admin3:passw0rd@betaworks-esb10 –l admin3_policy
-f MQEndpointSample.xml
__85. In the command console a message will be returned (BIP1921S) notifying you that the node
cannot be reached (if you are using the workshop VMware image supplied).
The reason this message is returned is because on the IB10NODE the SSL has been enabled. If
you would like multiple users to connect to a remote integration node that has SSL enabled on
its web administration port to execute a command, you will need to use .broker file.
This is not subject of this lab. Please refer to IBM Knowledge Center for more information.
Click ActivityLogTemplate:
Remember that web user admin1 was assigned to a role that has only “read” permissions.
Therefore admin1 can only view the Configurable Services but not their details.
Since admin2 web user has “read” and “write” permissions (assigned to the iibRole2), the user is
able to view the Configurable Service template and edit using the Edit button.
In addition, you can see that next to Configurable Services and ActivityLogTemplate there are
arrows.
Note that from the drop-down menu you are able to select and create any configurable service.
The selected type will update its corresponding Properties template.
Save the new configurable service without making any other changes.
__90. You are now able to see the new configurable service that you created. Click the arrow next to it.
You will see that admin2 user has permissions to delete and export the configurable service.
Click Export *.configurableservice.
Now you have the configurable service saved on your file system.
__95. Connect as admin3 (password is “passw0rd”), providing the connection details as below:
Host: betaworks-esb10
Port: 4421
You may see a progress information window to which you may have to respond before
continuing.
__97. You will be presented with a dialog, where you will need to confirm the Trust certificate.
__98. Expand server1 under the remote connection and you will see all the deployed resources.
User admin3 will also have the permissions to deploy resources from the Integration Tookit,
which will not be explored at this time.
__99. Click the newly created connection and then Remove Connection.
__100. After the previous step has been completed, create a new connection by repeating steps 5.8.94
and 5.8.95, only this time user will be admin1. Click Finish.
__101. You will receive an error message saying that the role to which the user is assigned does not
have the required permissions.
Click OK.
__102. In the Integration Nodes view you will see that the remote connection has been created.
However, even though you have connected as a user with “read” permissions, you are not able
to see the resources deployed to server1.
The reason for this restriction is that the Integration Toolkit is designed to “develop and deploy”.
Therefore, the user is not allowed to view resources on a node to which they do not have
permission to deploy.
Note that you may be able to open the Policy Sets editor and make edits, but you will not be able
to save them as admin1 does not have the permission for that.
Once logged in, click the arrow next to server1 and from the menu select Resource statistics
on.
__104. A message will appear once the resource statistics have been turned on.
__105. The data has started being collected and shortly you will see values for the three default
parameters: Initial memory, Used Memory and Committed Memory.
__106. To the right of the graphs there are tables with data about the resource. This is where you can
change the resource shown on the graph.
Click the arrow to view the available resources. The currently displayed resource is highlighted.
Click to the left of each resource and you will see that a different color is assigned to each
resource. Along with that, the selected resources are added color-coded to the graphs above so
you can easily identify the resource and compare it with others.
__108. Hover over any of the graphs with the mouse. You will see that the graphs are highlighted and
the values used to draw them are shown as dots. Placing the mouse over any of the dots will
show its value.
Expand EmployeeService completely and double-click the saved test Employee 000010.
__110. Back in the resource statistics view in the browser you will see that this is reflected in the
captured resource statistics.
__111. As a final step stop the Integration Node and turn off the administration security:
mqsistop IB10NODE
5.10 Summary
This concludes the Web Admin lab. Web users with the required authorization can administer services,
applications and other resources on the Integration Node.
END OF LAB 5
In IBM Integration Bus (IIB) an Integration Service is a specialized application with a defined interface
and structure that acts as a container for a web services solution. The interface is defined through a
WSDL file. The Integration Service Project contains message flows and sub-flows to implement the
specified web service operations and fault handlers. During this lab you will experience the powerful
development features and best-practices provided by the Integration Service Application.
You can create an integration service by using any of the following methods:
● You can create an integration service from scratch
● You can create an integration service by selecting an existing WSDL
● You can create an integration service from a Business Process Manager integration
service
For this lab you will create an integration service by implementing the service interface in the
EmployeeServiceV1 WSDL. Be aware that you can create an integration service by using the “Start from
WSDL” wizard but you must manually create and maintain the structure of the projects and the
organization of the artifacts, and the powerful Integration Service Application development features are
not available. By the end of this lab you will understand the benefits of using an Integration Service
Application.
Like an application, an integration service can reference resources in shared libraries. The shared library
is deployed before or with the integration service. If you update the resources in the shared library and
redeploy it, those changes are immediately available to the deployed integration service. For this lab the
EmployeeServiceV1 WSDL, XSDs and Maps are contained in shared libraries.
When you implement an integration service, you can deploy it to an integration server just like an
application. You can start and stop the deployed service as you would an application.
An operation is a description of an action that is implemented by the service. Each operation can have
either of the following types:
● Request-response type operations mean that a request is sent and a response returned to
the interface.
● One-way type operations mean that only a request is sent, and no response is needed.
Each operation in the interface defines the data that can be passed in the form of inputs to and outputs
from the component when the operation is called. A one-way operation has only an input. A request-
response operation has both an input and output. For this lab, the EmployeeServiceV1 service interface
defines five request-response operations.
You will use the Start by Creating an Integration Service wizard to import the EmployeeServiceV1 WSDL
and create the Integration Service Application project. You will then implement the service interface
operations defined in the EmployeeServiceV1 WSDL, deploy the Integration Service and test the
implementation.
If you plan to perform Lab 7 – Creating a REST API – you will wrap the EmployeeServiceV1 web service
operations with a REST API.
The prebuilt maps used to implement service operations access the DB2 SAMPLE database. These
maps use information from a JDBCProviders Configurable Service to connect with the SAMPLE
database. The Configurable Service can be created at the command-line or using the Web UI. The Web
UI provides Configurable Service import/export functionality using a simple XML file:
If you are currently working in another workspace, select File > Switch Workspace > Other.
C:\student10\workspaces\ServiceInterface.
__3. Expand IBM Integration, select Project Interchange and click Next.
__5. Select the following Project Interchange file and click Open:
C:\student10\ServiceInterface\resource\ServiceInterface_PI.zip
__8. If you have performed other labs as part of the PoT and have deployed resources to the default
Integration Server on the TESTNODE Integration Node you will delete them now so they do not
interfere with this lab.
Right-click the default Integration Server and select Delete > All Flows and Resources:
__9. In the Application Development View expand Independent Resources > BAR files > BARs and
select EmployeeServiceSOAP.bar. Drag and drop the EmployeeServiceSOAP.bar BAR file
to the default Integration Server on the TESTNODE Integration Node.
__10. You should see the following libraries and service interfaces deployed to the default Integration
Server:
● EmployeeServiceSOAP_Lib
● EmployeeServiceSOAPMaps_Lib
The IIB Start by Creating an Integration Service wizard will be used to create the Integration Service
Application Project. You will then use the development features of the Integration Service Application to
implement the service interface.
Although implementing a service interface could be done in previous IIB versions, the project’s many
development artifacts had to be built manually. Using the Integration Service wizard and project
eliminates a large number of development tasks and allows the developer to focus on implementing the
service interface.
In this lab you will implement five of the operations defined in the EmployeeServiceV1.wsdl document.
These operations will implemented by using existing maps that access the DB2 SAMPLE database; this
allows the lab to focus on the service interface development process.
You will implement the following operations defined in the EmployeeServiceV1 WSDL document:
● getDepartment – get details for a specific department
● getDepartmentEmployees – get all employees for a specific department
● getEmployee – get details for a specific employee
● getEmployeeDepartment – get department details for a specific employee
● predictSalary -- get predicted salary for a specific education level
__11. In the Application Development view, select New > Start By Creating an Integration Service
__12. Enter “EmployeeService_SOAP” for the name, select Implement an interface already
specified in an existing WSDL file and Use an existing WSDL in shared library, then click
Next.
__15. Observe the Integration Service project structure and the Integration Service description. Note
the five operations that will be implemented:
__16. Right-click the EmployeeService_SOAP Integration Service Application and select Manage
Library References:
__18. In the EmployeeService_SOAP Integration Service Definition, click the Interface tab to display
the service interface that you will implement:
__20. The input request message contains a single element named “deptNumber”. Click the X to close
the schema:
__21. To view its input, click employees_Type, and when the type selection drop-down list appears
right-click and select Open in XSD Editor:
__22. Observe that the “employees_type” can contain multiple employee_type elements. Click the X to
close the schema:
__23. Be aware that the Interface tab is for design and you can modify the service interface by adding
new operations or modifying existing operations. You will not be modifying the service interface
during this lab; rather, you will be implementing the service interface which is done on the
Service tab. Select the Service tab to start implementing the service interface:
__24. You will now implement the getDepartment operation. In the Integration Service view click the
getDepartment operation to open the getDepartment_request_response sub-flow:
__26. You will now add a mapping node that will perform the database query for the operation
implementation. In the Message Flow Editor, expand the Transformation node category, select
the Mapping node and drop it between the Input and Output nodes. Rename the node
“getDepartment”:
__27. Highlight the getDepartment node. In the Properties View, select the Basic tab and click
Browse for the Mapping routine* property:
__29. Double-click the getDepartment node to open the map. Click the icon in the upper-right corner
of the Select from SAMPLE source to open the database select dialog:
Here the query is being performed on the DEPARTMENT table. The WHERE clause was
generated by selecting columns from the table, elements from the Input and Operators:
__30. Expand SOAP_Domain_Msg > Body in the output. Observe that the output body can contain
either a fault or a getDepartmentResponse message; this allows the map to create a
getDepartmentResponse if a valid result set is returned from the select, or a fault if an empty
result set is returned or a database error occurs. Click the arrow icon in the upper-right corner
of the Local map transformation to view the mapping of the result set to the SOAP Body:
__31. Observe the “Failure” transform maps to a “Fault” message and the “Select” transform maps to a
“Fault” and a “getDepartmentResponse” message. The “Select” transform will generate a “Fault”
message if an empty result set is returned. The “Failure” transform will automatically handle any
database errors that occur. Click the arrow icon in the upper-right corner of the Select
transform to view the map:
__32. You can view the “If” transform’s condition by hovering the mouse pointer over the yellow
diamond icon to the left. If the result set contains data then a “getDepartmentResponse”
message is mapped; otherwise a “Fault” message is mapped. Click the yellow arrow in the
upper-right of the map to return to the parent map:
__33. Click the arrow icon in the upper-right of the Failure transform to view the map:
__34. Observe the database error information that is returned and the mapping to the Fault message.
Click the yellow arrow icon in the upper-right of the map to return to the parent map:
All of the other maps function in the same manner except the map for the predictSalary
operation, which is a sequence of IF, ELSE IF statements that returns a salary for ranges of
education levels. You can observe the other maps as you implement other operations if you like.
__35. Close the getDepartmentMap map by clicking the X in the getDepartmentMap tab:
__36. Connect the Out terminal of the Input node to the In terminal of the getDepartment node.
Connect the Out terminal of the getDepartment node to the In terminal of the Output node.
Enter CTRL+S to save the getDepartment sub-flow:
__37. You will now implement the “getDepartmentEmployees” operation. Click the arrow to the right of
EmployeeService_SOAP to list the service interface operations. Select
getDepartmentEmployees:
__39. You will now add a mapping node that will perform the database query for the operation
implementation. In the Message Flow Editor, expand the Transformation node category, select
the Mapping node and drop it between the Input and Output nodes. Rename the node
“getDepartmentEmployees”:
__40. Highlight the getDepartmentEmployees node. In the Properties View select the Basic tab and
click Browse for the Mapping routine* property:
__42. Connect the Out terminal of the Input node to the In terminal of the getDepartmentEmployees
node. Connect the Out terminal of the getDepartmentEmployees node to the In terminal of the
Output node. Enter CTRL+S to save the getDepartmentEmployees sub-flow:
__43. You will now implement the getEmployee operation. Click the arrow to the right of
EmployeeService_SOAP to list the service interface operations. Select getEmployee:
__44. Observe that the “getEmployee_Request_Response.sub-flow” has been created and opened in
the message flow editor. This sub-flow implements the “getEmployee” operation:
__45. You will now add a mapping node that will perform the database query for the operation
implementation. In the Message Flow Editor, expand the Transformation node category, select
the Mapping node and drop it between the Input and Output nodes. Rename the node
“getEmployee”:
__46. Highlight the getEmployee node. In the Properties View select the Basic tab and click Browse
for the Mapping routine* property:
__48. Connect the Out terminal of the Input node to the In terminal of the getEmployee node.
Connect the Out terminal of the getEmployee node to the In terminal of the Output node. Enter
CTRL+S to save the getEmployee sub-flow:
__49. You will now implement the “getEmployeeDepartment” operation. Click the arrow to the right of
EmployeeService_SOAP to list the service interface operations. Select
getEmployeeDepartment:
__51. You will now add a mapping node that will perform the database query for the operation
implementation. In the Message Flow Editor, expand the Transformation node category, select
the Mapping node and drop it between the Input and Output nodes. Rename the node
“getEmployeeDepartment”:
__52. Highlight the getEmployeeDepartment node. In the Properties View, select the Basic tab and
click Browse for the Mapping routine* property:
__54. Connect the Out terminal of the Input node to the In terminal of the getEmployeeDepartment
node. Connect the Out terminal of the getEmployeeDepartment node to the In terminal of the
Output node. Enter CTRL+S to save the getEmployeeDepartment sub-flow:
__55. You will now implement the “predictSalary” operation. Click the arrow to the right of
EmployeeService_SOAP to list the service interface operations. Select predictSalary:
__56. Observe that the “predictSalary_Request_Response.sub-flow” has been created and opened in
the message flow editor. This sub-flow implements the predictSalary operation:
__57. You will now add a mapping node that will perform the database query for the operation
implementation. In the Message Flow Editor, expand the Transformation node category, select
the Mapping node and drop it between the Input and Output nodes. Rename the node
“predictSalary”:
__58. Highlight the predictSalary node. In the Properties View, select the Basic tab and click Browse
for the Mapping routine* property:
__60. Connect the Out terminal of the Input node to the In terminal of the predictSalary node.
Connect the Out terminal of the predictSalary node to the In terminal of the Output node. Enter
CTRL+S to save the predictSalary sub-flow:
__61. You will now implement a “Catch Handler” for the integration service. Click
EmployeeService_SOAP to display the service interface operations and handlers:
__62. Observe that the “EmployeeService_SOAP_Catch.sub-flow” has been created and opened in
the message flow editor. This sub-flow implements a Catch Handler that will handle exceptions
that occur during message flow processing:
__63. You will now add a mapping node that will generate a SOAP Fault for exceptions that occur
during message flow processing. In the Message Flow Editor, expand the Transformation node
category, select the Mapping node and drop it between the Input and Output nodes. Rename
the node “catchHandler”:
__64. Highlight the catchHandler node. In the Properties View, select the Basic tab and click Browse
for the Mapping routine* property:
__66. Connect the Out terminal of the Input node to the In terminal of the catchHandler node.
Connect the Out terminal of the catchHandler node to the In terminal of the Output node. Enter
CTRL+S to save the Catch Handler sub-flow:
__67. You’ve completed implementing the “EmployeeService_SOAP” service interface, but you might
be wondering -- where is the message flow? Up to this point you’ve only worked with sub-flows
that implemented the service interface operations and catch handler, but you have not seen the
main message flow with a SOAPInput and SOAPReploy nodes.
Expand EmployeeService_SOAP > Resources > Flows > gen to find the main flow:
EmployeeService_SOAP.msgflow:
Right-click EmployeeService_SOAP.msgflow and select Open With > Message Flow Editor
to open the flow in the message flow editor:
__68. Observe the main flow in the message flow editor. Note the warning about modifying the
message flow. Also note that the Flow Exerciser is not accessible from the message flow; it is
only accessible from the Integration Service Definition. Click the X to close the
EmployeeService_SOAP message flow:
You will not manually deploy the EmployeeService_SOAP Integration Service for this lab, rather the Flow
Exerciser will automatically package and deploy the Integration Service when it is started in the next
section of the lab (Testing the EmployeeService_SOAP Integration Service).
In this section you will use the IIB V10 Flow Exerciser to deploy and test the EmployeeService_SOAP
Integration Service.
__69. In the EmployeeService_SOAP integration service editor, click the red Start Flow Exerciser
button in the upper-right corner:
Note: Starting the Flow Exerciser will deploy the EmployeeService_SOAP Integration Service
Application.
__70. Note that you will use the “Send Message” button to send SOAP requests to the web service.
Click Close:
__71. You will now test the “getDepartment” operation. Click the Send Message button in the upper-
right corner:
__73. Select the getDepartment operation. Enter “getDepartment” for the name. Enter “C01” for
deptNumber. Click Apply.
__75. Observe that the request was sent and a response was received:
__76. Click the envelope between SOAP/HTTP Binding and getDepartment to view the request
message that was received. Note that the SOAP Envelope has been removed. Click the X in the
Recorded Message window to close it:
Note: All components of the Message Assembly are available for inspection.
__78. Click the envelope between the getDepartment and Output nodes to view the response
message that will be sent. Note that the message contains a SOAP envelope. Click the X in the
upper-right corner of the Recorded Message window:
__79. Click the Send Message button to send another request message:
__80. Select the getDepartment message. Change the value of deptNumber to “C09” and click Send:
__81. Observe that an error has occurred—the getDepartment operation has returned a SOAP Fault
because no “C09” department was found. Click Error sending message to SOAP Input to
view the fault message. Click Close:
__82. Click the Send Message button to send another request message:
__83. Select the getDepartment” message. Change the value of deptNumber to “C099” and click
Send:
__84. Observe that an error has occurred. A database failure has occurred because “C099” has
exceeded the length of the DEPTNO column in the DEPARTMENT table. Click Error sending
message to SOAP Input to view the fault message. Click Close:
__85. Click the Send Message button to send a request message to the getDepartmentEmployees
operation:
__86. Click the New Message button to create a getDepartmentEmployees request message:
__87. Enter “getDepartmentEmployees” for the name. Select getDepartmentEmployees from the
SOAP operation drop-down list. Enter “C01” for deptNumber. Click Apply:
__89. Observe that a request message was sent and a response message was successfully received.
Click Received HTTP Reply message for SOAP Input to view the response message. Click
Close:
You can try other deptNumber values such as “C09” and “C099” to validate that faults are
correctly generated.
__90. Click the Send Message button to send a request message to the getEmployee operation:
__91. Click the New Message button to create a getEmployee request message:
__92. Enter “getEmployee” for the name. Select getEmployee from the SOAP operation drop-down
list. Enter “000060” for employeeNumber. Click Apply:
__94. Observe that a request message was sent and a response message was successfully received.
Click Received HTTP Reply message for SOAP Input to view the response message. Click
Close:
You can try other deptNumber values such as “000066” (empty result set) and “0000666”
(column length exceeded) to validate that faults are correctly generated.
__95. Click the Send Message button to send a request message to the getEmployeeDepartment
operation:
__96. Click the New Message button to create a getEmployeeDepartment request message:
__97. Enter “getEmployeeDepartment” for the name. Select getEmployeeDepartment from the
SOAP operation drop-down list. Enter “000060” for employeeNumber. Click Apply:
__99. Observe that a request message was sent and a response message was successfully received.
Click Received HTTP Reply message for SOAP Input to view the response message. Click
Close:
You can try other employeeNumber values such as “000066” (empty result set) and “0000666”
(column length exceeded) to validate that faults are correctly generated.
__100. Click the Send Message button to send a request message to the predictSalary operation:
__101. Click the New Message button to create a predictSalary request message:
__102. Enter “predictSalary” for the name. Select predictSalary from the SOAP operation drop-down
list. Enter “16” for educationLevel. Click Apply:
__104. Observe that a request message was sent and a response message was successfully received.
Click Received HTTP Reply message for SOAP Input to view the response message. Click
Close:
__105. You can try other educationLevel values such as “8” (education level too low) and “22”
(education level too high) to validate that faults are correctly generated.
__106. Click the X in the EmployeeService_SOAP tab to close the service interface editor:
__107. In the Integration Nodes view, right-click TESTNODE and select Start Web User Interface:
__108. Expand Servers > default > Services > EmployeeService to observe the
EmployeeService_SOAP integration service:
__109. Click the EmployeeService_SOAP drop-down arrow to observe the actions that can be taken.
Note that Save Interface File will provide the EmployeeServiceV1 WSDL and XSD files
packaged in a zip file:
__110. Click the gen.EmployeeService_SOAP.msgflow drop-down list to observe the actions that can
be taken. Note that Attach Policy is where a Workload Management Policy would be applied to
the EmployeeService_SOAP Integration Service:
6.7 Summary
During the “Implementing a service interface” lab the Start by Creating an Integration Service wizard was
used to import the EmployeeServiceV1 WSDL document and create an Integration Service Application
project. You observed the structure, organization and contents of the Integration Service Application and
how it offers IIB design and implementation best practices.
You used the interface view to observe the defined service interface and investigated the schemas for an
input and output.
You used the Integration Service Application tooling to quickly implement five operations and a catch
handler.
The new V10 Flow Exerciser was used to deploy the EmployeeService_SOAP integration service and
test its operations.
The Web User Interface was used to observe the deployed EmployeeService_SOAP integration service
and the administration and operations functions that are available.
END OF LAB 6
IIB V10 has introduced a new type of project, or container, called a REST API. A REST API in IBM
Integration Bus is a specialized application that allows you to expose a set of resources as a RESTful
web service.
To create a REST API in IBM Integration Bus, you must first define the resources and operations that are
available in the new REST API. Those definitions must be specified in a Swagger document, an open
specification for defining REST APIs.
To create a REST API in IBM Integration Bus, you use the Create a REST API wizard in the IBM
Integration Toolkit to import a Swagger document. You must then create the REST API sub-flowsub-
flowssub-flows and other project artifacts that are required to implement and deploy the new REST API.
The REST API container automatically takes care of the routing of inbound HTTP requests to the correct
sub-flow for the operation being called and processing of input parameters.
You simply need to connect the dots between the Input and Output nodes in each operation’s sub-flow!
Catch, Failure and Timeout handlers are implemented as sub-flowsub-flows as well; IIB handles the
HTTP response code automatically.
REST APIs support all of the Integration Bus features that you can use with applications (such as shared
libraries, monitoring, activity log), and all message flow nodes can be used within a REST API.
A REST API application is deployed like existing applications. There are new artifacts, such as the
Swagger JSON document, but IIB handles these automatically and you simply drag and drop the REST
API application to deploy it from the Toolkit.
All administrative and operational controls that are available for applications in IIB are also available for
REST API applications, this includes command-line programs. The IIB Web UI has been extended to
provide information about resources, operations and parameters that are available in a deployed REST
API application.
During this lab you will explore a Swagger JSON document that defines the EmployeeServiceV1 REST
API, use the Create a REST API wizard to import the document and then implement five of the
operations defined in the EmployeeServiceV1 REST API. You will then deploy and test the
EmployeeServiceV1 REST API.
The REST API lab requires the EmployeeService SOAP web service that was implemented and
deployed in Lab 6, “Implementing a service interface”. If you performed the “Implementing a service
interface” lab prior to performing this lab you will have the necessary projects in your workspace and the
EmployeeService_SOAP Integration Service will be deployed on the default Integration Service on the
TESTNODE Integration Node. If you did not perform the “Implementing a service interface” lab prior to
this lab then follow the instructions in the following sections to import the necessary projects to your
workspace and deploy the necessary artifacts to the default Integration Server.
Support for REST requires the use of the embedded HTTP listeners, rather than the node-wide listener.
Additionally, the IIB node has to be configured for Cross-Origin Resource Sharing (CORS). For details on
this, please read: http://www.w3.org/TR/cors/.
Cross-Origin Resource Scripting for REST is required when testing with the SwaggerUI test tool. See
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing for further information. The following
command enables CORS for the default Integration Server on TESTNODE:
For lab execution consistency the default Integration Sever has been configured to explicitly use port
7800 for its embedded listener. The following command explicitly sets the embedded listener’s port
number:
Since you have not completed the “Implementing a service interface” lab as part of the PoT then
you must import the “Implementing a service interface” projects into your workspace along with
the REST API projects. You must deploy the “Implementing a service interface” libraries to the
default Integration Server on the TESTNODE Integration Node.
__3. Expand IBM Integration, select Project Interchange and click Next.
__5. Select the following Project Interchange file and click Open:
C:\student10\REST_service\resource\RESTApi_Start_PI.zip
__6. If you completed the “Implementing a service interface” lab as part of the PoT then select the
following projects and click Finish:
BAR files
EmployeeServiceJSONMaps_Lib
JSONSchemas_Lib
__7. If you did not complete the “Implementing a service interface” lab as part of the PoT select the
following projects and click Finish:
BAR files
EmployeeServiceJSONMaps_Lib
EmployeeServiceSOAP_Lib
EmployeeServiceSOAPMaps_Lib
EmployeeService_SOAP
JSONSchemas_Lib
SAMPE_DDPrj
__8. If you did not complete the “Implementing a service interface” lab as a part of the PoT then in the
Application Development view expand Independent Resources > BAR files > BARs and select
EmployeeServiceSOAP.bar. Drag and drop the EmployeeServiceSOAP.bar BAR file to the
default Integration Server on the TESTNODE Integration Node:
__9. You should see the following libraries and service interfaces deployed to the default Integration
Server:
EmployeeService_SOAP
EmployeeServiceSOAP_Lib
EmployeeServiceSOAPMaps_Lib
__10. In the Application Development view, expand Independent Resources > BAR files > BARs
and select EmployeeServiceREST.bar. Drag and drop the EmployeeServiceREST.bar BAR
file to the default Integration Server on the TESTNODE Integration Node:
__11. You should see the following libraries and service interfaces deployed on the default Integration
Server:
EmployeeService_SOAP
EmployeeServiceJSONMaps_Lib
EmployeeServiceSOAP_Lib
EmployeeServiceSOAPMaps_Lib
JSONSchemas_Lib
You will first use the Notepad++ editor to view the raw JSON file and then you will use the Swagger
editor to view the REST API defined in the EmployeeServiceV1.json file in a human-readable mark up
and explore some of its powerful editing capabilities. You will also explore the definition of an API
operation and the message models it utilizes.
__14. At the beginning of the document you will see the “title” (Employee Service) of the REST API and
the “basePath” (/EmployeeService/v1). All operations defined in this REST API will start with this
base path.
The API operations are defined under “paths”. Observe the “/departments” resource. The URL
for this operation is “/EmployeeService/v1/departments”, and the GET HTTP method is
supported. The “description” states that this operation returns a list of all departments.
Observe that this operation does not accept any parameters or input.
Under “responses”, observe that a Departments object is returned for HTTP 200 return codes.
__15. Scroll to line 594 in the file to find the Departments schema:
Observe that the schemas are contained under “definitions”, and that Departments is a JSON
array of Department items. Also observe that a Department contains four elements
(departmentNumber, admrdept, name and location) and all elements other than admrdept are
required.
Close Notepad++.
Swagger is more than just a way to describe REST APIs; it is also a powerful set of tools including an
editor (Swagger editor) and UI (swagger-ui). The Swagger editor will be explored in this section of the
lab. Swagger-ui will be explored during the test portion of this lab.
__16. Open an IIB command console using the shortcut located on the desktop:
npm start
The Swagger editor will take a few minutes to build. You can observe the progress in the
command window:
__19. When complete the Swagger editor will open in Firefox with an introductory window. Close the
window.
__21. You will now open the EmployeeServiceV1.json document. Click the File menu item and select
Import File:
__25. Move the mouse pointer by the Paths field and “List all paths” will be displayed. Click List all
paths to collapse all operations and display the defined paths:
Observe that the operations are grouped by tags – “employees” and “departments” – paths
associated with a tag are displayed by clicking the tag. Clicking a path in the right pane will
expand the YAML markup in the editor. Clicking the arrow to the right of a path will jump to the
specific YAML markup in the editor.
__26. Explore the /department path. Click the /department path in the right pane:
Observe that the associated YAML code is expanded in the editor in the left pane.
The operation accepts one required input parameter – “departmentNumber” -- that is a “query”
parameter. This parameter is appended to the operation URL:
__27. Click the /department path to collapse the content and then click the /employees/predictSalary
path to expand it:
The operation accepts one required parameter via an HTTP header – Educationlevel:
__28. Click the /employees/predictSalary path to collapse its content. Hover the mouse pointer by
the MODELS field and then click List all models:
__29. Observe all of the JSON objects that are defined for the REST API.
__30. Click the Departments model and observe the associated YAML code is expanded:
Observe the definition of these objects and arrays in the document. Later in the lab you will
utilize XML Schemas and the Graphical Data Mapper to map these message models.
__31. Editing the YAML code with the editor is beyond the scope of this introductory IIB lab. There are
numerous templates and examples to illustrate how to create a Swagger document.
Note that the Swagger editor supports content assist, like the Integration Toolkit, which is a
powerful ease-of-use feature for creating Swagger documents.
Place the pointer at the end of “definitions:” in the document, then enter CTRL+SPACE.
Observe the selection of completions that apply to the current context:
Enter CTRL+C in the IIB command console from which the Swagger editor was started.
The new IIB v10 REST API wizard will be used to implement the EmployeeService REST API. You will
also use the new REST API project which contains and organizes the API assets in a context that makes
implementation easy and structured while applying IIB design and development best practices.
Although a REST API service could be built in previous IIB versions, many artifacts had to be built
manually. Using the REST API wizard and project eliminates a large number of development tasks and
allows the developer to focus on implementing the service interface.
In this lab you will implement five of the operations defined in the EmployeeServiceV1.json Swagger
document. These operations will wrap operations that are implemented by the EmployeeService SOAP
web service. If you performed the “Implementing a service interface” lab you are familiar with this web
service.
Each operation requires two maps – SOAP Request, SOAP Response – that have been pre-built to allow
the lab to focus on the REST API development process. You will explore a few of these maps to observe
how REST input parameters, JSON objects and arrays are mapped.
The REST API wizard does not generate schemas for models defined in the Swagger document, but as
an alternative, XML schemas can be defined to model JSON objects and arrays. The models in the
EmployeeServiceV1.json Swagger document are defined by the schemas in the JSONSchemas_Lib
Library. This allows powerful GUI mapping for the REST API implementation.
You will implement the following operations defined in the EmployeeServiceV1.json Swagger document:
● getDepartment (query parameter, returns JSON object)
● getDepartmentEmployees (path parameter, returns JSON array)
● getEmployee (path parameter, returns JSON object)
● getEmployeeDepartment (path parameter, returns JSON object)
● predictSalary (header parameter, returns JSON object)
__34. In the Application Development view, select New > Start By Creating a REST API.
__38. Click Next to see a list of the operations that are defined in the Swagger document:
__39. Observe the operations that are defined. The highlighted operations will be implemented in this
lab. Click Finish:
__40. Observe the REST API Project is created and the REST API Description is open.
Note the list of operations that are defined for the REST API and the Error Handling handlers
that have been created. You will implement the Catch error handler during this lab.
__43. You will now implement the getDepartment operation. Expand the /department path under
Operations. Click Implement the operation for the getDepartment operation:
__45. The getDepartment REST operation will access the EmployeeService SOAP web service for the
implementation. To make a SOAP request to the EmployeeService web service, expand
EmployeeServiceSOAP_Lib > WSDL Definitions >
http://www.example.org/EmployeeServiceV1, select EmployeeServiceV1.wsdl and drag and
drop it in the getDepartment sub-flow between the Input and Output nodes:
__46. Select Invoke web service from message flow, check getDepartment(getDepartment) and
click Finish:
__48. The sub-flow contains a SOAPExtract node to remove the SOAP Envelope from the web service
response. The map for the REST API response accepts a SOAP Envelope so it can handle
valid responses and SOAP Faults, so the SOAPExtract node must be removed from the sub-
flow. Right-click the Extract node and select Delete.
__49. Connect the Out terminal of the Request node to the In terminal of the
getDepartmentResponse node:
__51. You will now add a mapping node to map the REST request to the SOAP request. Expand the
Transformation node category, select the Mapping node and left-click in the getDepartment
sub-flow between the Input and getDepartment_EmployeeServiceV1 nodes. Rename the node
to “getDepartmentRequest”:
__52. Highlight the getDepartmentRequest node and select the Basic properties page. Click the
Browse button for the Mapping routine* property:
Click the Move transform; this will expand the LocalEnvironment tree and show the REST API
parameter mapping. Here you see that the “departmentNumber” “User Defined Type” was
added to “LocalEnvironment/REST/Input/Pararmeters/any”. Note, the name added here must
match the parameter name in the Swagger document exactly:
__55. You will now add a mapping node to map the web service SOAP response to the REST
response. Expand the Transform node category, select the Mapping node and left-click in the
sub-flow between the getDepartment_EmployeeServiceV1 and Output nodes. Rename the node
“getDepartmentResponse”.
__56. Highlight the getDepartmentResponse node, select the Basic properties tab and click the
Browse button for the Mapping routine* properties:
__58. Wire the Out terminal of the Input node to the In terminal of the getDepartmenRequest node.
Wire the Out terminal of the getDepartmentRequest node to the In terminal of the
getDepartment_EmployeeServiceV1 node.
Wire the Out terminal of the getDepartmentResponse node to the In terminal of the Output
node.
__59. Enter CTRL+S to save the getDepartment sub-flow. Click the X on the getDepartment.sub-flow
tab to close the sub-flow:
__62. The getDepartmentEmployees REST operation will access the EmployeeService SOAP web
service for the implementation. To make a SOAP request to the EmployeeService web service,
expand EmployeeServiceSOAP_Lib > WSDL Definitions >
http://www.example.org/EmployeeServiceV1, select EmployeeServiceV1.wsdl and drag and
drop it in the getDepartmentEmployees sub-flow between the Input and Output nodes:
__65. The sub-flow contains a SOAPExtract node to remove the SOAP Envelope from the web service
response. The map for the REST API response accepts a SOAP Envelope so it can handle
valid responses and SOAP Faults, so the SOAPExtract node must be removed from the sub-
flow. Right-click the Extract node and select Delete.
__66. Connect the Out terminal of the Request node to the In terminal of the
getDepartmentEmployeesRepsonse node:
__68. You will now add a mapping node to map the REST request to the SOAP request. Expand the
Transformation node category, select the Mapping node and left-click in the
getDepartmentEmployees sub-flow between the Input and
getDepartmentEmployees_EmployeeServiceV1 nodes. Rename the node to
“getDepartmentEmployeesRequest”:
__69. Highlight the getDepartmentEmployeesRequest node and select the Basic properties page.
Click the Browse button for the Mapping routine* property:
__71. You will now add a mapping node to map the web service SOAP response to the REST
response. Expand the Transform node category, select the Mapping node and left-click in the
sub-flow between the getDepartmentEmployees_EmployeeServiceV1 and Output nodes.
Rename the node “getDepartmentEmployeesResponse”.
__72. Highlight the getDepartmentEmployeesResponse node, select the Basic properties tab and
click the Browse button for the Mapping routine* property:
Observe the map source is a SOAP Domain message where the Body of the SOAP Envelope
has been cast to a “getDepartmentEmployeesResponse” type and a “fault” type. This allows the
operation to easily handle valid and fault responses from the web service. If a
getDepartmentEmployeesResponse message is received an “Employees” JSON array is
returned. If a fault message is received an “error” object is returned.
Observe that the map output uses the JSON parser. The “EmployeeServiceV1” Swagger
document defines that the “getDepartmentEmployees” operation returns an “Employees” JSON
array. While the “Employees” model is defined in the Swagger document the current tooling
does not generate JSON schemas that can be used by the Graphical Data Mapper. An
alternative is to use XML schemas to implement the JSON schemas that are defined in the
Swagger document. The schemas in the JSONSchemas_Lib library implement all of the models
in the Swagger document and are used in all of the JSON mappings.
Note that the “any” element under JSON/Data has been cast to an “Employees” type and a User
Defined type of error has been added. This allows the operation to return either a JSON array of
“Employees” or an “error” object, and offers easy GUI mapping of JSON objects and arrays:
__75. Wire the Out terminal of the Input node to the In terminal of the
getDepartmenEmployeesRequest node.
Wire the Out terminal of the getDepartmentEmployeesRequest node to the In terminal of the
getDepartmentEmployees_EmployeeServiceV1 node.
Wire the Out terminal of the getDepartmentEmployeesResponse node to the In terminal of the
Output node.
__76. Enter CTRL+S to save the getDepartmentEmployees sub-flow. Click the X on the
getDepartmentEmployees.sub-flow tab to close the sub-flow:
__79. The getEmployee REST operation will access the EmployeeService SOAP web service for the
implementation. To make a SOAP request to the EmployeeService web service, expand
EmployeeServiceSOAP_Lib > WSDL Definitions >
http://www.example.org/EmployeeServiceV1, select EmployeeServiceV1.wsdl and drag and
drop it in the getEmployee sub-flow between the Input and Output nodes:
__80. Select Invoke web service from message flow, check getEmployee(getEmployee) and click
Finish:
__82. The sub-flow contains a SOAPExtract node to remove the SOAP Envelope from the web service
response. The map for the REST API response accepts a SOAP Envelope so it can handle
valid responses and SOAP Faults, so the SOAPExtract node must be removed from the sub-
flow. Right-click the Extract node and select Delete.
__83. Connect the Out terminal of the Request node to the In terminal of the getEmployeeRepsonse
node:
__85. You will now add a mapping node to map the REST request to the SOAP request. Expand the
Transformation node category, select the Mapping node and left-click in the getEmployee
sub-flow between the Input and getEmployee_EmployeeServiceV1 nodes. Rename the node to
“getEmployeeRequest”:
__86. Highlight the getEmployeeRequest node and select the Basic properties page. Click the
Browse button for the Mapping routine* property:
__88. You will now add a mapping node to map the web service SOAP response to the REST
response. Expand the Transform node category, select the Mapping node and left-click in the
sub-flow between the getEmployee_EmployeeServiceV1 and Output nodes. Rename the node
“getEmployeeResponse”.
__89. Highlight the getEmployeeResponse node, select the Basic properties tab and click the
Browse button for the Mapping routine* properties:
__91. Wire the Out terminal of the Input node to the In terminal of the getEmployeeRequest node.
Wire the Out terminal of the getEmployeeRequest node to the In terminal of the
getEmployee_EmployeeServiceV1 node.
Wire the fault terminal of the getEmployee_EmployeeServiceV1 node to the In terminal of the
getEmployeeResponse node.
Wire the Out terminal of the getEmployeeResponse node to the In terminal of the Output node.
__92. Enter CTRL+S to save the getEmployee sub-flow. Click the X on the getEmployee.sub-flow tab
to close the sub-flow:
__95. The getEmployeeDepartment REST operation will access the EmployeeService SOAP web
service for the implementation. To make a SOAP request to the EmployeeService web service,
expand EmployeeServiceSOAP_Lib > WSDL Definitions >
http://www.example.org/EmployeeServiceV1, select EmployeeServiceV1.wsdl and drag and
drop it in the getEmployeeDepartment sub-flow between the Input and Output nodes:
__98. The sub-flow contains a SOAPExtract node to remove the SOAP Envelope from the web service
response. The map for the REST API response accepts a SOAP Envelope so it can handle
valid responses and SOAP Faults, so the SOAPExtract node must be removed from the sub-
flow. Right-click the Extract node and select Delete.
__99. Connect the Out terminal of the Request node to the In terminal of the
getEmployeeDepartmentRepsonse node:
__101. You will now add a mapping node to map the REST request to the SOAP request. Expand the
Transformation node category, select the Mapping node and left-click in the
getEmployeeDepartment sub-flow between the Input and
getEmployeeDepartment_EmployeeServiceV1 nodes. Rename the node to
“getEmployeeDepartmentRequest”:
__102. Highlight the getEmployeeDepartmentRequest node and select the Basic properties page.
Click the Browse button for the Mapping routine* property:
__104. You will now add a mapping node to map the web service SOAP response to the REST
response. Expand the Transform node category, select the Mapping node and left-click in the
sub-flow between the getEmployeeDepartment_EmployeeServiceV1 and Output nodes.
Rename the node “getEmployeeDepartmentResponse”.
__105. Highlight the getEmployeeDepartmentResponse node, select the Basic properties tab and
click the Browse button for the Mapping routine* property:
__107. Wire the Out terminal of the Input node to the In terminal of the
getEmployeeDepartmenRequest node.
Wire the Out terminal of the getEmployeeDepartmentRequest node to the In terminal of the
getEmployeeDepartment_EmployeeServiceV1 node.
Wire the Out terminal of the getEmployeeDepartmentResponse node to the In terminal of the
Output node.
__108. Enter CTRL+S to save the getEmployeeDepartment sub-flow. Click the X on the
getEmployeeDepartment.sub-flow tab to close the sub-flow:
__111. The predictSalary REST operation will access the EmployeeService SOAP web service for the
implementation. To make a SOAP request to the EmployeeService web service, expand
EmployeeServiceSOAP_Lib > WSDL Definitions >
http://www.example.org/EmployeeServiceV1, select EmployeeServiceV1.wsdl and drag and
drop it in the predictSalary sub-flow between the Input and Output nodes:
__112. Select Invoke web service from message flow, check predictSalary(predictSalary) and click
Finish:
__114. The sub-flow contains a SOAPExtract node to remove the SOAP Envelope from the web service
response. The map for the REST API response accepts a SOAP Envelope so it can handle
valid responses and SOAP Faults, so the SOAPExtract node must be removed from the sub-
flow. Right-click the Extract node and select Delete.
__115. Connect the Out terminal of the Request node to the In terminal of the predictSalaryResponse
node:
__117. You will now add a mapping node to map the REST request to the SOAP request. Expand the
Transformation node category, select the Mapping node and left-click in the predictSalary
sub-flow between the Input and predictSalary_EmployeeServiceV1 nodes. Rename the node to
“predictSalaryRequest”:
__118. Highlight the predictSalaryRequest node and select the Basic properties page. Click the
Browse button for the Mapping routine* property:
The predictSalary operation accepts a header input parameter named “Educationlevel”. This
parameter is passed via a HTTP header in the HTTP request. In previous versions of IIB(WMB)
HTTP headers were made available under the HTTP Input Header. Now in IIB V10 all REST
input parameter types are made available in a consistent location of
LocalEnvironment/REST/Input/Parameters/any.
Click the xs:int transform to expand the LocalEnvironment tree and expose the REST
properties:
Here you see that the User Defined type of Educationlevel has been added:
__121. You will now add a mapping node to map the web service SOAP response to the REST
response. Expand the Transform node category, select the Mapping node and left-click in the
sub-flow between the predictSalary_EmployeeServiceV1 and Output nodes. Rename the node
“predictSalaryResponse”.
__122. Highlight the predictSalaryResponse node, select the Basic properties tab and click the
Browse button for the Mapping routine* property:
__124. Wire the Out terminal of the Input node to the In terminal of the predictSalaryRequest node.
Wire the Out terminal of the predictSalaryRequest node to the In terminal of the
predictSalary_EmployeeServiceV1 node.
Wire the fault terminal of the predictSalary_EmployeeServiceV1 node to the In terminal of the
predictSalaryResponse node.
Wire the Out terminal of the predictSalaryResponse node to the In terminal of the Output
node.
__125. Enter CTRL+S to save the predictSalary sub-flow. Click the X on the predictSalary.sub-flow tab
to close the sub-flow:
__126. Select the EmployeeService_REST tab. Under Error Handling click Implement the Catch
handler:
__128. You will now add a mapping node to create a simple JSON error message for exceptions that
occur during message flow processing. Expand the Transform node category and select the
Mapping node, then left click in the sub-flow between the Input and Output nodes. Rename the
Mapping node to “catchHandler”:
__129. Highlight the catchHandler node and on the Basic properties page click the Browse button for
the Mapping routine* property:
__131. Wire the Out terminal of the Input node to the In terminal of the catchHandler node.
Wire the Out terminal of the catchHandler node to the In terminal of the Output node.
__133. Click the X in the EmployeeService_REST tab to close the REST API:
__134. You can view the EmployeeService_REST API implementation message flow by expanding
EmployeeService_REST > Resources > Flows > gen and right-clicking
EmployeeService_REST.msgflow then selecting Open > With Message Flow Editor:
__135. Observe there is a Label Node for each operation and Catch Handler that was implemented that
is wired to the associated sub-flow:
Note the warning that the flow is auto generated and should not be edited.
__136. In the Application Development view, select the EmployeeService_REST REST API project and
drag and drop it onto the default Integration Server in the Integration Nodes view:
__137. Observe that the EmployeeService_REST REST API has been successfully deployed:
__138. Open the IIB Web UI by right-clicking TESTNODE in the Integration Nodes view and selecting
Start Web User Interface:
__139. When the Web User Interface opens expand TESTNODE > Servers > default > REST APIs >
EmployeeService_REST > API then right-click Remote URL For The REST API Definitions
and select Copy Link Location:
__140. In Firefox, open a new tab, and open the SwaggerUI tool (using the bookmark in the REST
folder). By default, this will open the Petstore Swagger document.
__141. In the entry field, paste the contents of the clipboard and click Explore to view the
EmployeeServiceV1 REST API hosted on IIB:
__142. On the departments tag click List Operations to list all of the operations that are defined for the
tag:
__143. Click GET /departments to expand the getDepartment operation. Enter “C01” for the
departmentNumber and click Try It Out:
Observe the Request URL and the response body for the HTTP 200 return code:
__144. Enter “C09” for the departmentNumber and click Try It Out. Observe the Request URL and the
error response for an HTTP return code of 500:
Note: An empty result set was returned for the database query performed by the
EmployeeService web service.
__145. Enter “C099” for the departmentNumber and click Try It Out. Observe the Request URL and the
error response for an HTTP return code of 500:
Note: The database query performed by the EmployeeService web service failed because the
departmentNumber exceeds the length of the DeptNumber column in the Department table.
__147. Observe the Request URL and the Response Message for a HTTP return code of 200:
__148. Enter “C09” for the departmentNumber and click Try It Out. Observe the Request URL and the
error response message that was returned for an HTTP return code of 500:
Note: An empty result set was returned for the database query performed by the
EmployeeService web service.
__149. Enter “C099” for the “departmentNumber” and click “Try It Out”. Observe the Request URL and
the error response message that was returned for an HTTP return code of 500:
Note: The database query performed by the EmployeeService web service failed because the
departmentNumber exceeds the length of the DepartmentNumber column in the Department
table.
__150. Click Show/Hide for the department tag and click List Operations for the employees tag:
__152. Observe the Request URL and the Response Message for a HTTP return code of 200:
__153. Enter “000066” for the employeeNumber and click Try It Out. Observe the Request URL and
the error response message that was returned for an HTTP return code of 500:
Note: An empty result set was returned for the database query performed by the
EmployeeService web service. IIB has automatically handled the HTTP 500 response code.
__154. Enter “0000666” for the employeeNumber and click Try It Out. Observe the Request URL and
the error response message that was returned for an HTTP return code of 500:
Note: The database query performed by the EmployeeService web service failed because the
employeeNumber exceeds the length of the EmployeeNumber column in the Employee table.
IIB has automatically handled the HTTP 500 response code.
__156. Observe the Request URL and the Response Message for a HTTP return code of 200:
__157. Enter “000066” for the employeeNumber and click Try It Out. Observe the Request URL and
the error response message that was returned for an HTTP return code of 500:
Note: An empty result set was returned for the database query performed by the
EmployeeService web service. IIB has automatically handled the HTTP 500 response code.
__158. Enter “000066” for the employeeNumber and click Try It Out. Observe the Request URL and
the error response message that was returned for an HTTP return code of 500:
Note: The database query performed by the EmployeeService web service failed because the
employeeNumber exceeds the length of the EmployeeNumber column in the Employee table.
IIB has automatically handled the HTTP 500 response code.
__159. You will use the NetTool utility to test the predictSalary operation. This operation accepts an
input header parameter named Educationlevel and NetTool allows you to easily create HTTP
headers.
Click Add Header to add the Educationlevel header. Assign of value of “16” to the
Educationlevel header.
__162. Click Clone to create a new request. Change the value of the Educationlevel header to “8” and
click Send:
Note: The EmployeeService_REST message flow has automatically handled the HTTP 500
response code.
7.9 Summary
During the “Creating a REST API” lab you explored the contents of a Swagger document that defined the
EmployeeServiceV1 REST API using Notepad++ and the Swagger editor.
The new Create REST API wizard was used to import the EmployeeServiceV1 Swagger document and
create a REST API application. You observed the structure, organization and contents of the new REST
API application and how they offer IIB design and implementation best practices.
You used the REST API application tooling to quickly implement five operations and a Catch handler,
and then deployed the REST API application to a runtime Integration Server. The five operations
exchanged JSON Objects/Arrays and demonstrated all three input parameter types – path, query and
header.
● The Web UI was used to observe the REST API extensions that have been added to V10.
● The EmployeeServiceV1 REST API was tested using Swagger-UI and NetTool.
END OF LAB 7
8.1 Overview
Murphy’s law states that “Anything that can go wrong, will go wrong”.
All programs should be designed with that adage in mind, and include exception handling of some sort.
Integration solutions developed for IBM Integration Bus are no different—a well-designed message flow
will have some form of exception handling.
In this lab you will see an example of how exceptions can be thrown, caught, and handled directly in your
message flow. You will also be introduced to the interactive Flow Debugger and see how that can be
used in addition to the Flow Exerciser in diagnosing problems.
If you completed Labs 1 and 2, and still have the IntroLab application and IntroLab_Lib library in your
workspace, you can proceed to section 8.3.
If you did not complete both Labs 1 and 2, or are now using a different workspace, you can import the
completed Lab 2 solution into your workspace using the following steps.
__1. In the whitespace of the Application Development view, right-click and select Import.
__2. In the Import wizard, expand the IBM Integration folder if necessary, and select Project
Interchange.
Click Next.
__3. Click the Browse button next to the From zip file: entry field.
Lab 8 - Exception handling and the interactive Flow Debugger Page 371
IBM Software
__5. Ensure that all four project folders shown are checked.
Click Finish.
__6. In the Application Development view, you should now see the imported project folders (and
perhaps others as well).
Lab 8 - Exception handling and the interactive Flow Debugger Page 373
IBM Software
With IBM Integration Bus there are two general approaches to handling errors in a message flow:
Failure checking
Most nodes have a Failure terminal. Wire this terminal to explicitly check for any errors that occur within
that node. Sometimes node failures are tolerable, or recoverable. If you do not want a node failure to
result in the flow as a whole aborting, you can wire the Failure terminal to nodes that can deal with (or
ignore) the failure.
Catching exceptions
If you do not wire a Failure terminal, a node failure is converted into an exception which is thrown from
the node. Any changes that were made to the inflight message before the exception was thrown are
reversed. Message flow nodes that represent the start of a transaction typically have a Catch terminal.
Use the Catch terminal to handle any exceptions that are thrown "downstream".
In both cases, an Exception List tree is created, which contains diagnostic information about the error
that has occurred. If you wire the node’s Failure terminal, or wire an upstream node’s Catch terminal, the
message assembly, including the Exception List, will be propagated down that path. Along that path in
the message flow you can include nodes to handle such exceptions as you see fit. Examples of what you
might do include logging exception data, saving the message or event being processed in a file or
undeliverable message queue, or generating an alert.
For complex message flows, a TryCatch node can be used to break the large message flow into multiple
"TryCatch blocks". This can enable more granular exception handling to be performed. The TryCatch
node itself does not process a message in any way; it merely represents a decision point in a message
flow. When the TryCatch node receives a message, it propagates it to the Try terminal (a "try subflow"). If
an exception occurs on that path, control will return to the TryCatch node, which will then propagate it to
the Catch terminal (a "catch subflow") that can then attempt to handle the exception.
See the IBM Integration Bus documentation for more detailed information on failure and exception
handling in message flows.
In this section you will see a simple example of how exception handling can be incorporated into a
message flow.
Note:
The following should not be viewed as an example of
robust exception handling! The example is very simple, and
intended merely to illustrate some of the options available
to catch and handle exceptions in IBM Integration Bus.
__7. In the Application Development view, expand the IntroLab application and Flows folder, and
double-click IntroMessageFlow.messageflow.
__8. Locate the Trace node that you left unwired at the end of Lab 2.
You will be repurposing this node to gather additional information when exceptions occur.
Lab 8 - Exception handling and the interactive Flow Debugger Page 375
IBM Software
Enter the string ${LocalEnvironment} exactly as indicated – this tells the trace node to dump
out the entire contents of the LocalEnvironment tree.
Enter the string ${ExceptionList} exactly as indicated – this tells the trace node to dump out any
Exception data if present.
Note:
The pattern uses curly braces, not parentheses!
The pattern is case sensitive!
__10. The trace node properties should look like this when complete:
__13. Wire the Catch terminal (at the bottom) of the IntroLab_Listener input node to the in terminal of
the Trace node.
Lab 8 - Exception handling and the interactive Flow Debugger Page 377
IBM Software
__14. Wire the Out terminal of the Trace node to the In terminal of the Reply if Error node.
__15. Click the node, then click one more time on the node name. It should then look like the following:
The changes are nearly complete. But there is one more thing to take into account.
Remember that, in Lab 2, you ran one test with MX for customerCountry. When that test was
run, no failure was generated – the flow simply ended. As discussed in that lab, the reason was
that, in a Route node, a no-match condition is not considered a failure.
For purposes of this lab, you are going to consider a no-match condition to be a failure. So you
will now extend the flow further, to throw a User Exception when there is not a valid value for
customerCountry.
__19. Click the NoMatch (previously, “Throw”) node and look at its Properties.
On the Basic tab, change Message number to “9999”, and Message text to “Missing or invalid
value found in customerCountry element”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 379
IBM Software
__20. On the CheckCountry route node, click the group of output terminals.
__22. Connect the Default terminal of the CheckCountry node to the In terminal of the NoMatch throw
node.
You will now repeat some of the tests you ran in Lab 2.
You will first retest the US and Canada paths in the flow, to ensure they still work as expected.
You will then retest sending an unexpected customerCountry code, to see if the logic you added
handles that correctly.
Finally, you will send in a malformed XML document, to see how system exceptions are caught
and handled.
Lab 8 - Exception handling and the interactive Flow Debugger Page 381
IBM Software
Lab 8 - Exception handling and the interactive Flow Debugger Page 383
IBM Software
__30. Recall that in Lab 2, you had changed customerCountry to “MX”. You may see that value there
now.
You want to retest the US path through the flow, so change customerCountry back to “US”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 385
IBM Software
__32. The Flow Exerciser will run. Click Close after it stops.
__33. The Flow Exerciser shows the path the US message took through the flow.
__34. Repeat these steps to test the Canada path in the message flow.
Lab 8 - Exception handling and the interactive Flow Debugger Page 387
IBM Software
__35. Right-click Test message (US), and select Duplicate from the menu.
__36. Change the name of the new test message to “Test message (CA)”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 389
IBM Software
__37. The Flow Exerciser will run. Click Close after it stops.
__38. The Flow Exerciser shows the path the CA message took through the flow.
Lab 8 - Exception handling and the interactive Flow Debugger Page 391
IBM Software
__39. Repeat these steps again, this time creating an MX test message.
__40. Right-click Test message (CA), and select Duplicate from the menu.
__41. Change the name of the new test message to “Test message (MX)”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 393
IBM Software
__42. The Flow Exerciser will run. Click Close after it stops.
__43. The Flow Exerciser shows the path the MX message took through the flow.
Lab 8 - Exception handling and the interactive Flow Debugger Page 395
IBM Software
1.The input message was processed by the IntroLab_Listener node and passed to the
CheckCountry node.
2.The CheckCountry node determined that MX did not have a matching entry in its routing
table, and so passed the message via the default terminal to the NoMatch throw node.
3.The NoMatch throw node threw an exception.
4.The thrown exception was caught by the IntroLab_Listener node
5.The IntroLab_Listener node passed the input message, along with exception data, to the
Trace Exceptions node via the Catch terminal.
6.After logging the message along with exception data to a file, the Trace Exceptions node
passed control to the Reply if Error node, and the flow ended.
__45. Look at the message tree that was passed via the Catch terminal from the IntroLab_Listener
node to the Trace Exceptions node.
The Exception List structure provides a great deal of detail about what led up to, and what
caused, an exception.
The items labeled (2) indicate that the CheckCountry node caught and rethrew an exception
generated from a downstream node.
Lab 8 - Exception handling and the interactive Flow Debugger Page 397
IBM Software
The items labeled (3) indicate that the downstream node that threw the exception was the
NoMatch node, that the exception thrown was a User exception with an error number of 9999,
and that the cause was a Missing or invalid value found in customerCountry element.
__47. Save this recorded message by clicking the save icon in the upper right corner.
Note: If the recorded message is closed, you can double-click the icon to reopen it.
__48. Call this recorded message “Test Unknown Country Code (MX)” and click OK.
The approach of having an exception handler for the entire flow means that exceptions thrown
for any reason, from any point in the flow, can be handled using a common exception handler.
The following steps will demonstrate this, by sending a malformed XML message into the flow,
and observing what happens.
Lab 8 - Exception handling and the interactive Flow Debugger Page 399
IBM Software
__51. Right-click Test message (MX), and select Duplicate from the menu.
__52. Change the name of the new test message to “Test message (Malformed XML)”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 401
IBM Software
__54. Review the highlighted text. Briefly, it explains that an exception occurred, and that the cause
was an XML parsing error at element “customerCountry”.
Click Close.
__55. The Flow Exerciser shows the path the malformed XML message took through the flow.
Notice here that the message never made it to the CheckCountry node.
Lab 8 - Exception handling and the interactive Flow Debugger Page 403
IBM Software
The reason was that IIB tried to parse the XML message before passing it to the CheckCountry
node, but because it could not be successfully parsed, the message went straight to the Catch
terminal on the IntroLab_Listener node.
__56. Look at the message tree that was passed via the Catch terminal from the IntroLab_Listener
node to the Trace Exceptions node.
The Flow Exerciser will display as much of the message tree as possible. You see here that the
message up to customerCountry is displayed, but customerCountry itself, and any elements
below it, are not displayed. The reason is that the XMLNSC parser was only able to successfully
parse the message up to that point, but no further, due to the malformed data (“&”) in the
message.
Lab 8 - Exception handling and the interactive Flow Debugger Page 405
IBM Software
__58. Now collapse the Message section, and expand the Exception List section.
There are multiple RecoverableException sections, showing the XMLNSC parser attempting to
find a way to successfully parse the data.
__59. Scroll to the bottom of the Exception List structure – the original exception will be found there.
The exception type (“ParserException”) as well as the cause of the parser error and the element
involved (“customerCountry”), can be found here.
Lab 8 - Exception handling and the interactive Flow Debugger Page 407
IBM Software
__60. Save this recorded message by clicking the save icon in the upper right corner.
Note: If the recorded message is closed, you can double-click the icon to reopen it.
__61. Call this recorded message “Test Malformed XML” and click OK.
__63. Remember that the Trace Exceptions node was also logging the message tree to a file.
__64. Use the Windows Explorer to locate the file you configured the Trace Exceptions node to use.
Lab 8 - Exception handling and the interactive Flow Debugger Page 409
IBM Software
__65. Recall that in Lab 2 you configured the Trace node to capture the “IIB-internal” view of the
message tree.
By this time there will be quite a bit of data in the trace file – you will need to scroll to near the
bottom of the file to find the most recently logged data.
Note the correspondence with what you saw in the Recorded Message from the Flow Exerciser
– the XMLNSC parser was able to parse to the customerCountry element, but failed at that point.
Note that the “IIB-internal” view of the message tree contains more detail about the message
tree than does the XML-rendered view – for example, showing the different data types (such as
INTEGER and CHARACTER).
__66. Now scroll down further to find the Exception List structure.
Scroll all the way to the bottom of that section, so you can see the original exception.
Lab 8 - Exception handling and the interactive Flow Debugger Page 411
IBM Software
Again, note the correspondence with what you saw in the Recorded Message from the Flow
Exerciser—the exception type is “ParserException” and the element involved is
“customerCountry”.
The detailed exception information provided by IBM Integration Bus makes it possible for flow-
level exception handlers to be written that can log detailed information about failures, as well as
to take action in some if not many cases to recover from those exceptions programmatically.
Think also about what you’ve configured in terms of testing assets by using the Flow Exerciser
as you have in this lab, as well as the first two labs.
__68. Return to the Flow Exerciser, and click Send to view the configured test messages.
__69. You configured test messages for four scenarios: two “happy paths” (for US and CA) and two
error paths.
Lab 8 - Exception handling and the interactive Flow Debugger Page 413
IBM Software
In addition, you saved four Recorded Messages that captured the results of those tests.
__70. In the Application Development pane, the IntroMessageFlow_inputMessage.xml file and the
IntroMessageFlow_recordedMessage.xml file can be exported and used by other testers, or by
external test tools, to perform regressing testing on this flow in the future.
Lab 8 - Exception handling and the interactive Flow Debugger Page 415
IBM Software
__73. You may recall from Lab1 that a change you made resulted in a warning appearing on the
IntroLab_Listener node.
__74. Hover the mouse pointer over the node to see the warning.
__75. In Lab1 you were told to ignore this warning. You are now going to address it.
__76. In the Properties sheet for the node, under Parser Options, change Parse timing from On
Demand to Immediate.
__78. With Parse Timing set to Immediate, the warning no longer appears.
Lab 8 - Exception handling and the interactive Flow Debugger Page 417
IBM Software
__79. You will now repeat the test using the malformed XML document.
Lab 8 - Exception handling and the interactive Flow Debugger Page 419
IBM Software
Click Send.
__84. Because the message was malformed, you expected this error.
You will notice some differences between this exception data and the data that was returned in
your earlier test.
Click Close.
Lab 8 - Exception handling and the interactive Flow Debugger Page 421
IBM Software
__85. What is this? You did not get this on your previous test.
Click OK to dismiss.
__86. Here’s another surprise – Because no data was retrieved from the Flow Exerciser, you cannot
see what path the message took through the flow.
Lab 8 - Exception handling and the interactive Flow Debugger Page 423
IBM Software
Previously, when you tested the malformed XML message, you were able to see the exception path
being taken when testing with the Flow Exerciser. Something about the change you made to the Parse
Timing resulted in the Flow Exerciser behaving differently.
Because you want to be able to handle parsing errors in your flow, you need to determine why the
change you made to the Parse Timing is preventing your flow from detecting the error and handling it.
In the next section you will use the Flow Debugger to better understand what is happening in this case
and how it is different from your previous test.
The Debug perspective in the IBM Integration Toolkit provides a Flow Debugger which enables more
detailed message flow debugging than is possible using the Flow Exerciser.
Using the Flow Debugger, you can set breakpoints in a message flow, and then step through some or all
of the nodes in a flow. While you are stepping through, you can examine and change elements in the
message assembly, as well as variables used by ESQL code and Java code. This is in contrast to the
Flow Exerciser, which shows you the path a given message takes through the flow, but provides no
ability to set breakpoints or to change variables other than at the outset. Using the Flow Debugger, the
ability to set breakpoints at strategic points in the flow, to see and modify the message assembly
between nodes, and to “step into” nodes such as Java Compute nodes for line-by-line debugging,
provide for much more detailed analysis of flow processing than is possible with the Flow Exerciser.
You can debug a wide variety of error conditions in flows, including the following:
Errors occurring at flow initiation
Nodes that are wired incorrectly (such as outputs that are connected to the wrong inputs)
Errors in transformation or logic within your code or maps
Incorrect conditional branching in transition conditions
Unintended infinite loops in flow
From a single IBM Integration Toolkit, you can attach the debugger to one or more Integration Servers,
and debug multiple flows in different Integration Servers (and therefore multiple messages) at the same
time.
The Flow Debugger does have some restrictions that must be kept in mind. For example, flows in an
Integration Server can be debugged by only one user at a time. Therefore, if you attach your debugger to
an Integration Server, another user cannot attach a debugger to that same Integration Server until you
have ended your debugging session. This is true even if you are debugging different message flows.
Another important restriction on the Flow Debugger is that it cannot be used in conjunction with the Flow
Exerciser. So message flows that are to be debugged must be driven either by external tools (such as
SoapUI) or using the Test Client that is integrated with the IIB Toolkit. You will be using the latter
throughout the remainder of this lab.
__89. In the Integration Node view in the bottom left, right-click the Integration Server called default.
__90. If Launch Debugger (Port is 0) appears, perform the following steps to enable the debugger.
Lab 8 - Exception handling and the interactive Flow Debugger Page 425
IBM Software
__a. On the Windows Desktop, locate the IBM Integration Console 10 shortcut, and double-
click the icon to start the Console.
__b. The IBM Integration Console for the current installation should appear.
__c. In the Console window, enter the following command to enable the debug port:
mqsichangeproperties TESTNODE -e default -o ComIbmJVMManager -n
jvmDebugPort -v 4449
__e. For the change to take effect, the Integration Node must be stopped and restarted. Enter
the following commands:
mqsistop TESTNODE
Lab 8 - Exception handling and the interactive Flow Debugger Page 427
IBM Software
The command will take several seconds to execute, but after that you should see
“Successful command completion”.
mqsistart TESTNODE
__g. You may also see the Integration Toolkit refreshing the node status:
__h. In the Integration Nodes view of the Toolkit, right-click again on the default Integration
Server.
You should see Launch Debugger (Port is 4449) appear, indicating that the debugger is
ready for use.
__91. One very nice feature of the Flow Debugger is that you can set breakpoints at specific points in
your message flow.
To do this, right-click the connector between the IntroLab_Listener node and the CheckCountry
node.
Lab 8 - Exception handling and the interactive Flow Debugger Page 429
IBM Software
__92. A small blue circle will appear on the connector, indicating at a breakpoint has been set.
__93. Do the same thing on the connector between the IntroLab_Listener node and the
TraceExceptions node – right-click the connector and select Add Breakpoint.
__94. A small blue circle will appear on the connector, indicating at a breakpoint has been set.
Because the Flow Analyzer has been disabled, message flows that are to be debugged must be driven
either by external tools (such as SoapUI) or using the Integrated Test Client that is part of the IIB Toolkit.
With IBM Integration Bus there are two integrated tools for testing integration solutions directly, from
inside the Toolkit, without the need to use external tools. These are the Flow Analyzer (which you have
seen) and the Test Client.
Lab 8 - Exception handling and the interactive Flow Debugger Page 431
IBM Software
Test Client instances can be created for MQ, JMS, HTTP, SOAP and SCA input nodes. They exist as a
single file in the workspace with a .mbtest file extension. They can be embedded into the applications or
libraries and thus passed from developer to developer with a project.
Like the Flow Analyzer, the Test Client has support for features such as monitoring all supported output
paths through a flow, and storing sample messages for replay purposes. It also encapsulates the build
and deploy process, and can be used to launch the debugger.
__95. To launch the Integrated Test Client, click the IntroLab_Listener node to give it focus.
Lab 8 - Exception handling and the interactive Flow Debugger Page 433
IBM Software
__99. Under Detailed Properties, click the drop-down for Body, and select Edit as text.
In the test message, locate customerCountry, and change it from “USA” to “US”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 435
IBM Software
__103. Select the default Integration Server for TESTNODE as the Deployment location.
Also make sure that both the Trace and debug as well as the Stop at the beginning of the
flow during debugging checkboxes are selected.
Click Finish.
__105. Review the Debug perspective, and the various featured that are presented.
Lab 8 - Exception handling and the interactive Flow Debugger Page 437
IBM Software
__107. Hover the mouse pointer for a brief description of each. Significant controls include:
Resume execution
Terminate
Run to completion
Because customerCountry was set to “US”, you should see the following:
__111. In the upper right corner of the Toolkit, click the Integration Development tab to return to the
Integration Development perspective.
Lab 8 - Exception handling and the interactive Flow Debugger Page 439
IBM Software
__112. Click the IntroLab.mbtest tab to bring the Test Client into focus.
__113. In the Test Client, you see on the left a node-by-node execution trace of the message flow.
On the right you see the response message that was returned by the flow. Because this flow
does no transformation there is no difference from the input message.
And you see the modification you made to the customerCountry, which you changed from “USA”
to “US”.
__114. Next you will run the same test, but this time make a change while the debugger is running.
You will use this modified message (with customerCountry set to “US”) as the starting point.
In the Test Client, right-click the Invoke Message Flow event at the top, and select Duplicate.
__115. A duplicate of the flow test will be created. You can see customerCountry is set to ”US”.
Lab 8 - Exception handling and the interactive Flow Debugger Page 441
IBM Software
__117. As before, the debug perspective will launch and the flow will pause at the first breakpoint.
__118. Look at the upper right of the Debug perspective. Locate the Variables view.
Here you can see all four trees that make up the message assembly. At present two of the trees
are populated: The Message and LocalEnvironment trees.
__119. Expand the message tree, and locate the customerCountry element.
__120. You have already tested the US path in the debugger. So you will change the customerCountry
variable to “CA” and test the Canada path.
Lab 8 - Exception handling and the interactive Flow Debugger Page 443
IBM Software
__121. In the debug toolbar, click to step over the next node in the flow.
Because customerCountry was set to “CA”, you should see the following:
The ability to change variables in the message assembly, while the flow is executing, makes the
Flow Debugger a very useful tool for exercising different behaviors the flow might take.
As an optional exercise, you might rerun these steps again, testing the flow with a
customerCountry of “MX”, and observe the behavior in that case.
__123. In the upper right corner of the Toolkit, click the Integration Development tab to return to the
Integration Development perspective.
__124. Click the IntroLab.mbtest tab to bring the Test Client into focus.
__125. Next you will run the test that was inconclusive when using the Flow Exerciser: the test with
malformed XML.
In the Test Client, right-click the second Invoke Message Flow event, and select Duplicate.
Lab 8 - Exception handling and the interactive Flow Debugger Page 445
IBM Software
__127. What happened? The Debugger did not start. Remember that this is also how the Flow Exerciser
behaved.
But in this case, you have an additional clue. Note the exception message below:
Lab 8 - Exception handling and the interactive Flow Debugger Page 447
IBM Software
Remember how both the flow exception handling and how the Flow Debugger work:
__a. Catching exceptions in a message flow require that the exception be thrown downstream from
the node with the Catch terminal (either an Input node or a TryCatch node).
__b. When the Flow Debugger pauses, it is either at a breakpoint or after doing a StepOver – either
way, it pauses after node execution completes.
That the exception must have occurred before control left the Input node in the message flow.
Question: Do you recall how exceptions occurring inside a node need to be handled?
Answer: By wiring the Failure terminal of the flow where the exception is occurring.
In this section, you will return to the Flow Exerciser to see if wiring the Failure terminal of the
IntroLab_Listener node will catch this exception.
__128. Return to the Debug perspective by clicking on the tab in the upper right corner.
__129. In the Debugger toolbar, click the terminate control to end the debugger
__131. Close the Test Client by clicking the in the upper right corner of the IntroLab.mbtest window.
Lab 8 - Exception handling and the interactive Flow Debugger Page 449
IBM Software
__133. Clicking Yes to the above allows you to save, and then reuse later, the execution script you
created using the Test Client.
In the Save Execution Trace dialog, select IntroLab as the project folder to save the script, and
click Finish.
__134. Note that the IntroLab.mbtest script has been saved in a folder called “Flow Tests” in the
IntroLab application folder. This preserves the script for use again at a later time.
__135. In the Integration Nodes view at lower left, right-click the default Integration Server, and if
Terminate Debugger is not greyed out, click it to stop the debugger.
You will now return to the message flow and make the needed changes so that your flow can handle this
exception.
__136. Change the message flow by wiring a connector from the Failure terminal of the
IntroLab_Listener node to the In terminal of the Trace Exception node.
Lab 8 - Exception handling and the interactive Flow Debugger Page 451
IBM Software
__141. Select Test Message (Malformed XML). Verify an “&” is specified for customerCountry.
Click Send.
Lab 8 - Exception handling and the interactive Flow Debugger Page 453
IBM Software
This is the same error you encountered when testing this message previously using the Flow
Exerciser.
__143. You will see that, unlike your earlier test with the Flow Exerciser, this time the message flow was
able to get control after the exception occurred.
Control was passed to the Failure terminal of the IntroLab_Listener node, which you wired to the
exception path of the flow.
Click the icon to see the message tree that was passed out the Failure terminal.
Lab 8 - Exception handling and the interactive Flow Debugger Page 455
IBM Software
__128. The Flow Exerciser will retrieve the recorded message tree.
__144. When complete, the message tree will be displayed, with the Message portion of the tree
expanded.
Collapse the Properties and HTTPInputHeader folders so that you can just see the payload.
You can see the payload could be parsed as far as the customerCountry element, but parsing
halted at that point.
Lab 8 - Exception handling and the interactive Flow Debugger Page 457
IBM Software
Why did changing Parse timing from “On-Demand” to “Immediate” alter the behavior of your message
flow in this way?
Despite the fact that Parse timing is an Input node option, in many cases the input node does not
actually need to know the structure of the message. So when Parse timing is set to On Demand, the
message will not be parsed until it reaches a downstream node that does require parsing of the
message. In the case of your flow, that would be the Route node.
1) Forces the message to be fully parsed, as well as validated if that option is also selected.
2) This is done immediately, before the message leaves the input node.
Previously, the malformed element in the message was not detected until the message reached the
Route node. An exception was thrown, caught by the Input node, and routed down your exception path.
With Parse timing set to Immediate, a full parse of the message was attempted before the message was
passed to the next node in the flow. The parse failed, and control was passed to the Failure terminal.
Close all the open editor tabs but leave the Toolkit running.
The following steps will delete the run-time artifacts from the TESTNODE server.
__129. In the Application Development pane, collapse any folders that are currently expanded.
__130. In the Integration Nodes pane, right-click the default Integration Server, and select
Delete > All Flows And Resources.
Lab 8 - Exception handling and the interactive Flow Debugger Page 459
IBM Software
__133. All deployed objects should be cleared from the default Integration Server.
END OF LAB 8
Appendix A. Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries.
Consult your local IBM representative for information on the products and services currently available in
your area. Any reference to an IBM product, program, or service is not intended to state or imply that
only that IBM product, program, or service may be used. Any functionally equivalent product, program, or
service that does not infringe any IBM intellectual property right may be used instead. However, it is the
user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this
document. The furnishing of this document does not grant you any license to these patents. You can
send license inquiries, in writing, to:
For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property
Department in your country or send inquiries, in writing, to:
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES
CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some
states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this
statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically
made to the information herein; these changes will be incorporated in new editions of the publication.
IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this
publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in
any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part
of the materials for this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.
Any performance data contained herein was determined in a controlled environment. Therefore, the
results obtained in other operating environments may vary significantly. Some measurements may have
been made on development-level systems and there is no guarantee that these measurements will be
the same on generally available systems. Furthermore, some measurements may have been estimated
through extrapolation. Actual results may vary. Users of this document should verify the applicable data
for their specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their
published announcements or other publicly available sources. IBM has not tested those products and
cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.
All statements regarding IBM's future direction and intent are subject to change or withdrawal without
notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business operations. To illustrate
them as completely as possible, the examples include the names of individuals, companies, brands, and
products. All of these names are fictitious and any similarity to the names and addresses used by an
actual business enterprise is entirely coincidental. All references to fictitious companies or individuals are
used for illustration purposes only.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs
in any form without payment to IBM, for the purposes of developing, using, marketing or distributing
application programs conforming to the application programming interface for the operating platform for
which the sample programs are written. These examples have not been thoroughly tested under all
conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these
programs.
Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or
trademarks of Adobe Systems Incorporated in the United States, and/or other countries.
Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon, Intel
SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the
United States, other countries, or both.
ITIL is a registered trademark, and a registered community trademark of The Minister for the Cabinet
Office, and is registered in the U.S. Patent and Trademark Office.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or
its affiliates.
Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc. in the United States, other
countries, or both and is used under license therefrom.
Linear Tape-Open, LTO, the LTO Logo, Ultrium, and the Ultrium logo are trademarks of HP, IBM Corp.
and Quantum in the U.S. and other countries.