IBM Integration Bus, Version 10.0.0.0 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


Casting elements in a message map

In the Graphical Data Mapping editor, use the Cast function to redefine parts of the input or the output model in a message map.

About this task

To create a flexible message model, you can define elements in your schema as wildcards.

A wildcard is an element in your schema that is defined as xsd:any, xsd:anyType, or xsd:anySimpleType.

A message model schema might contain one or more wildcards.

In the Graphical Data Mapping editor, you can redefine a wildcard by using the Cast function. You cast a wildcard to a specific type. For more information, see Casting a wildcard defined as xsd:any into a specific type for a SOAP message.

You can use the Cast function to redefine a wildcard multiple times. Each type that you cast appears under the wildcard.

To define transformations between subtypes of a data type, you can use derived types. A derived type is a data type that is related to another data type known as the base type or super type. You can cast a base type to a derived type by using the Cast function. For more information, see Casting a base type to a derived type or extension type.

When your input message or your output message is a JSON message, you can redefine the Data element of type anyType by using the Cast function. You can cast the Data element to an XML schema that is modeled to reflect the logical tree structure of your JSON data. (Currently, you cannot import JSON schemas into IBM® Integration Toolkit.) For more information, see Modeling a JSON message for use in a message map by using a schema model.

Procedure

To redefine an element in your input or output model by using the Cast function, complete the following steps:

  1. Open the map in the Graphical Data Mapping editor.
  2. Right-click the element that you want to redefine, and select Cast.

    The Type Selection dialog opens.

  3. Select the type that you want to cast to, and then click OK.

    The Type Selection dialog lists only those elements and types that are appropriate for the element that you want to cast, and that are contained in a referenced application or library. When you cast a base element, the Type Selection dialog lists only derived types.

    Note: When you cast a wildcard to multiple types in the input side of a map, the Graphical Data Mapping editor injects an XPath expression to detect which type is present in the input data at run time. Then, invoke the appropriate mapping. However, the Graphical Data Mapping editor only checks the name of the type in each cast. The namespace is ignored. If you cast a wildcard to two types with the same name but in different namespaces and you need to map both types, you must add your own conditional transform that checks the namespace and name part of the xsi:type attribute of the input data.

Results

After you use the Cast function to qualify the type of the element that is defined with a wildcard, the type appears under the wildcard. You can define transformations between the input message and the output message. For more information, see Specifying a transform (mapping operation).


cm40825_.htm | Last updated 2015-03-27 19:28:47