I don't want to get too caught up in your screenshot there, but, I'm seeing a 500 error. What would you expect to see in the binary node there, or is this just an intentional example?
I also think I have a parenthesis out of order in by code snippet above: apologies for that.
Going from the original example posted, it appears the content of the binary node is already base64 encoded. You will first need to decode from base64. If that, then, contains a string parsable to JSONx, then you should be good to go. It seems strange to me you'd binary-encode a binary node if that node is already base64 encoded.
------------------------------
Joseph Morgan
------------------------------
Original Message:
Sent: Thu November 16, 2023 01:38 AM
From: Mahender Batta
Subject: How to catch the response of type text/xml in the DataPower XSLT using dp:url-open?
Dear @Joseph Morgan,
Response Content-Type is text/plain; charset=utf-8.
------------------------------
Mahender Batta
Original Message:
Sent: Wed November 15, 2023 09:25 AM
From: Joseph Morgan
Subject: How to catch the response of type text/xml in the DataPower XSLT using dp:url-open?
So at this point, I'm a bit lost. What is the content-type of $callServeurl/result/binary/node()? If the response is, in fact, XML, would it not already be base64 encoded?
It seems to me if the server is responding with XML, you simply need to:
dp:stringToJSONx(dp:decode($callServeurl/result/binary/node()), 'base-64'))
Have you tried this?
------------------------------
Joseph Morgan
Original Message:
Sent: Wed November 15, 2023 09:04 AM
From: Mahender Batta
Subject: How to catch the response of type text/xml in the DataPower XSLT using dp:url-open?
Thank you @Joseph Morgan,
I'm using following xslt code to read the response,
<xsl:variable name="callServeurl"> <dp:url-open target="{$url}" response="responsecode-binary" content-type="application/json" http-headers="$httpHeaders" http-method="POST"> <xsl:copy-of select="$requestBody"/> </dp:url-open> </xsl:variable> <xsl:variable name="Response"> <xsl:copy-of select="dp:stringToJSONx(dp:decode(dp:binary-encode($callServeurl/result/binary/node()),'base-64'))"/> </xsl:variable>
Could you please advise?
------------------------------
Mahender Batta
Original Message:
Sent: Wed November 15, 2023 08:54 AM
From: Joseph Morgan
Subject: How to catch the response of type text/xml in the DataPower XSLT using dp:url-open?
This looks like base64 encoding to me. Have you tried dp:decode?
https://www.ibm.com/docs/en/datapower-gateway/10.0.x?topic=functions-dpdecode
------------------------------
Joseph Morgan
Original Message:
Sent: Wed November 15, 2023 08:05 AM
From: Mahender Batta
Subject: How to catch the response of type text/xml in the DataPower XSLT using dp:url-open?
Dear All,
I have a case where the backed server is responding with the Content-Type="text/xml".
How to read the response data in the XSLT?
------------------------------
Mahender Batta
------------------------------