我正尝试使用此配置调用DSS中的服务:
<query id="getAllPerformancesQuery" useConfig="lta_catalogue">
<sql>select idperformance, name, description from performance</sql>
<result element="performances" rowName="performance">
<element column="idperformance" name="idperformance" xsdType="integer"/>
<element column="name" name="name" xsdType="string"/>
<element column="description" name="description" xsdType="string"/>
</result>
</query>
<resource method="GET" path="performances">
<call-query href="getAllPerformancesQuery"/>
</resource>
通过肥皂呼叫,dss响应良好:
<performances xmlns="com.lta.catalog.CatalogDSS">
<performance>
<idperformance>1</idperformance>
<name>Introduction</name>
<description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</performance>
</performances>
但是通过休息调用,列描述中的空值会响应:
{"Fault":{"faultcode":"soapenv:Server","faultstring":"Error while writing to the output stream using JsonWriter","detail":""}}
在日志中有这个例外:
Caused by: java.lang.IllegalStateException: Dangling name: description
at com.google.gson.stream.JsonWriter.close(JsonWriter.java:302)
at com.google.gson.stream.JsonWriter.endObject(JsonWriter.java:277)
at org.apache.axis2.json.gson.GsonXMLStreamWriter.writeEndElement(GsonXMLStreamWriter.java:394)
at org.wso2.carbon.dataservices.core.engine.XMLWriterHelper.endElement(XMLWriterHelper.java:110)
at org.wso2.carbon.dataservices.core.description.query.Query.writeResultEntry(Query.java:400)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processNormalQuery(SQLQuery.java:857)
... 54 more
有什么想法吗?
答案 0 :(得分:2)
编辑respository / conf / axis2 / axis2.xml并更改正确的messagebuilder和formatter
<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" /-->
答案 1 :(得分:1)
此问题已在DSS 3.2.2版本中修复。相关的JIRA可以在here
中找到