Creating a message map programmatically

Use the Graphical Data Map Specification Language to create a message map programmatically.

About this task

The file msl.xsd provides the XML schema that describes the Graphical Data Map Specification Language, also known as MSL. This file is available in the Graphical Data Mapping component Version 1040, and later versions.

You can find the msl.xsd file inside the com.ibm.msl.mapping.api_7.5.0.jar jar file.

In IBM® Integration Bus, you can find the jar file in any of the following directories:
  • In a Windows platform installation: C:\Program Files\IBM\IIB\10.0.0.0\server\ct\lib\
  • In a Linux® platform installation: install_dir/iib-10.0.0.0/server/ct/lib/

You can create a map programmatically when you have meta-data that defines the transformation logic that needs to be applied to an input message to produce the output. For example, you can write a JAXB based program that builds the map using JAXB classes generated from the provided MSL schema. The program reads XML data that defines the input elements to be mapped and the output elements.

Procedure

You must perform the following steps to programmatically generate a map file:

  1. Create a template map in the Graphical Data Mapping editor.

    Deploy and test your template map in the run time to confirm that the message transformation is correct.

  2. Inspect the MSL XML content in the template map.

    Use the MSL schema to identify the mapping constructs and the definition of the points of variation for the template map.

  3. Develop the scripts and programs to generate the MSL XML for the new maps that you plan to generate programmatically.

    When you use a development approach based on JAXB, the bindings file msl_jaxb_bindings.xml available in the com.ibm.msl.mapping.api_7.5.0.jar file provides the minimal required bindings.

  4. Validate the syntax of each generated map file (.map) against the provided MSL schema msl.xsd.
  5. Import each generated map file into your development environment. Then, check that all the referenced resources, such as xsd files, are imported into the relevant project types. Ensure the relevant builder is invoked to semantically validate each generated map file. Also, check using the Graphical Data Mapping editor that the transforms in your generated map are correct and free of error and warnings.
  6. Package and deploy into the run time your programmatically generated maps. Then, test your application to confirm that the message transformation is correct.

    Check that each generated map file is built into the relevant deployment artifact.

What to do next

Deploy and test the message map. For more information, see Troubleshooting a message map.