从 DSS 服务器获取 json 响应时出错:“使用 JsonWriter 写入输出流时出错"、“详细信息":“" [英] Error in getting json response from DSS server: "Error while writing to the output stream using JsonWriter","detail":""
问题描述
从我的 dss 服务请求 json 响应时出现以下错误.
I'm getting following error while requesting json response from my dss service.
{"Fault":{"faultcode":"soapenv:Server","faultstring":"Error while writing to the output stream using JsonWriter","detail":""}}
我通过的 curl 请求是
curl request which i pass is
curl -X GET -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:9764/services/userdetails/test
如果我删除接受标头,我会得到正确的 xml 响应.
I am getting the proper xml response if i remove accept header.
奇怪的是,如果我在同事的笔记本电脑上运行相同的 dss 服务,我会使用上述 curl 命令获得正确的 json 响应.由于我的电脑出现此错误,我的电脑中的某些配置已更改.
Strange thing is if i am running the same dss service from my colleague's laptop, i m getting the proper json response with that above curl command. Some configuration has changed in my pc because of that i'm getting this error in my pc.
我无法在我的电脑中找到发生了什么变化,因此我收到了这个错误.
I am not able to find what has changed in my pc because of which i'm getting this error.
推荐答案
我最近也遇到了同样的情况.我希望调试并找到原因,但还没有机会.
I also experienced the same recently. I was hoping to debug and find the cause, but didn't get a chance yet.
但是,更改 respository/conf/axis2/axis2.xml
中的 application/json
格式化程序和发送器实现解决了该问题.为此,您可以取消注释/注释掉以下内容.
However, changing application/json
formatter and sender implementations in respository/conf/axis2/axis2.xml
resolved the issue. For that, you can uncomment/comment-out followings.
<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" /-->
希望这会有所帮助.
这篇关于从 DSS 服务器获取 json 响应时出错:“使用 JsonWriter 写入输出流时出错"、“详细信息":“"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!