Message data change/transformation in simple pass-through scenario
Recently I’ve seen the question about the ability to change messge data (or even message structure) in file pass-through scenario.
As we speak about “pass-through” it means that we didn’t do any ESR development, thus we have no existing mapping objects in hands.
Ok, let’s take that question as basis for our test scenario.
We have a source message containing some employees info in the form of .csv flat file:
ID0002,Mary Ann Key,20000321,Female
And we want to send this message to receiver system in XML format:
This pass-through scenario can be easily done by setting up File Content Conversion in our sender File channel and creating ICO object with dummy interfaces/namespaces in Integration Directory.
Now let’s slightly change our requirements and say that we want to have emplyee’s birth date in “dd/mm/YYYY” format in our target message (as per requirement in question mentioned above). As I’m lazy enough to start with ESR development or custom adapter module implementation in this case I’d prefer to unleash the power of XSL transformation and let the MessageTransformBean do the most of work instead of me 😉 .
XSL transformation for data format change:
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform“>
<xsl:value-of select=”concat(substring(., 7, 2), ‘/’, substring(., 5, 2), ‘/’, substring(., 1, 4))”/>
We put this transformation to our PI server file system and just add the MesasgeTransformBean in our receiver File communication channel with parameters:
Transform.Class = com.sap.aii.af.sdk.xi.adapter.XSLTConversion
XSLTConversion.XSLTFileName = /usr/sap/PID/SYS/global/NOVATOUR/Inbound/XSLT/BC_Train_Test.xsl
As the result we can see desired changes in message data: