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:
ID0001,John Smith,20011001,Male
ID0002,Mary Ann Key,20000321,Female
And we want to send this message to receiver system in XML format:
</Employee>
</Employee>
</Employees>
</ns:MT_Employees_List>
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 :wink: .
XSL transformation for data format change:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="DateOfBirth">
<DateOfBirth>
<xsl:value-of select="concat(substring(., 7, 2), '/', substring(., 5, 2), '/', substring(., 1, 4))"/>
</DateOfBirth>
</xsl:template>
</xsl:stylesheet>
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:
</Employee>
</Employee>
</Employees>
</ns:MT_Employees_List>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |