【问题标题】:How to return more than 1 record on REST service with WSO2 DSS?如何使用 WSO2 DSS 在 REST 服务上返回超过 1 条记录?
【发布时间】:2016-10-17 13:30:57
【问题描述】:

我将 WSO2 DSS 与 MySQL 数据库一起使用。如果我只从数据库中请求 1 条记录,它就可以正常工作。但是当我尝试在 REST 服务中选择多个注册表时,它不起作用。错误是:

{
    "Fault": {
    "faultcode": "soapenv:Server"
    "faultstring": "Error while writing to the output stream using JsonWriter"
    "detail": ""
    }-
}

我的数据服务:

<data name="item" transports="http https local">
<config enableOData="false" id="default">
  <property name="carbon_datasource_name">mysql</property>
</config>
<query id="selectActiveItems" useConfig="default">
  <sql>SELECT descricao FROM ITEM WHERE ativo = true and id_responsavel = ?</sql>
  <result escapeNonPrintableChar="true" outputType="json">{  "_item": {  "descricao":$descricao}}</result>
  <param name="id_responsavel" ordinal="1" sqlType="INTEGER"/>
 </query>
  <resource method="POST" path="selectActiveItems">
   <call-query href="selectActiveItems">
     <with-param name="id_responsavel" query-param="id_responsavel"/>
    </call-query>
   </resource>
</data>

有没有我没有设置的属性要设置?

【问题讨论】:

    标签: rest wso2 wso2dss dss


    【解决方案1】:

    从数据库响应多于 1 条记录的正确输出是:

    <result escapeNonPrintableChar="true" outputType="json">
      {"_itens":{"item": [ {"nome":$nome,"descricao":$descricao} ] }}
    </result>
    

    【讨论】:

      【解决方案2】:

      我以前见过这种情况,可以通过更改消息构建器/格式化程序来解决。

      看我的回答here

      【讨论】:

        猜你喜欢
        • 2014-02-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多