How to use XSL Transformations with MIF’s Publish Channels for Outbound Data

In this part of tutorial we will see how to customize the message going out of MIF to an external system using XSL stylesheets.

To communicate with an external system MIF provides Publish Channels:

A publish channel is the pipeline for sending data asynchronously from the system to an external system. Events that initiate publish channel processing are object events (insert, update, and delete), application initiated calls, and data export.

Basically its used by MIF to dump data out. Now once it’s out it’s the prerogative of the external system how to use it. That external system may expect the data in a certain format and here we will see how to use XSL Maps in

MIF to make sure our message going out conforms (if not completely) to the format.

This post is not about XSL but on how to use it. For better understanding on XSL there are many tutorials available online (XSLT – W3Schools) and we will not be covering them here.

The publish channel can use the following processing layers:

  1. Processing rules – The integration framework provides a rule engine where you can filter and transform the XML message. You can implement rules in the Publish Channel application
  2. User exit – Represents a Java class that you can use to filter data, transform data, and implement business logic. You can use this class as part of an installation/customization
  3. Data processing class – Represents a Java class that you can use to filter, transform data, and implement business logic. Adapters for Oracle and SAP provide processing classes to support integration to these products
  4. XSL map – Represents an XSLT style sheet that you can use to transform data and perform mapping of the XML message to another format

XSL map has a style sheet attached to it. This style sheet if I explain in very simple terms (that’s how I make myself understand) is it takes in an XML as input, reads it, and the rules which we have defined in the XSL file it makes sure the XML is modified according to that.

So, lets say one of the rule is if it comes across an xml tag called WONUM it should change it to WORKORDERNUMBER. The external system might be having a field called WORKORDERNUMBER and we have WONUM in Maximo so the XSL will modify the outbound message to confirm to the format of the external system.

This is a very basic example but actual uses may be quite complex.

Now coming back to MIF. I will be using the out of the box “MXWOInterface” publish channel.

In this example, here is the XML file being output by out of the box Maximo:

<?xml version="1.0" encoding="utf-8"?>
<PublishMXWO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDateTime="2013-05-03T23:20:48+10:00" transLanguage="EN" baseLanguage="EN" messageID="136758724865576826" maximoVersion="7 5 20120713-1120 V7503-157" event="0">
  <MXWOSet>
    <WORKORDER>
      <ACTFINISH xsi:nil="true"/>
      <ACTINTLABCOST>0.0</ACTINTLABCOST>
      <ACTINTLABHRS>0.0</ACTINTLABHRS>
      <ACTLABCOST>0.0</ACTLABCOST>
      <ACTLABHRS>0.0</ACTLABHRS>
      <ACTMATCOST>0.0</ACTMATCOST>
      <ACTOUTLABCOST>0.0</ACTOUTLABCOST>
      <ACTOUTLABHRS>0.0</ACTOUTLABHRS>
      .
      .
      <WORTS4 xsi:nil="true"/>
      <WORTS5 xsi:nil="true"/>
      <WOSEQUENCE xsi:nil="true"/>
    </WORKORDER>
  </MXWOSet>
</PublishMXWO>

I will use the XSL transformation to remove the PublishMXWO and MXWOSet and enclose this XML in ExternalSystemWO XML tag. So after the transformation, it will look like:

<ExternalSystemWO>
  <WORKORDER>
  ...
  </WORKORDER>
</ExternalSystemWO>

Here is the XSL file that transforms the data:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mea="http://www.ibm.com/maximo">
<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>	
 <xsl:template match="/">
	<ExternalSystemWO>
	<xsl:copy-of select="mea:PublishMXWO/mea:MXWOSet/mea:WORKORDER" copy-namespaces="no"/>
	</ExternalSystemWO>
 </xsl:template>
</xsl:stylesheet>

You can copy this and save it to a file named ‘wochanged.xsl’. This file name is used later.

This XSL will be applied to the publish channel MXWOInterface as per the screen shot below:

Publish Channel XSL

In the screen shot if you see the value for XSL Map is ‘psdi.app.workorder.wochanged’.

The XSL file ‘wochanged.xsl’ is copied to MAXIMO application folder and in businessobjects psdi/app/workorder folder and now using a fully qualified class name like a java class, I am using it here as ‘psdi.app.workorder.wochanged’.

This way Maximo knows where the XSL file is located which it will use for transformation of the outbound XML message.

To test this go to External Systems and using Data Export function first try before putting the XSL Map and then after.

Series Navigation
This entry is part [part not set] of 10 in the series Getting Started with MIF

Did You Know...

As Maximo Experts, we have developed several add-on products for Maximo that mobilize the work force, simplifies assignments, provides ad-hoc reporting capabilities and facilitates the seamless integration of Service Requests into Maximo.

Check out our products by clicking on the following links: EZMaxMobile, EZMaxPlanner and EZMaxRequest.

Find Out More

Leave a Reply