Creating a message assembly

You can create message assemblies by using the IBM® App Connect Enterprise Toolkit.

Before you begin

Read the following topics:

About this task

A message assembly is an object that is used to represent an instance of a message at a given point in time as it is being processed by a message flow. The message assembly contains the message headers and payload (which can be XML, JSON, DFDL or BLOB data), together with the environment tree, the local environment tree, and the exception list tree. The contents of the message assembly are accessed and modified by each message flow node as the message is processed.

For examples of messages that were created by using the Message Assembly Editor, see the following topics:

For a demonstration of how to view and edit a message assembly, see the following video: Understanding a message assembly.

Procedure

You can create a message assembly by completing the following steps:

  1. In the Application Development view of the IBM App Connect Enterprise Toolkit, right-click the test project that will contain your message assembly, and then click New > Message Assembly.
  2. In the Create a message assembly window, enter a name for your new message assembly and then click Finish.
    The Message Assembly Editor is displayed.
  3. Right-click the MessageAssembly tag in the displayed table. A menu is displayed, which you can use to create each tree in the message assembly (Environment, Local Environment, Exception List, and Message):
    Figure 1. Message Assembly Editor context menu
    This diagram shows the context menu used to select trees in the Message Assembly Editor.
  4. Add an environment tree to the message assembly:
    1. Select Add Environment to add an environment tree. An environment tag is added to the message assembly.
    2. Add elements to the environment tree, by right-clicking the environment tag and then clicking Add child > Element.
    3. Add attributes to the element by right-clicking the element and then clicking Add Attribute.
  5. Add the local environment tree to the message assembly:
    1. Right-click the MessageAssembly tag and click Add Local Environment.
      The Create Local Environment Tree window is displayed.
    2. Select the entries that you want to add to the local environment tree.
      You can expand the entries and select individual elements or folders.
    3. When you have finished adding entries to the local environment tree, click Finish.
      The local environment entries are shown in the Message Assembly Editor.
      Figure 2. Environment and local environment trees in the Message Assembly Editor
      This diagram shows the environment and local environment trees in the Message Assembly Editor.

      You can add further entries to the local environment tree by right-clicking the localEnviroment element and then clicking Select and add elements.

    4. Click Finish.
  6. Add an exception list tree to the message assembly:
    1. Right-click the MessageAssembly tag and then click Add Exception List.
    2. To add entries to the exception list tree, right-click exceptionList, click Add Exception List entry, and then select the specific types of exception that you want to add to the tree.
      The entries are added to the exception list tree. You can also add nested exceptions and extra inserts.
  7. Add the message tree to the message assembly:
    1. Right-click the MessageAssembly tag and then click Add Message.
      The Create Message Tree window is displayed.
    2. Select the transport protocol and message body parser for the message tree.
      • Choose one of the following transport protocols: HTTP, SOAP, MQ, TCPIP, File, or Other.

        If you select HTTP, an HTTPInputHeader is added automatically. If you select MQ, an MQMD is added automatically.

        The value for ReplyProtocol in the Properties tree is set based on the selected transport. For example, if you select MQ, the ReplyProtocol property is set to MQ.

      • Choose one of the following message body parsers: XMLNSC, JSON (Object), JSON (Array), DFDL, or BLOB.
      • Set values for the properties and headers that you require for your unit test.

        XMLNSC and DFDL message body parsers require a root element, which you can add by selecting them from the context menu. For XMLNSC, you can add elements and attributes. For DFDL, you can add elements but no attributes.

        For a JSON Object, you can add a child element that is a JSON Object or JSON Array. For a JSON Array, you can add a child element that is a JSON Array Item. For a JSON Array Item, you can add a child element that is a JSON Object or JSON Array.

        Elements that contain child elements do not have a type associated with them, but you can associate a type with each of the child elements. When you select a type, validation is performed and the type is set in the iib:valueType attribute.

    3. Click Finish.
      The properties tree and message domain element are added under the message.
    4. Add message headers by right-clicking the message element and then clicking either Add HTTP Header or Add MQ Header, and then selecting the type of header.
      • For HTTP, you can add one of the following headers: Input, Reply, Request, or Response.
      • For MQ, you can add one of the following headers: MQMD, Dead Letter, MQRFH2, or MQRFH2C.
  8. Save your message assembly.