Professional Documents
Culture Documents
L05 GraphicalMapping
L05 GraphicalMapping
L05 GraphicalMapping
5.1 Overview
This lab exercise introduces the graphical mapping node that was new to version 8 of the product.
By way of illustration, here is an example of one of the maps that will be built in the lab. To summarize
what this shows: there are source and target message assemblies on the left and right hand sides
respectively; fields in the output are then assigned values or graphically mapped from the input fields
with the connections formed in the central area.
In the last lab, an initial web service flow was created that simply returned to the caller the message it
was sent. In this lab, the flow is expanded to call a backend service and return a response based on the
result of this service invocation. The backend service uses the MQ transport and is pre-built. Before the
message flow can send a request to our backend service, it must be transformed from the XML of the
request to a COBOL format. The backend Account_Open service will return a response in an MQ
message. The response will have to be transformed from COBOL back to a XML reply message format.
The transformations will be done using the graphical Mapping node.
Page 94 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__1. Start by selecting the AcctOpen_Application project. Press the right mouse button on the
AcctOpen Application and select Manage Library references from the menu
__2. Select the MQ_Service_Library project to add it to the list of libraries referenced by the project.
The other library, AcctOpen_Library, was created and the reference was established when the
application was initially created in the previous lab.
__5. Drag a Mapping node onto the connection between the JKE_WSDL_ServerService sub-flow
and the SOAP Reply node. Drop it on the connection near the sub-flow. You will know when it is
in the correct place to be dropped when a bubble with the words Insert a node into the
connection apears.
Once the mapping node is dropped onto the connection, the original connection is broken into
two sections. The input node is connected to the sub-flow and the output terminal is connected to
the SOAP Reply node. We will use this technique for the remaineder of this lab. If at anytime the
node is not dropped onto the existing connection, you will need to delete the old connection and
re-wire the two new connections.
__6. Rename the mapping node to Build Request. This node will transform the SOAP response
received from the Web service client to a COBOL structure that matches what the MQ based
service expects.
Page 96 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__7. Drag another Mapping node onto the connection to the left of the SOAP Reply node. This node
will transform the response received from the MQ service to the response expected by the web
service.
__8. Rename the Mapping node to Create Reply. The SOAP Reply node may need to be moved to
the right to provide space for the new nodes.
__10. Drag an MQOutput node to the connection just after the first mapping node, Build Request.
This node will send a request message to the MQ-based service. Rename the node to Invoke
MQ.
__11. In the Properties pane for the Invoke MQ node select the Basic tab.
__12. Enter JKEACCTOPEN.IN as the Queue name. This is the queue that the queue based service
will be waiting for messages on.
Next the node must be configured to put the message immediately and not as part of the flow’s
transaction.
__14. Use the drop down menu to set the Transaction mode to No.
__15. Use the drop down menu to set the Message context to Default.
Page 98 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
Finally the node needs to be configured to send a request message along with the reply-to queue
name.
__18. Enter LAB.REPLY as the Reply-to queue. The reply-to queue manager does not need to be
filled out as we will not be sending messages between different queue managers.
__19. Drag an MQGet node to the right of the Invoke MQ node and drop it onto the connection. Allow
room for another node in between the new node and the Invoke MQ node.
__24. Use the drop down menu to select the DFDL parser as the Message domain. Then select the
Browse…button.
Page 100 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
The result should look as follows with the JKEACCOUNTREQUEST DFDL message provided in
the MQ Service Library being used by the node.
The final configuration we need to make to this node is to set it to get messages outside of the
transaction of the flow.
The reply message is received from an MQ service and therefore will have an MQMD header.
Since the original message originated as a SOAP Web service over HTTP the MQMD will be
removed using an MQ Header node.
__29. For the next step you may need to move the nodes around to make room between the Get
Reply and SOAP reply nodes
__30. Drag an MQ Header node to the message flow placing it after the Get Reply mapping node.
There is still one subtle error in the message flow. The MQ Get node just reads the next
message from the reply queue. It does not check if the reply message actually matches the
request that was sent. The MQ Get node should look for the specific message that correlates
with the specific request that was sent. WebSphere MQ provides a correlation id field that is set
by the remote application to the message identifier of the message that was sent. The message
id of a message that is sent by an MQ Output node is captured and stored in an area of storage
called the local environment.
The next steps will use an MQ Header node to get the message identifier from the local
environment and store it in the correlation id field of the MQMD. The properties of the Get Reply
node will also be changed to only get the specific reply message.
__34. Select another MQ Header node from the palette and drag it onto the connection between the
Invoke MQ and Get Reply nodes.
Page 102 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__36. In the Properties for the Set Correl Id node select the MQMD tab.
__39. Press the Edit button next to the Correlation Identifier field.
__41. Select the msgId field and drag it to the XPath Expression edit box.
It is possible for an MQ Output node to send multiple messages in a single invocation and there
might be more than one occurrence of the DestinationData folder, one for each message that
was sent. In this case there is only a single message so that the first (and only) occurrence will
be selected.
__43. Press the OK button to select the first occurrence of the DestinationData folder.
Page 104 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__45. Press the Finish button to complete the XPath expression for the Correlation Identifier field.
Page 106 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__2. The first panel of the wizard gives you the option to change the name of the map and select the
container in which the map will be stored. There is no need to change any of these for the lab so
click Next.
Next a panel is displayed where you identify the source and targets for the mapping operation. It
can be expanded until all items are shown or scrolling can be used to see the message
definitions.
__3. In the left hand half expand the AcctOpen_Library and DFDL and XML Schemas folders.
__4. Check the box next to JKE_In_Request. This will be the input message for the mapping
__5. In the right hand half expand MQ_Service_Library and DFDL and XML Schemas folders.
__6. Check the box next to JKEACCOUNTREQUEST. This will be the output message for the
mapping
On this pane of the wizard we specify the domain of the output message.
__8. From the drop down select DFDL for the Output domain.
Page 108 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
The initial map is then presented showing the input and output messages.
The Mapping Panel is divided into three areas. On the left hand side is the input or source message,
here shown pre-populated with the input Properties and the JKE_In_Request message. On the right
hand side is the target or output message, here shown pre-populated with the output Properties and the
JKEACCOUNTREQUEST output message.
Note that the Properties folder has already been mapped. This mapping moves all of the properties from
source to target with one override of an assignment to the Message Type.
__10. Select the Assign map and look at its properties. In the General tab the Value of the
assignment for the message type is set to {}: JKEACCOUNTREQUEST.
So these output properties will indicate the change of the message type for subsequent nodes.
__11. Collapse the Properties folder, to focus on the task of mapping the input and output messages.
__12. From the buttons above the main map, select the Auto map input to output button.
Page 110 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
This mapping operation is between messages of different formats – XML for the source, COBOL
for the target. The field names are different, the order of fields is different in some cases, and in
two cases data that is a string in the source becomes Packed Decimal (for one field) or Binary
(for another field).
__13. In the Auto Map wizard, uncheck the box for Alphanumeric characters.
__14. Select the check the box for Create transformations when the names of inputs and outputs
are similar than.
__15. Set the % match to 50 using the slider bar or by overtyping the value.
A comparison of the names will be performed and the results shown on the next screen.
A preview of the results of the Map by Name operation using the parameters supplied on the
previous panel is displayed. If the results are not satisfactory then the Back button can be used
to return to the previous panel. This panel allows for incorrect or duplicate mappings to be
removed.
In this case the CUSTOMER_ACCOUNT_NUMBER target has two sources. This is not right. It
will now be corrected.
__19. Uncheck the box for customerCountry as this is not the proper source for this target. Leave
the customerNumber field checked as this is the source for this field.
Page 112 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
You should see that the CUSTOMER_ACCOUNT_NUMBER target now has a single source with and
input count of 1.
Take a few minutes and look at the results. Fields from the source and target are now connected by
Move mappings that have been generated by the auto map wizard. If there is a mapping that is
incorrect, you can click on the Move that joins them, and delete it.
If you look closely you will see that there are four target fields (ACTION_REQUEST, CITY, COUNTRY
and DECISION) that the Map by name algorithm was not able to establish a match for. At a 50%
matching criteria, the shorter names missed a match because of the “customer” prefix in front of those
fields in the source names. To illustrate mapping by hand these elements will be mapped manually. A
simple drag and drop can be used to map from source to target.
When dealing with fixed format messages, such as COBOL, every field must be mapped unless that field
has been defined with a default value. It is also worth noting that the COBOL items do have a max
length associated with each field. When mapping from variable length fields, such as XML, if a source
field is too long it will be truncated in the target. With the sample messages provided with the lab, this is
not the case.
You may also notice that two of the mappings have warnings, for both the customerCreditLimit and
CustomerCreditScore input fields. This is where strings are being mapped to something other than a
string -- the field types between the move do not match. We will correct these once the missing maps
have been provided.
Page 114 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__22. To map the first field, drag and drop the source customerCity field, on the left, to the target
CITY field, on the right. (Collapse the target Properties folder again if necessary.)
This should create a new map represented by the Move joining the two fields.
__23. Repeat this for the source customerCountry field dragging it onto the target COUNTRY field.
Next two assignments are made for the DECISION and ACTION_REQUEST target fields.
__26. With the new Assign map selected go to the Properties tab.
Page 116 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__30. Enter a single character (letter) O as the value for this assignment.
Now it is time to deal with the two warnings within the generated map.
__31. Locate the Move map for the customerCreditLimit. Hover over the warning symbol (a small
yellow triangle containing an exclamation mark) to reveal the details of the warning. The warning
text is: The string simple type input does not match the <PICS9-Comp3__int> simple type
output. Use a Convert transform to ensure proper conversion.
__32. Move the cursor to hover over the light bulb (just next to the warning symbol).
__33. Select the quick fix that is being offered: Use convert to ensure the proper conversion.
__35. Once again move the cursor to hover over the light bulb (just next to the warning symbol).
__36. Select the quick fix that is being offered: Use convert to ensure the proper conversion.
Page 118 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
Here is the end result with all fields properly mapped. Every field on the target side should have an
associated mapping to it. Note that CUSTOMER_DETAILS is not a field but a structure that contains
multiple fields.
There is one more consideration for the map to be complete. The input message arrives over an HTTP
transport. The output message will be sent over WebSphere MQ. The input message will contain an
HTTP input header, which should be removed before sending the message to MQ. The removal of the
HTTP header could also be accomplished using an HTTPHeader node. However in this case the
mapping node will be used to remove the header. This is accomplished by adding the header on the
target side of the map but not mapping to it.
The MQMD header will then be added by the MQ Output node as this puts a message to the queue.
__38. In the General Properties click on Edit for the Headers and folders.
Page 120 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__39. Expand the HTTP Headers folder (Do not select all the headers at this level).
Note the HTTPInputHeader is now referenced in both the graphical map (shown here with the
target properties minimized) and the Headers and folders property.
__42. When you are finished examining the results, save the map (Ctrl+S).
__45. As before there is no need to change what the map is called or where it will be stored so click
Next.
Page 122 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__46. In the left hand half expand the MQ_Service_Library and DFDL and XML Schemas folders.
__47. Check the box next to JKEACCOUNTREQUEST. This will be the input message for the
mapping
__48. In the right hand half expand AcctOpen_Library and DFDL and XML Schemas folders.
__49. Check the box next to JKE_Out_Response. This will be the output message for the mapping
The output message will be the reply to the web service in SOAP XML.
__53. To once again auto-generate some of the map from the buttons above the main map select the
Auto map input to output button.
__55. Select the check the box for Create transformations when the names of inputs and outputs
are similar than
__56. Set the % match to 50 using the slider bar or by overtyping the value.
Page 124 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__61. Uncheck the box for ACTION_REQUEST as this is not the proper source for this target. Leave
the DECISION field checked as this is the source for this field.
You should see that requestDecision now has a single correct source (DECISION).
__63. Click on the Finish button to perform the map by name operation.
In the map that has been generated, only one target field remains unmapped this is the message
field.
__64. Drag COMMENTS in the source message assembly to message in the target.
Page 126 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
This message flow has a dependency on an MQ service. In this case, the service will be
simulated by another message flow, which has been provided. A flow created prior to version 8
of the product will be used for this service. This flow is not encapsulated within an application but
contained in a message flow project.
__1. Expand the Independent Resources folder, then the MQ_Service message flow project, and
the Flows folder.
Page 128 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__6. Once the flow has deployed, you should observe the JKE_AccountOpen message flow, the
MQ_Service_MessageSet message set and the JKE_AccountOpen ESQL deployed and
running within the Brokers pane.
With the backend service in place we can now run test messages through the main flow.
__7. In the project navigator pane expand Flow Tests for the AcctOpen_Application.
__8. Double click the AcctOpen_Flow.mbtest file to open the previously saved test file..
The test client should open. The test data from the previous test should appear in the test client.
__11. Uncheck the Stop when the first MQ message is received check box.
__12. Select the Browse message from MQ output queue radio button.
Without these changes the test client will attempt to get messages from the queue being used by
the backend service and interrupt the flow that is being tested.
Page 130 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
__14. In the left hand pane, right click on the Invoke Message Flow entry.
This will repeat the previous test with the same data that was run by the client.
__17. Press the small square icon to stop the test. The flow test is waiting for a message to arrive on
the queue, but the message has been processed by the other flow. The message flow will
eventually time out.
__18. Select the Received HTTP Reply message for “SOAP Input” in the left hand pane. The
results will be displayed in the right hand pane.
Observe that data has come back from the backend service in the customerNumber and
message fields. The flow has mapped the request that was sent from the SOAP format into the
COBOL structure and on the way back the COBOL has been mapped to the SOAP response
format.
Page 132 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA
IBM Software
5.5 Clean up
__1. Close the AcctOpen_Flow message flow.
__6. Select Delete All Flows and Resources from the menu.
__7. Press the OK button to acknowledge the warning and start the deletion.
Page 134 Discovering the value of WebSphere Message Broker V8.0 for your ESB and SOA