代码之家  ›  专栏  ›  技术社区  ›  MaxExplode

wso2 DSS值类型不匹配,应为值类型-“dateTime”,但找到-“STRING”

  •  1
  • MaxExplode  · 技术社区  · 8 年前

    我想用wso2-dss将这个对象保存到数据库中。但这表明日期格式有错误。

    Value type miss match, Expected value type - 'dateTime', but found - 'STRING'
    

    post messgae的示例如下

    {
    "insert_subscribe_merchant_operation":
    {
            "customerrefid": 1,
            "merchantrefid": "1",
            "datetime": "2012-03-14T00:00:00+05:30",
            "registereddevice":"1234567890",
            "latlongregistered": "xczv",
            "totalpoints":1000,
            "redeemablepoints":800,
            "expirydate": "2012-03-14T00:00:00+05:30",
            "qrcode": "xvc",
            "currentoffercount":10,
            "schemerefid":1
          }
    }
    

    但当我尝试使用xml类型时,它工作得很好

    <insert_subscribe_merchant_operation>
             <customerrefid>1</customerrefid>
             <merchantrefid>"1"</merchantrefid>
             <datetime>2012-03-14T00:00:00+05:30</datetime>
             <registereddevice>"1234567890"</registereddevice>
             <latlongregistered>"234"</latlongregistered>
             <totalpoints>876</totalpoints>
             <redeemablepoints>345</redeemablepoints>
             <expirydate>2012-03-14T00:00:00+05:30</expirydate>
             <qrcode>"?"</qrcode>
             <currentoffercount>20</currentoffercount>
             <schemerefid>1</schemerefid>
    </insert_subscribe_merchant_operation>
    

    请帮帮我!!!!

    2 回复  |  直到 8 年前
        1
  •  1
  •   Chanikag    8 年前

    DSS即将发布的版本(3.5.1)对此进行了修复。相关JIRA是 DS-1190 。作为一种解决方法,您可以切换到org.apache.axis2.json。JSONMessageFormatter和org.apache.axis2.json。建议使用JSONOMBuilder。

        2
  •  1
  •   MaxExplode    8 年前

    通过修改wso2-dss axis2.xml解决了这个问题

    <messageFormatter contentType="application/json"
                  class="org.apache.axis2.json.JSONMessageFormatter"/>
    <messageBuilder contentType="application/json"
                    class="org.apache.axis2.json.JSONOMBuilder"/>
    

    通过移除Gson格式化程序。