wso2wso2-esbwso2-enterprise-integratorwso2-data-services-server

WSO2 Data Service Unable to send parameter


In WSO2 Integration Studio, I am trying to use a data service to send data to a database. I am currently trying to use POST.

This is my call in my proxy service:

<property name="uri.var.updateTime" scope="default" type="STRING" value="2023-07-31T08:51:10-06:00"/>
            <payloadFactory media-type="json">
                <format>
                    {
                        "_postupdateTime": "$1"
                    }
                </format>
                <args>
                    <arg expression="$ctx:uri.var.updateTime"/>
                </args>
            </payloadFactory>
            <property name="messageType" value="application/json" scope="axis2"/>
            <property name="Content-Type" value="application/json" scope="axis2"/>
            <call>
                <endpoint>
                    <http method="POST" uri-template="http://localhost:8280/services/MSDataService/updateLastSyncTimes">
                        <suspendOnFailure>
                            <initialDuration>-1</initialDuration>
                            <progressionFactor>1</progressionFactor>
                        </suspendOnFailure>
                        <markForSuspension>
                            <retriesBeforeSuspension>0</retriesBeforeSuspension>
                        </markForSuspension>
                    </http>
                </endpoint>
            </call>

This is my resource and my query in my data service (the other resources and queries work fine):

<resource returnRequestStatus="true" method="POST" path="updateLastSyncTimes">
    <description />
    <call-query href="updateLastSyncTimesQuery">
        <with-param name="updateTime" query-param="updateTime"/>
    </call-query>
  </resource>
  <query id="updateLastSyncTimesQuery" useConfig="FinancialDB">
    <sql>update database.tableExample set columnExample=:updateTime where anotherColumn='2';</sql>
    <param type="IN" name="updateTime" paramType="SCALAR" sqlType="String"/>
  </query>

I am getting the error message: ERROR {GsonXMLStreamReader} - Value type miss match, Expected value type - '', but found - 'STRING'

I have also tried switching to GET and using query parameters, but I get the error message that it is not able to find the query parameter.


Solution

  • Your request payload has to be something like below.

    {
      "__postupdateTime": {
          "updateTime" : "$1"
      }
    }