In the Graphical Data Mapping editor, use the Cast function to redefine parts of the input or the output model in a message map. This function is also known as a mapping cast.
To create a flexible message model, you can define elements in your XML schema as wildcards, or you can provide an extension or derived type from a base type. In a JSON schema, you can use the "oneOf" or "anyOf" keywords to allow flexibility.
A wildcard is an element in your XML schema that is defined as xsd:any, xsd:anyType, or xsd:anySimpleType.
A message model schema might contain one or more wildcards. In addition, the model for the Message Assembly Environment, Local Environment, transport header folders, and SOAP and JSON domain messages, include wildcards, such as under the environment Variables folder, which allow you to define data specifically for the operation of your flow.
In the Graphical Data Mapping editor, you can redefine these wildcards by using the Cast function to select an element or type that is defined in a message model, such as an XML schema, DFDL schema, JSON schema, or Swagger document. For more information, see Casting a wildcard defined as xsd:any into a specific type for a SOAP message and Configuring a generic type in the local environment tree by using the Cast function.
If you do not have a message model that provides a suitable element for casting, consider adding a user-defined element, as described in Defining user-defined elements. When you have added a user-defined element, you can set its type from a global type in your message model, as described in Defining the structure of a complex user-defined element.
You can use the Cast function to redefine a wildcard or base type multiple times. Each type that you cast appears under the wildcard or base type within a choice group.
To define transformations between subtypes of an XML data type, you can use extension or 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 an XML schema base type to a derived type or extension type.
When your input message or your output message is the IBM provided JSON domain object or JSON domain array message, you can redefine the Data element that is of type anyType by using the Cast function. For more information, see Modeling a JSON message for use in a message map by using an equivalent XML schema model.
You can also use the JSON schema "oneOf" and "anyOf" keywords, to structure and combine more complex JSON schema. For more information, see Casting with JSON schema types and JSON schema requirements for message maps.
To redefine an element in your input or output model by using the Cast function, complete the following steps:
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).