【发布时间】:2018-09-30 11:20:34
【问题描述】:
我正在创建一个调用端点的 wso2,然后过滤响应只是为了发回一个字段,但由于某种原因,esb 回答了所有的 json
我有类似的东西:
<resource methods="POST" uri-template="/ESB">
<inSequence>
<call description="">
<endpoint key="CountryEP"/>
</call>
<property description="" expression="json-eval($.zones[0].countryCode)" name="uri.var.countryCode" scope="default" type="STRING"/>
<log description="">
<property expression="fn:concat('countryCode ', get-property('uri.var.countryCode')) " name="property_name"/>
</log>
<send buildmessage="true" description=""/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
还有我的端点
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="CountryEP" xmlns="http://ws.apache.org/ns/synapse">
<http method="get" trace="enable" uri-template="http://api.timezonedb.com/v2/list-time-zone?key=6HW6EJUENX9T&format=json&country={uri.var.country}"/>
</endpoint>
正如您在上面看到的,我向 API 发送一个参数,API 用 json 回答,然后我尝试只解析一个字段(使用属性)并且我得到了正确的值:
INFO - LogMediator 至: http://www.w3.org/2005/08/addressing/anonymous,WSAction:, SOAPAction: , 消息 ID: urn:uuid:97744789-8c88-41ff-9475-870761016834,方向:请求, property_name = countryCode CA
但我不能只返回那个值,esb 会返回所有 json... 想法?
提前致谢,
编辑:也尝试使用属性调解器上的 RESPONSE 属性
【问题讨论】:
-
发布您想要的示例响应。
标签: wso2