Topic
  • 5 replies
  • Latest Post - ‏2012-04-17T07:11:41Z by Daviiid
Daviiid
Daviiid
388 Posts

Pinned topic convert SOAP message in hex

‏2012-04-13T18:04:42Z |
Hi

I need to insert in a db2 database all soap messages arriving in a WSP (in a blob column).

I try to do this with a xslt for a non-xml message and it works perfectly --> dp:radix-convert(dp:binary-encode(/object/message/node()),64,16)

But, i want to do that with xslt for xml message. The problem is in this case, i successfully insert data in blob but all tags disappears and only values are insert.

Exemple.
If i want to insert this xml message : <flux><test>SuperInsertTest</test></flux> just SuperInsertTest is insert
Updated on 2012-04-17T07:11:41Z at 2012-04-17T07:11:41Z by Daviiid
  • Liv2luv
    Liv2luv
    573 Posts

    Re: convert SOAP message in hex

    ‏2012-04-13T19:00:18Z  
    Are you using <xsl:value-of select="$something"/> or <xsl:copy-of select="$something"/> with-in the xsl:message instruction.
  • Daviiid
    Daviiid
    388 Posts

    Re: convert SOAP message in hex

    ‏2012-04-13T19:29:18Z  
    • Liv2luv
    • ‏2012-04-13T19:00:18Z
    Are you using <xsl:value-of select="$something"/> or <xsl:copy-of select="$something"/> with-in the xsl:message instruction.
    I tested both

    <xsl:template match="/">

    <xsl:variable name="test1"><xsl:copy-of select="."/></variable>
    <xsl:variable name="testHex1" select="dp:radix-convert(dp:binary-encode($test1),64,16)"/>

    <xsl:variable name="test2"><xsl:value-of select="."/></variable>
    <xsl:variable name="testHex2" select="dp:radix-convert(dp:binary-encode($test2),64,16)"/>

    </xsl:template>

    testHex1 and testHex2 same result : juste value and not name of tag
  • HermannSW
    HermannSW
    7069 Posts

    Re: convert SOAP message in hex

    ‏2012-04-13T19:47:47Z  
    • Daviiid
    • ‏2012-04-13T19:29:18Z
    I tested both

    <xsl:template match="/">

    <xsl:variable name="test1"><xsl:copy-of select="."/></variable>
    <xsl:variable name="testHex1" select="dp:radix-convert(dp:binary-encode($test1),64,16)"/>

    <xsl:variable name="test2"><xsl:value-of select="."/></variable>
    <xsl:variable name="testHex2" select="dp:radix-convert(dp:binary-encode($test2),64,16)"/>

    </xsl:template>

    testHex1 and testHex2 same result : juste value and not name of tag
    Hi David,

    you need to serialize XML for being able to access the "tags".
    The result is a string, and that does not need dp:binary-encode(), dp:encode(_, 'base-64') is enough here.

    Please try
    <xsl:variable name="test1"><dp:serialize select="."/></variable>
    <xsl:variable name="testHex1" select="dp:radix-convert(dp:encode($test1, 'base-64'),64,16)"/>
    


     
    Hermann <myXsltBlog/>
    Updated on 2014-03-25T02:58:03Z at 2014-03-25T02:58:03Z by iron-man
  • Liv2luv
    Liv2luv
    573 Posts

    Re: convert SOAP message in hex

    ‏2012-04-13T19:48:46Z  
    • Daviiid
    • ‏2012-04-13T19:29:18Z
    I tested both

    <xsl:template match="/">

    <xsl:variable name="test1"><xsl:copy-of select="."/></variable>
    <xsl:variable name="testHex1" select="dp:radix-convert(dp:binary-encode($test1),64,16)"/>

    <xsl:variable name="test2"><xsl:value-of select="."/></variable>
    <xsl:variable name="testHex2" select="dp:radix-convert(dp:binary-encode($test2),64,16)"/>

    </xsl:template>

    testHex1 and testHex2 same result : juste value and not name of tag
    Oh, I missed you're doing an encode, sorry. - which needs you to serialize the node-set before applying a binary-encode().

    <xsl:variable name=serialized">
    <dp:serialize select="$test2" omit-xml-decl="yes"/>
    </xsl:variable>

    Please pass the $serialized variable to the dp:binary-encode
  • Daviiid
    Daviiid
    388 Posts

    Re: convert SOAP message in hex

    ‏2012-04-17T07:11:41Z  
    • HermannSW
    • ‏2012-04-13T19:47:47Z
    Hi David,

    you need to serialize XML for being able to access the "tags".
    The result is a string, and that does not need dp:binary-encode(), dp:encode(_, 'base-64') is enough here.

    Please try
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr"><xsl:variable name="test1"><dp:serialize select="."/></variable> <xsl:variable name="testHex1" select="dp:radix-convert(dp:encode($test1, 'base-64'),64,16)"/> </pre>

     
    Hermann <myXsltBlog/>
    Hello Hermann

    as usual... perfect :o)

    Thanks