2014-09-23 33 views
1

我試圖調用服務在具有這種配置的DSS:WSO2 DSS:與空數據庫REST調用值

<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> 

但隨着REST調用,則在列說明響應空值:

{"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 

任何想法?

回答

2

編輯程序存儲庫/ conf目錄/ Axis2的/ axis2.xml和更改權messagebuilder和格式化

<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" /--> 
+0

thankx man this work .. – MaxExplode 2016-07-28 01:17:05

1

此問題已在DSS 3.2.2版本。相關的JIRA可以從here