I have a working custom java service that converts bytes content of messages into utf8 text/xml content and the other way around. It works as expected, but I would like to change that to be more generic (no need for specific jar file) - that is: To use a transformation service (or similar) configured by xslt or a rules file. I have tried to use a routing service with a javascript rules file, but that does not seem correct - it is after all a routing service.
What service type should be used?
What is easier javascript or xslt?
Should I perhaps keep the custom java service?
Hello,
Have you considered calling a static Java method from your XSLT? Yours would look different, but here is what I have used in the past. A Java Service would work but the XSLT would be a little more lightweight if you could get it to work. You would pass the byte content to your method (ex: String convert(byte[] bytes)). If this doesn't acheive what you need, I would just use a Custom Service.
<
xsl:stylesheet version="2.0" xmlns:apputil="com.company.app.util.AppUtil" xmlns:hds="com.company.app.jdbc.HibernateDatastore" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="CONT/Contractors">
<AIMLABQUALInterface>
<Header>
<xsl:attribute name="event">Notifyxsl:attribute>
<SenderID>PERSONAPPSenderID>
<CreationDateTime><xsl:value-of select="apputil:getCurrentFormattedDate()">xsl:value-of>CreationDateTime>
Header>
<Content>
<AIMLABORQUAL>
<QUALIFICATION>
<xsl:attribute name="action">AddChangexsl:attribute>
<QUALIFICATIONID>
<xsl:value-of select="@TaskID">xsl:value-of>
QUALIFICATIONID>
<ORGID>TSORGID>
<QUALTYPE>OQQUALTYPE>
<LABORQUAL>
<LABORCODE><xsl:value-of select="hds:getCompany(string(@CompanyID))">xsl:value-of>LABORCODE>
<CERTIFICATENUM>0CERTIFICATENUM>
<EFFDATE><xsl:value-of select="apputil:formatDate(string(@MaxQualDate))">xsl:value-of>EFFDATE>
<VALIDATIONDATE><xsl:value-of select="apputil:formatDate(string(@MaxQualDate))">xsl:value-of>VALIDATIONDATE>
<ENDDATE><xsl:value-of select="apputil:formatDate(string(@MaxExpirationDate))">xsl:value-of>ENDDATE>
<AIMQUALTYPE>OQAIMQUALTYPE>
LABORQUAL>
QUALIFICATION>
AIMLABORQUAL>
Content>
AIMLABQUALInterface>|
xsl:for-each>
xsl:template>
xsl:stylesheet>