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


Graphically modeling and transforming a JSONP message in a message map

In the Graphical Data Mapping editor, you can use the Add User-Defined function or the Cast function to create a JSONP message, or to transform a message that is modeled in a different message domain into a JSONP message.

About this task

A JSONP service, or Remote JSON service, is a web service that returns JSON data padded with a user-defined JavaScript function call.

When you configure a message map to transform a JSON message, the Graphical Data Mapping editor puts the JSON padding in the top-level Padding element, and the JSON data under the Data element. If JSON padding is detected by an input node, the name of the client-side script is placed in the top-level Padding element.

You can also use the Graphical Data Mapping editor to configure a message flow to provide a JSONP response. When a JSON message is serialized and the top-level Padding element has a value, the JSON message is wrapped in the provided client-side script name.

Procedure

To create a JSONP service, complete the following steps:

  1. Create a message map. Select one of the following JSON supplied models as the output of your map:
    • JSON (JSON object message model supplied by IBM) to create a JSON object message
    • JSON (JSON array message model supplied by IBM) to create a JSON array message

    For more information, see Creating a message map.

  2. Qualify the Data element on the output JSON message by using the Add User-Defined function or the Cast function. This data is wrapped in a JSONP java script function name.

    For more information, see Defining user-defined elements and Casting elements in a message map.

  3. Define transforms between the input elements and the output elements.

    For more information, see Specifying a transform (mapping operation).

  4. Define a transform to set the element Padding to a string that contains the name of a user-defined JavaScript function that the target calls to process the sent JSON data.
    • You can use the Move transform to set the JSON padding element on the output message.
    • You can use the Assign transform to provide a character value for the JSON padding element on the output JSON message.

What to do next

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


sm12015_.htm | Last updated 2015-03-27 19:28:55