Appreciate for your help in advance:
I am referring to Hermann's article that uses JSONiq to convert json to xml.
https://www.ibm.com/mysupport/s/question/0D50z00006AAxGW/json-to-xml-using-xslt-in-datapower?language=en_USIssue I am facing is I am unable to pipe the output of url-open to dp:xquery-transform function:
<xsl:variable name="response">
<dp:url-open target="{$oAuthDestination}"
http-headers="$finalHeaderForRouting"
response="responsecode-binary"
content-type="{$oauth-resp-content-type}"
ssl-proxy="client:{$sslProfile}"
timeout="120"
http-method="{$targetSecurityHttpMethod}"
>
<xsl:copy-of select="''" />
</dp:url-open>
</xsl:variable>
<xsl:variable name="responseContent">
<xsl:value-of select="dp:decode( dp:binary-encode($response/result/binary/node()), 'base-64' )" />
</xsl:variable>
<xsl:variable name="responsecode" select="$response/result/responsecode/node()" />
<xsl:message dp:type="xsltmsg" dp:priority="debug">
*** responsecode: [
<xsl:value-of select="$responsecode" />
]
</xsl:message>
<xsl:variable name="responseContentAsXML" select="dp:xquery-transform('local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq', $responseContent)"/>
....
I see $responseContent in logs as well as if I just do xsl:copy-of as response.
FYI, I have tried to pass response content like below as well:
Even I tried to call as below and still see the issues;
<dp:set-variable name="'var://context/responseContent'" value="$responseContent" />
<xsl:copy-of select="dp:xquery-transform('local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq', 'var://context/responseContent')"/>
All errors I get with various permutations and combinations are:
1)
mpgw (CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER): Processing of 'local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq' stopped: local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq:5: [JNDY0021] It is a dynamic error if parsing a string to one or several objects or arrays is not successful, or if it results in more than one item and jsoniq-multiple-top-level-items is false.
2)
Processing of 'local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq' stopped: local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq:5: [XPTY0004] For function "{http://jsoniq.org/function-library}flatten/1", the static type of the argument "Unknown" at index 1 does not match the expected type "Unknown".
3)
It is a dynamic error if parsing a string to one or several objects or arrays is not successful, or if it results in more than one item and jsoniq-multiple-top-level-items is false.
mpgw (CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER): dp:xquery-transform(): Use of JSON-XML Hybrid Output Mode in 'local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq' disallowed in dp:xquery-transform
4)
Use of JSON-XML Hybrid Output Mode in 'local:///CUSTOM_SECURITY_AUTH_CONTEXT_PROVIDER/xq/flatten.xq'
disallowed in dp:xquery-transform
Please excuse me to post this issue here. I am supposed to address an issue urgently and wasted for 2+ days already.
Appreciate all your help.
Thanks!