IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Building mediation flows > Transforming messages

Mapping weakly typed elements using the set message type mediation primitive

When you want to work with weakly typed elements such as xsd:any, xsd:anyType and xsd:anySimpleType, use the Set Message Type mediation primitive. You can also use the primitive to access elements in substitution groups, and to cast a concrete type to another concrete type as long as the types are related, such as from an int type to a double.

The payload of messages processed by mediation flows is defined as business objects, and is carried in the body of the service message object (SMO). The business object definitions describe the message structure in terms of the fields they contain, the type of each field, and the number of occurrences of each field. A field in a business object can be a strong type, which means its type and internal structure are known, or it can be a weak type, in which case the business object definition allows more than one type of data to occur in the field.

The Set Message Type primitive allows you to ‘overlay' message fields in the SMO with type information that is different from the type described in the original business object definition. This is useful when the business object definition contains weakly-typed field definitions, but you know that content of a particular data type will be present in the instance message at run time.

You can manipulate strong-type fields more easily than weak-type because their structure and type is known. Using the Set Message Type you can cast a weakly-typed field to a strongly typed field. Primitives that are connected to the output terminal of Set Message Type can then access the elements to which the any type element was cast.

For example, you can use the XML map editor or the business object map editor to view the fields with the type that was cast instead of xsd:any, xsd:anyType, or xsd:anySimpleType.

You can then manipulate the content of these fields.

To use the Set Message Type primitive:


Procedure

  1. In the mediation flow editor, under the Transformation group, click the Set Message Type primitive and drop it onto the canvas.
  2. Wire the input terminal to have access to the SMO structure.
  3. Right-click the primitive and select Show in Properties. In the Properties view, click Details.

  4. In the Details tab, click Add... and then click Edit... beside to the Weakly typed field text box, to select the field you want to refine.

  5. In the XPath Expression Builder window, navigate the SMO structure and click the field you want to add it to the expression. Click Finish.

  6. To see a list of types, click Browse next to the Actual field type text box. Select a type, click OK and then click Finish.

Transforming messages