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

how to convert json to path variable data in wso2 esb?

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

{"id":"1"} 

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

您应该构建 Uri 模板路径,属性 以前缀 uri.var 命名。 例如命名:uri.var.myId.并从 JSON 中提取有趣的值。 接下来,您可以在方括号中的 uri 模板中的 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 documentation

中描述的更准确