如何将json转换为wso2 esb中的路径变量数据?

wso2user

我有一个端点:http://localhost:8080/customer/get/1我想将一个 json 数据发送到 wso2esb 中的 api 并将 id 的值转换为路径变量并将其发送到端点。像这样:

{"id":"1"} 

我该怎么做?请给我一些建议。

莫阿兹

您应该构建 Uri 模板路径,其属性以前缀uri.var命名例如命名:uri.var.myId并从 JSON 中提取有趣的值。接下来,您可以在括号中的 uri-template 中的 http 端点中使用该属性。

对于您的示例,您正在寻找的是这样的:

<property name="uri.var.myId" expression="json-eval($.id)" scope="default" type="STRING"/>
<call>
   <endpoint>
      <http uri-template="http://localhost:8080/customer/get/{uri.var.myId}"/>
   </endpoint>
</call>

wso2esb 4.9.0 文档中有更精确的描述

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章