IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM Resource Adapters > Integrating IMS MFS applications in BPEL processes

Custom mediation and transformations

For IMS™ MFS applications, you must add custom mediation code and context objects to set the convID and convEnded values and to store contextual information for some of the operations.


Mediation primitives and transformations

For MFS applications, you can use custom mediation under the transformation grouping to set or get the convID and convEnded properties. This custom mediation code is added by dragging a custom mediation object on to the canvas, wiring it, and then adding the code in the Details tab. In a request flow, the custom mediation is typically used to set the convID in the message before it is sent to the service provider at the end of the request flow. Business graphs are required for MFS conversational applications in order to dynamically set and get the useConvID, convID and convEnded conversational properties. These properties are set in the properties element of the business graphs. Because these are interactionSpec properties from the IMS TM resource adapter, the pattern for the property name used when you set or get these properties is IS interactionSpec_property_name.

In a response flow, the custom mediation is typically used to get the convID and convEnded properties before it is sent to the service requester at the end of the response flow.


Custom mediation code

For the FirstIteration operation, you must add the following code to your custom mediation in the request flow. Set useConvID to true to initiate the conversation. Add this code to the Details area on the Properties tab. Modify the data objects based on the MIDs in your application. End the code with the out.fire(smo); statement.

// Retrieve the business graph data object  1 commonj.sdo.DataObject body = smo.getDataObject("body");
// Modify the following data objects based on your application commonj.sdo.DataObject IVTCBMI1_obj = body.getDataObject("IVTCBMI1");
commonj.sdo.DataObject IVTCBMI1Input_obj = IVTCBMI1_obj.getDataObject("IVTCBMI1Input");

// Create the business graph's properties element
commonj.sdo.DataObject prop_obj = IVTCBMI1Input_obj.createDataObject("properties");
// Set userConvID to true
 2 prop_obj.setBoolean("ISuseConvID",true);
out.fire(smo); // propagate the service message object to the primitive that is wired to the 'out' terminal

You can determine the DataObject property names to use by examining the service message object details for the primitive. When you move the mouse pointer over the custom mediation node, an interface icon is displayed. Click the interface icon, and the details of the object is available in the Service Message Object Details section.

  1. Business object instances are represented by the commonj.sdo.DataObject interface. For more information about the commonj.sdo.DataObject classes and SDO programming, see the samples on the business process management samples and tutorials site at http://publib.boulder.ibm.com/bpcsamp/index.html.

  2. The conversation ID is assigned by IMS when the useConvID property is set to true. The EIS binding in the JCA framework expects that the interactionSpec property names must begin with the prefix IS, followed by the property name.

For the FirstIteration operation, you must add the following code to your custom mediation in the response flow in order for the conversation ID info to pass correctly. Add this code to the Details area on the Properties tab. Customize the code based on your business object names and the field names used to store the convID and convEnded values. End the code with the out.fire(smo); statement.

// Get ConvID and convEnded from the transient context
commonj.sdo.DataObject context_obj = smo.getDataObject("context");
commonj.sdo.DataObject tran_obj	= context_obj.getDataObject("transient");
commonj.sdo.DataObject prop_obj = tran_obj.getDataObject("properties");
String conv_id = prop_obj.getString("ISconvID");
String convEnded = prop_obj.getString("ISconvEnded");

// Set "convid" and "convEnded" into your business object commonj.sdo.DataObject body_obj = smo.getDataObject("body");
commonj.sdo.DataObject first_iteration_response_obj	= body_obj.getDataObject("FirstIterationResponse");
commonj.sdo.DataObject output1_obj = first_iteration_response_obj.getDataObject("output1");
output1_obj.setString("convid", conv_id);
output1_obj.setString("convEnded", convEnded);
out.fire(smo); // propagate the service message object to the primitive that is wired to the 'out' terminal

See the Create a mediation flow topic for complete steps on how to mediate a MFS conversational application.


Transient context, correlation context, and shared context

The transient context, correlation context, shared context are user-provided business objects that are set at the input node of a mediation flow.

Integrating IMS MFS applications in BPEL processes


Related tasks:

convID property in the IMS interaction specification
convEnded property in the IMS interaction specification