WSO2 ESB无法将完整的JSON数据转换为XML

yas*_*osi 7 java xml json wso2 wso2esb

我正在建造一个POC.我为Google Plus创建了传递代理服务.没有使用任何代理服务我得到这是我的输出:

 {
   "kind":"plus#person",
   "etag":"\"ExituU7aUpmkkfyD52VulzptThw/4J1clegrhxYC2fsJOu2XWCs1Ewg\"",
   "id":"117488614303967062311",
   "displayName":"Abhi NeoN",
   "name":{
      "familyName":"NeoN",
      "givenName":"Abhi"
   },
   "tagline":"hey guys ! ssup!! check out ma recnt videos... uploaded",
   "gender":"male",
   "aboutMe":"\u003cb\u003ehie, abhishek - ma full name \u003c/b\u003e\u003cdiv\u003e\u003cb\u003em a DANCER ,\u003c/b\u003e\u003c/div\u003e\u003cdiv\u003e\u003cb\u003ei luv ma dancing .\u003c/b\u003e\u003c/div\u003e\u003cdiv\u003e\u003cb\u003ei care ma dancing ,\u003c/b\u003e\u003c/div\u003e\u003cdiv\u003e\u003cb\u003ei jus hv a gr8 thng in me dats ma dancing.\u003c/b\u003e\u003c/div\u003e",
   "relationshipStatus":"single",
   "url":"https://plus.google.com/117488614303967062311",
   "image":{
      "url":"https://lh6.googleusercontent.com/-tF-ip0tUxD4/AAAAAAAAAAI/AAAAAAAAAAA/WKI3USUh_DA/photo.jpg?sz=50"
   },
   "urls":[
      {
         "value":"https://plus.google.com/117488614303967062311",
         "type":"profile"
      },
      {
         "value":"https://www.googleapis.com/plus/v1/people/117488614303967062311",
         "type":"json"
      }
   ],
   "organizations":[
      {
         "name":"our lady of nazareth high school",
         "title":"science",
         "type":"school"
      },
      {
         "name":"",
         "title":"BLUEBYTES",
         "type":"work"
      }
   ]
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用简单的传递服务来做同样的事情时,我只得到:

{
   "kind":"plus#person"
}
Run Code Online (Sandbox Code Playgroud)

我在wso2esb网站上看到他们有一个错误,解决这个错误的解释是收到的json数据格式不正确.但现在我该如何解决这个问题.我的意思是他们可以在esb将其转换为json数据之前操纵json数据.

小智 5

我们已在最新版本的ESB(版本4.5.0)中解决了此问题.默认情况下,它附带了JSONMessageFormatter/JSONBuilder,它可以处理具有多个密钥的JSON有效负载.

我们还提出了另一种处理消息流的解决方案,它涉及不同类型的JSON < - > XML(或JSON < - > JSON)转换.JSONStreamBuilder并且JSONStreamFormatter可以用于使用'script'介体实现这样的场景.看看ESB 4.5.0中的示例#441.

运行样本#441;

  • 在repository/conf/axis2/axis2.xml文件中添加JSONStreamBuilderJSONStreamFormatter作为JSON的构建器和格式化程序
  • 部署SimpleStockQuoteService
  • 启动示例axis2server
  • 使用' ant newjsonclient' 运行JSON客户端