Converting bytes message to text or xml message - Forum - Technology Partner - Progress Community

Converting bytes message to text or xml message


Converting bytes message to text or xml message

  • 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="" xmlns:hds="" xmlns:xsl="">

    <xsl:template match="/">

    <xsl:for-each select="CONT/Contractors">



    <xsl:attribute name="event">Notifyxsl:attribute>


    <CreationDateTime><xsl:value-of select="apputil:getCurrentFormattedDate()">xsl:value-of>CreationDateTime>





    <xsl:attribute name="action">AddChangexsl:attribute>


    <xsl:value-of select="@TaskID">xsl:value-of>





    <LABORCODE><xsl:value-of select="hds:getCompany(string(@CompanyID))">xsl:value-of>LABORCODE>


    <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>