我在从 dss 服务请求 json 响应时收到以下错误。
{"Fault":{"faultcode":"soapenv:Server","faultstring":"Error while writing to the output stream using JsonWriter","detail":""}}
我通过的卷曲请求是
curl -X GET -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:9764/services/userdetails/test
如果删除接受标头,我将得到正确的 xml 响应。
奇怪的是,如果我从同事的笔记本电脑上运行相同的 dss 服务,我将使用上面的curl 命令获得正确的 json 响应。我的电脑中的某些配置已更改,因为我的电脑中出现此错误。
我无法找到我的电脑发生了什么变化,因此出现此错误。
我最近也经历过同样的事情。我希望调试并找到原因,但还没有机会。
然而,改变application/json
格式化程序和发送器实现respository/conf/axis2/axis2.xml
解决了问题。为此,您可以取消注释/注释掉以下内容。
<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" /-->
希望这会有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)