我已經使用嵌套查詢定義了一個restful服務。輸出映射在XML中定義。我作爲XML得到了適當的迴應。但是,如果我要求使用接受的JSON響應:應用/ JSON我得到WSO2DSS 3.5.1 - 來自REST式服務的JSON響應中的問題
{
"Fault": {
"faultcode": "soapenv:Server",
"faultstring": "Error while writing to the output stream using JsonWriter",
"detail": ""
}
}
我得到異常低於3.5.0,我發現一個JIRA說,它是固定在3.5.1。所以我在3.5.1中試過,現在我沒有得到異常但是輸出相同。
javax.xml.stream.XMLStreamException: Invalid Staring element
請注意,我也試圖在我的查詢,但沒有使用escapeNonPrintableChar="true"
選項。奇怪的是它適用於不同的數據集。只有一個特定的數據集正在拋出這個輸出。
我已經改變了JSON格式化程序如下,並得到它的工作,但有一個問題。
<messageFormatter contentType="application/json" class="org.apache.axis2.json.JSONMessageFormatter"/>
<!--messageFormatter contentType="application/json" class="org.apache.axis2.json.gson.JsonFormatter"/-->
<messageBuilder contentType="application/json" class="org.apache.axis2.json.JSONOMBuilder"/>
<!--messageBuilder contentType="application/json" class="org.apache.axis2.json.gson.JsonBuilder" /-->
如果我使用上面的格式化程序,則空值不能正確表示。就像我得到
"Person": {
"Name": {
"@nil": "true"
}
,但我想它(比如用來給其他JSON格式)
"Person": {
"Name": null
}
任何幫助,請。這個區域還有一個bug嗎?