Hi Sidath,

Is there a separate POST endpoint defined like *<resource method="POST"
path="applications**">* (/applications)? If so, it seems that it is the
endpoint being called as your JSON payload has the following
*_postapplications*. The following link[1] has the proper way of
constructing the JSON payload.

[1] -
https://docs.wso2.com/display/DSS351/Using+JSON+Messages+with+RESTful+Services

Best Regards,

On Fri, Jun 15, 2018 at 4:11 PM, Sidath Weerasinghe <[email protected]>
wrote:

> Hi devs,
>
> I changed the code as follows,
>
> <query id="update_applications" useConfig="test001">
>       <sql>{call update_application_from_applicationId(?, ?, ?, ?,
> ?)}</sql>
>       <param name="application_id" ordinal="1" paramType="SCALAR"
> sqlType="INTEGER" type="IN"/>
>       <param name="word" ordinal="2" paramType="SCALAR" sqlType="STRING"
> type="IN"/>
>       <param name="code" ordinal="3" paramType="SCALAR" sqlType="STRING"
> type="IN"/>
>       <param name="status" ordinal="4" paramType="SCALAR" sqlType="STRING"
> type="IN"/>
>       <param name="word_required" ordinal="5" paramType="SCALAR"
> sqlType="BOOLEAN" type="IN"/>
>    </query>
>
>     <resource method="POST" path="applications/{application_id}">
>         <call-query href="update_applications">
>             <with-param name="application_id"
> query-param="application_id"/>
>             <with-param name="word" query-param="word"/>
>             <with-param name="code" query-param="code"/>
>             <with-param name="status" query-param="status"/>
>             <with-param name="word_required" query-param="word_required"/>
>         </call-query>
>     </resource>
>
>
> Request -
>
> curl -X POST \
>   http://127.0.0.1:8280/services/test/applications/3 \
>   -H 'Accept: application/json' \
>   -H 'Cache-Control: no-cache' \
>   -H 'Content-Type: application/json' \
>   -H 'Postman-Token: 586ef320-573b-495e-9ce8-e64a90703fb5' \
>   -d '{
> "_postapplications" : {
>         "word": "Sida",
>         "code": "12345",
>         "status": "active",
>         "word_required": true
> }
> }'
>
>
> But still, I'm getting the below error,
>
> [2018-06-15 16:07:31,322] [EI-Core] ERROR - GsonXMLStreamReader Value type
> miss match, Expected value type - 'null', but found - 'STRING'
> [2018-06-15 16:07:31,324] [EI-Core] ERROR - ServerWorker Error processing
> POST reguest for : /services/test/applications/3. Error detail: Value type
> miss match, Expected value type - 'null', but found - 'STRING'.
> java.lang.IllegalArgumentException: Value type miss match, Expected value
> type - 'null', but found - 'STRING'
> at org.apache.axis2.json.gson.GsonXMLStreamReader.nextValue(
> GsonXMLStreamReader.java:737)
> at org.apache.axis2.json.gson.GsonXMLStreamReader.readValue(
> GsonXMLStreamReader.java:626)
> at org.apache.axis2.json.gson.GsonXMLStreamReader.stateTransition(
> GsonXMLStreamReader.java:532)
> at org.apache.axis2.json.gson.GsonXMLStreamReader.next(
> GsonXMLStreamReader.java:178)
> at org.apache.axiom.om.impl.builder.StAXOMBuilder.
> parserNext(StAXOMBuilder.java:681)
> at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(
> StAXOMBuilder.java:214)
> at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(
> OMSerializableImpl.java:78)
> at org.apache.axiom.om.impl.llom.OMElementImpl.build(
> OMElementImpl.java:722)
> at org.apache.axiom.om.impl.llom.OMElementImpl.detach(
> OMElementImpl.java:700)
> at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:105)
> at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
> OMElementImpl.java:296)
> at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
> OMElementImpl.java:212)
> at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(
> SOAPBodyImpl.java:231)
> at org.apache.axis2.json.gson.JSONMessageHandler.invoke(
> JSONMessageHandler.java:84)
> at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
> at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
> at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
> at org.apache.synapse.transport.passthru.ServerWorker.
> processNonEntityEnclosingRESTHandler(ServerWorker.java:326)
> at org.apache.synapse.transport.passthru.ServerWorker.
> processEntityEnclosingRequest(ServerWorker.java:372)
> at org.apache.synapse.transport.passthru.ServerWorker.run(
> ServerWorker.java:151)
> at org.apache.axis2.transport.base.threads.NativeWorkerPool$
> 1.run(NativeWorkerPool.java:172)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
>
>
>
>
>
> On Fri, Jun 15, 2018 at 9:45 AM Madhawa Gunasekara <[email protected]>
> wrote:
>
>> Hi Sidath,
>>
>> Why are you using XML Mapping instead of JsonMapping [1]. This issue
>> won't be occured if you use JSON mapping.
>>
>> [1] https://docs.wso2.com/display/DSS350/JSON+Mapping
>>
>> Thanks,
>> Madhawa
>>
>> On Thu, Jun 14, 2018 at 11:05 AM, Sidath Weerasinghe <
>> [email protected]> wrote:
>>
>>> Hi devs,
>>>
>>> Is this error related to this
>>> <http://wso2-oxygen-tank.10903.n7.nabble.com/Issue-with-EI-6-1-1-update-22-and-24-td156180.html>
>>>  ?
>>> http://wso2-oxygen-tank.10903.n7.nabble.com/Issue-with-EI-6-
>>> 1-1-update-22-and-24-td156180.html
>>>
>>> On Thu, Jun 14, 2018 at 10:21 AM Sidath Weerasinghe <
>>> [email protected]> wrote:
>>>
>>>> Hi Chanika,
>>>>
>>>> Im using EI 6.1.1 version and please find the dataservice config.
>>>>
>>>>
>>>>  <query id="update_applications" useConfig="test001">
>>>>       <sql>{call update_application_from_applicationId(?, ?, ?, ?,
>>>> ?)}</sql>
>>>>       <param name="application_id" ordinal="1" paramType="SCALAR"
>>>> sqlType="INTEGER" type="IN"/>
>>>>       <param name="word" ordinal="2" paramType="SCALAR"
>>>> sqlType="STRING" type="IN"/>
>>>>       <param name="code" ordinal="3" paramType="SCALAR"
>>>> sqlType="STRING" type="IN"/>
>>>>       <param name="status" ordinal="4" paramType="SCALAR"
>>>> sqlType="STRING" type="IN"/>
>>>>       <param name="word_required" ordinal="5" paramType="SCALAR"
>>>> sqlType="BOOLEAN" type="IN"/>
>>>>       <result element="applications" rowName="application">
>>>>          <element column="application_id" name="application_id"
>>>> xsdType="integer"/>
>>>>          <element column="word" name="word" xsdType="string"/>
>>>>          <element column="code" name="code" xsdType="string"/>
>>>>          <element column="status" name="status" xsdType="string"/>
>>>>          <element column="word_required" name="word_required"
>>>> xsdType="boolean"/>
>>>>       </result>
>>>>    </query>
>>>>     <resource method="POST" path="applications/{application_id}">
>>>>         <call-query href="update_applications">
>>>>             <with-param name="application_id"
>>>> query-param="application_id"/>
>>>>             <with-param name="word" query-param="word"/>
>>>>             <with-param name="code" query-param="code"/>
>>>>             <with-param name="status" query-param="status"/>
>>>>             <with-param name="word_required"
>>>> query-param="word_required"/>
>>>>         </call-query>
>>>>     </resource>
>>>>
>>>>
>>>> Request -
>>>> http://127.0.0.1:8280/services/test/applications/3
>>>> { "_postapplications" : { "word": "Sida", "code": "12345", "status":
>>>> "active", "word_required": true } }
>>>>
>>>>
>>>> On Thu, Jun 14, 2018 at 9:50 AM Chanika Geeganage <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Sidath,
>>>>>
>>>>> What is the DSS version? Is it EI? Also can you please attach the
>>>>> dataservice config and a sample request to identify the issue?
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Thu, Jun 14, 2018 at 9:12 AM, Sidath Weerasinghe <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Devs,
>>>>>>
>>>>>> I wrote a DSS service in the WSO2 EI 6.1.1 and I got the following
>>>>>> error.
>>>>>>
>>>>>> [2018-06-14 09:08:33,557] [EI-Core] ERROR - GsonXMLStreamReader Value
>>>>>> type miss match, Expected value type - 'null', but found - 'STRING'
>>>>>> [2018-06-14 09:08:33,563] [EI-Core] ERROR - ServerWorker Error
>>>>>> processing POST reguest for : /services/test/applications/3. Error 
>>>>>> detail:
>>>>>> Value type miss match, Expected value type - 'null', but found - 
>>>>>> 'STRING'.
>>>>>> java.lang.IllegalArgumentException: Value type miss match, Expected
>>>>>> value type - 'null', but found - 'STRING'
>>>>>> at org.apache.axis2.json.gson.GsonXMLStreamReader.nextValue(
>>>>>> GsonXMLStreamReader.java:737)
>>>>>> at org.apache.axis2.json.gson.GsonXMLStreamReader.readValue(
>>>>>> GsonXMLStreamReader.java:626)
>>>>>> at org.apache.axis2.json.gson.GsonXMLStreamReader.stateTransition(
>>>>>> GsonXMLStreamReader.java:532)
>>>>>> at org.apache.axis2.json.gson.GsonXMLStreamReader.next(
>>>>>> GsonXMLStreamReader.java:178)
>>>>>> at org.apache.axiom.om.impl.builder.StAXOMBuilder.
>>>>>> parserNext(StAXOMBuilder.java:681)
>>>>>> at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(
>>>>>> StAXOMBuilder.java:214)
>>>>>> at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(
>>>>>> OMSerializableImpl.java:78)
>>>>>> at org.apache.axiom.om.impl.llom.OMElementImpl.build(
>>>>>> OMElementImpl.java:722)
>>>>>> at org.apache.axiom.om.impl.llom.OMElementImpl.detach(
>>>>>> OMElementImpl.java:700)
>>>>>> at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(
>>>>>> OMNodeImpl.java:105)
>>>>>> at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
>>>>>> OMElementImpl.java:296)
>>>>>> at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(
>>>>>> OMElementImpl.java:212)
>>>>>> at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(
>>>>>> SOAPBodyImpl.java:231)
>>>>>> at org.apache.axis2.json.gson.JSONMessageHandler.invoke(
>>>>>> JSONMessageHandler.java:84)
>>>>>> at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>>>>>> at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>>>>>> at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
>>>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.
>>>>>> processNonEntityEnclosingRESTHandler(ServerWorker.java:326)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.
>>>>>> processEntityEnclosingRequest(ServerWorker.java:372)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.run(
>>>>>> ServerWorker.java:151)
>>>>>> at org.apache.axis2.transport.base.threads.NativeWorkerPool$
>>>>>> 1.run(NativeWorkerPool.java:172)
>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(
>>>>>> ThreadPoolExecutor.java:1149)
>>>>>> at java.util.concurrent.ThreadPoolExecut
>>>>>>
>>>>>> any idea for this ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thank You,
>>>>>> Best Regards,
>>>>>>
>>>>>> Sidath Weerasinghe
>>>>>> Senior Software Engineer
>>>>>> M: +94719802550 | E: [email protected]
>>>>>> Blog: https://medium.com/@sidath
>>>>>> Linkedin: https://lk.linkedin.com/in/sidathweerasinghe
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> [email protected]
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards..
>>>>>
>>>>> Chanika Geeganage
>>>>> +94773522586
>>>>> WSO2, Inc.; http://wso2.com
>>>>>
>>>>>
>>>>
>>>> --
>>>> Thank You,
>>>> Best Regards,
>>>>
>>>> Sidath Weerasinghe
>>>> Senior Software Engineer
>>>> M: +94719802550 | E: [email protected]
>>>> Blog: https://medium.com/@sidath
>>>> Linkedin: https://lk.linkedin.com/in/sidathweerasinghe
>>>>
>>>>
>>>
>>> --
>>> Thank You,
>>> Best Regards,
>>>
>>> Sidath Weerasinghe
>>> Senior Software Engineer
>>> M: +94719802550 | E: [email protected]
>>> Blog: https://medium.com/@sidath
>>> Linkedin: https://lk.linkedin.com/in/sidathweerasinghe
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Madhawa Gunasekara*
>> Senior Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 719411002 <+94+719411002>
>> blog: *http://madhawa-gunasekara.blogspot.com
>> <http://madhawa-gunasekara.blogspot.com>*
>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>> <http://lk.linkedin.com/in/mgunasekara>*
>>
>
>
> --
> Thank You,
> Best Regards,
>
> Sidath Weerasinghe
> Senior Software Engineer
> M: +94719802550 | E: [email protected]
> Blog: https://medium.com/@sidath
> Linkedin: https://lk.linkedin.com/in/sidathweerasinghe
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Janak Amarasena*

Software Engineer

Email: [email protected]

Mobile: +94777764144

Web: https://wso2.com


<http://wso2.com/signature>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to