Defining user-defined elements

You can add, reuse, rename, transform, and delete a user-defined element directly into your message map during the development phase.

About this task

A user-defined element is an element that you can add directly into a message map to define the data of an extension point, which is shown as any or anyAttribute in the map.

You can add user-defined elements to define extension points in any of the following message assembly components:
  • The local environment tree variables folder
  • The message body
  • xsd:any elements in your message body
  • The Environment tree
  • The transport headers that include extension points such as MQRFH2

You can also use user-defined elements to define a JSON message, and a SOAP or XML message that has an xsd:any.

You can add any of the following types of user-defined elements:
  • Simple type user-defined elements
  • Complex type elements
  • Repeatable user-defined elements
When you add a user-defined element, you must consider the following behavior:
  • You can define a simple type user-defined element or a complex user-defined element in the input message assembly or in the output message assembly.
  • You can include simple type attributes, simple type elements, complex type elements, and repeatable elements in a user-defined complex type element.
  • You can define user-defined attributes within a complex user-defined element.
  • You can set the type of a user-defined element or attribute from an existing global type definition. You can use any available message models, XML schemas, or DFDL schemas. For more information, see Choosing the project structure when you create a message map.

JSON elements are defined as nillable by default to allow the JSON null value. The Graphical Data Mapping editor creates all JSON user-defined elements as nillable.

Note: Be aware of the following limitations:
  • The Graphical Data Mapping editor does not create any other type of user-defined element as nillable. For this reason, if you use the Add User-Defined function to add XML elements, they cannot be defined as nillable. If you need nillable XML elements, you must define a schema model for them.
  • You cannot use user-defined elements as the input or output of a submap.

When you use the Graphical Data Mapping editor to transform a JSON message, ensure that the JSON element names that you define by using the Add User-Defined function are valid according to the XML rules for naming elements. JSON allows a wider range of characters than XML, for example a JSON object might include the @ character. However, the Graphical Data Mapping editor allows element names that are valid in XML or XPath.

Procedure

You can do any of the following actions with user-defined elements:

What to do next

After you add your input and output objects, create the connections between them, and specify your transforms, you can test your message map. For more information, see Troubleshooting a message map.