IBM Integration Bus, Version 10.0.0.3 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: In the following situations, choice of cast items contains more than one item:
    • You cast a wildcard input type to a specific schema type.
    • You cast a base schema input type to an extension or a restricted type.
    The Graphical Data Mapping editor automatically applies an XPath expression to the mappings from these casts. At run time, the XPath expression checks the xsi:type attribute of the input element to determine which of the types is present in the input data. Then, only the mapping from the appropriate type is performed. The expression checks only the name of the type in each cast; the namespace is not considered. If choice of cast items includes types that have the same name but are in different namespaces, you must add your own conditional transform that checks the namespace and name part of the xsi:type attribute of the input data. When choice of cast items includes only a single type, the xsi:type attribute is not checked, and you must ensure that the input data presents only the single cast type.

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-11-27 00:02:28