• 1 reply
  • Latest Post - ‏2013-04-17T22:31:52Z by HermannSW
268 Posts

Pinned topic Binary node

‏2013-04-17T14:51:57Z |

Can we set headers, with binary node values?

<xsl:variable name="binContent" select="dp:binary-decode(/image/imagebase64)"/>

<dp:set-request-header name="'sampleHeader'" value='$binContent'/>


The reason being, the backend expects the chars &gt; &lt; , as it is to be part of header. Using dp serialize select the xml nodes are converted to &lt; However the greater than symbol is not converted.

So thought of treating as binary. Please let me know if this works

  1. replace all '3c' in hex(stands for less than), with '26.....', the hex for &lt;
  2. replace 3e also with hex for &gt;
  3. The whole hex string to be converted to base64
  4. the base64 to be converted to binary, using binary-decode, as updated above
  5. set the request header name as above
  • HermannSW
    6286 Posts

    Re: Binary node


    Hi Maneesh,

    so you seem to want both entities escaped in header.

    Please don't try to go over binary nodes, <dp:set-request-header ...> expects "xs:string" arguments.

    I started with
    <dp:set-request-header name="'hdr1'" value="'1&lt;2&gt;3&amp;4'"/>

    and that resulted in
    hdr1: 1<2>3&4

    which I verified via packet capture and Wireshark.

    Next I tried
    <dp:set-request-header name="'hdr1'" value="'1&amp;lt;2&amp;gt;3'"/>

    and it results in what you seem to want (packet capture, Wireshark):
    hdr1: 1&lt;2&gt;3

    This can also be seen in verbose output mode of "curl":

    $ curl --data-binary "<x/>" http://dp3-l3:2049 -v 2>&1 | grep hdr1
    < hdr1: 1&lt;2&gt;3

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>