【发布时间】:2014-01-28 13:19:06
【问题描述】:
从 WSO2 ESB 4.8 开始 - 原生支持 json,信息可以在 WSO2 网站中找到。参考下面的博客 w.r.t.json formatter & builder
http://charithaka.blogspot.co.uk/2013/10/the-difference-between-json-streaming.html
我的用例是在 HTTP/1.1 REST 上使用 JSON 格式,这里要注意的要点是:
- 不要在 ESB 中转换 json 数据(在 ESB 中保持原生的 json 格式)
- 使用 json 格式的中介操作 json(原生支持 json 的中介 - 脚本/自定义中介)
尝试使用:
org.apache.axis2.json.JSONStreamBuilder
org.apache.axis2.json.JSONStreamFormatter
如 Charitha 博客中所述。现在,我没有看到 json 在soap消息中被转换为soap(使用Log Mediator)。
这是否意味着,WSO2 ESB 4.8 不会在后台将 json 请求转换为soap,以避免某些数据格式的数据丢失(例如,数组等,如https://github.com/erny/jsonbuilderformatter 中所述)
谁能分享我使用 org.apache.axis2.json.JSONStreamBuilder 和 org.apache.axis2.json.JSONStreamFormatter(或)任何其他 json 构建器和格式化程序记录/操作 json 消息的示例,而无需转换为肥皂消息在消息上下文中。
【问题讨论】:
-
以下链接中的有用信息:org.apache.synapse.commons.json.JsonStreamBuilder/JsonStreamFormatter docs.wso2.org/display/ESB480/…