首页 > 解决方案 > Datapower - 转换查询不将 JSON 转换为 JSONX

问题描述

我有一个以前工作过的非常简单的用例。但是在这个新的mpgw中,流量是

url-open 到 API 并获取 json 响应并在发送到客户端之前处理该响应,它不起作用。

我在 xslt 中尝试过以下内容

  <xsl:variable name="Response">
     <dp:url-open target="{$routing_URL}" response="responsecode-binary" http-method="get" ssl-proxy="client:mpgw_Client_SSL_Profile" timeout="'10'">
     </dp:url-open>
   </xsl:variable>

 <!-- Decoding the binary node so that it can be further used in the processing rules -->
   <xsl:variable name="json">
    <xsl:copy-of select="dp:decode(dp:binary-encode($Response/result/binary/node()), 'base-64' )" /> 
   </xsl:variable>

   <dp:set-variable name="'var://context/service_session/json'" value="string($json)" />
   <xsl:value-of select="$json"/>

我可以看到获取 json 数据的上下文变量。但是,当我在此转换操作之后使用转换查询参数时,它会失败并出现以下错误:

Convert HTTP produced invalid XML: Incomplete markup or missing 
document element at offset 39 of ...

我也尝试在变换的输出和下一个变换的输入中使用上下文 __JSONASJSONX,但数据也没有转换为 JSONX。

我已经阅读了其他论坛,其中此错误意味着数据为空,但我可以在上下文变量中看到数据。

知道这里可能出了什么问题吗?

标签: ibm-datapowerjsonx

解决方案


推荐阅读