Hi,

any updates on this ?

The POST to DSS does not work using 
org.wso2.carbon.integrator.core.json.JsonStreamFormatter and 
org.wso2.carbon.integrator.core.json.JsonStreamBuilder 
then gives this strange error: Value type miss match, Expected value type - 
'null', but found - 'STRING'<

The POST succeeds using org.apache.axis2.json.JSONOMBuilder and 
org.apache.axis2.json.JSONMessageFormatter

Fail example :

POST /services/inscriptions-XYZ/inscriptions HTTP/1.1[\r][\n]"
Host: localhost:8280[\r][\n]"
User-Agent: curl/7.54.0[\r][\n]"
Accept: */*[\r][\n]"
Content-Type: application/json[\r][\n]"
Content-Length: 86[\r][\n]"
[\r][\n]"
{"_postinscriptions": {"id": "001122334478","XYZ_ref": 
"00-aa-25678-001122334478"}}"
[2019-06-24 15:21:00,587] [EI-Core] ERROR - GsonXMLStreamReader Value type miss 
match, Expected value type - 'null', but found - 'STRING'
[2019-06-24 15:21:00,588] [EI-Core] ERROR - ServerWorker Error processing POST 
request for : /services/inscriptions-XYZ/inscriptions. 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:739)
        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:337)
        at 
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:383)
        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)
HTTP/1.1 500 Internal Server Error[\r][\n]"
Content-Type: application/xml; charset=UTF-8[\r][\n]"
Date: Mon, 24 Jun 2019 13:21:00 GMT[\r][\n]"
Transfer-Encoding: chunked[\r][\n]"
[\r][\n]"
64[\r][\n]"
<faultstring>Value type miss match, Expected value type - 'null', but found - 
'STRING'</faultstring>[\r][\n]"


My service definition:

    <query id="create_inscription_query" useConfig="default">
        <sql>INSERT INTO inscriptions values (:id , :xyz_ref , now() , null 
)</sql>
        <param name="id" sqlType="STRING"/>
        <param name="xyz_ref" sqlType="STRING"/>
    </query>
    <resource method="POST" path="/inscriptions">
        <call-query href="create_inscription_query">
            <with-param name="id" query-param="id"/>
            <with-param name="xyz_ref" query-param="xyz_ref"/>
        </call-query>
    </resource>

Bernard


> Le 17 juin 2019 à 11:32, Bernard Paris <[email protected]> a écrit :
> 
> Hello,
> 
> unfortunetely it is not so simple:
> 
> 1) using classes  
> org.apache.axis2.json.JSONMessageFormatter and 
> org.apache.axis2.json.JSONOMBuilder"  
> in axis2.xml in place respectively of 
> org.wso2.carbon.integrator.core.json.JsonStreamFormatter and 
> org.wso2.carbon.integrator.core.json.JsonStreamBuilder
> 
> then my POST succeeds whatever I use "_postinscriptions" or 
> "_postinscription".
> 
> 
> 2° using initial axis2.xml config with wso2 classes
> org.wso2.carbon.integrator.core.json.JsonStreamFormatter and 
> org.wso2.carbon.integrator.core.json.JsonStreamBuilder 
> 
> my POST never succeeds and gives on both cases
> <faultstring>Value type miss match, Expected value type - 'null', but found - 
> 'STRING'</faultstring>
> 
> 
> 
> Bernard
> 
> 
> 
>> Le 14 juin 2019 à 11:47, Samith Dassanayake <[email protected] 
>> <mailto:[email protected]>> a écrit :
>> 
>> Hi Bernard,
>> 
>> When you send an HTTP POST request, the format of the JSON object name 
>> should be "_post$RESOURCE_NAME". Since the resource name is inscriptions, 
>> the correct payload should be {"_postinscriptions": {"id": "001122334466"}}
>> 
>> I hope this will be satisfactory to you.
>> 
>> Regards,
>> Samith
>> 
>> On Wed, Jun 12, 2019 at 2:31 PM Bernard Paris <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Hi devs,
>> 
>> we have this error using DSS of EI.6.4.0.
>> 
>> [2019-06-12 15:17:23,236] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "POST /services/inscriptions-quid/inscriptions 
>> HTTP/1.1[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "Host: localhost:8280[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "User-Agent: curl/7.54.0[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "Accept: */*[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "Content-Type: application/json[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "Content-Length: 46[\r][\n]"
>> [2019-06-12 15:17:23,237] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "[\r][\n]"
>> [2019-06-12 15:17:23,238] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 >> "{"_postinscription": {"id": "001122334466"}}"
>> [2019-06-12 15:17:23,271] [EI-Core] ERROR - GsonXMLStreamReader Value type 
>> miss match, Expected value type - 'null', but found - 'STRING'
>> [2019-06-12 15:17:23,273] [EI-Core] ERROR - ServerWorker Error processing 
>> POST request for : /services/inscriptions-quid/inscriptions. 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:739)
>>      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:337)
>>      at 
>> org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:383)
>>      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)
>> [2019-06-12 15:17:23,297] [EI-Core] DEBUG - wire HTTP-Listener I/O 
>> dispatcher-1 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
>> 
>> 
>> The POST query was:
>> 
>> $ curl -X POST -H 'Content-Type: application/json' 
>> "http://localhost:8280/services/inscriptions-quid/inscriptions 
>> <http://localhost:8280/services/inscriptions-quid/inscriptions>" -d 
>> '{"_postinscription": {"id": "001122334466"}}'
>> 
>> 
>> And here is the dataservice query definition :
>> 
>>     <query id="create_inscription_query" useConfig="default">
>>         <sql>INSERT INTO inscriptions values ( now(), now() ,:id)</sql>
>>         <param name="id" sqlType="STRING"/>
>>     </query>
>>         
>>     <resource method="POST" path="/inscriptions">
>>         <call-query href="create_inscription_query" >        
>>                       <with-param name="id" query-param="id"/>
>>         </call-query>
>>     </resource>
>> 
>> 
>> Putting this in $EI_HOME/conf/axis2/axis2.xml  solved this problem on my own 
>> dev environment  but we tested this config change on QA environment and see 
>> there are lot of side effects for esb services, so we do not want changing 
>> this file.  What could be done ?
>> 
>> 
>> <messageFormatter contentType="application/json"
>>               class="org.apache.axis2.json.JSONMessageFormatter"/>
>> <messageBuilder contentType="application/json"
>>                 class="org.apache.axis2.json.JSONOMBuilder"/>
>> 
>> Bernard
>> 
>> 
>> 
>> _______________________________________________
>> Dev mailing list
>> [email protected] <mailto:[email protected]>
>> http://wso2.org/cgi-bin/mailman/listinfo/dev 
>> <http://wso2.org/cgi-bin/mailman/listinfo/dev>
>> 
>> 
>> -- 
>> Best Regards
>> 
>> Samith Dassanayake | Associate Technical Lead | WSO2 Inc.
>> (m) +44 7864 963981 | (w) +44 203 696 6510 | (e) [email protected] 
>> <mailto:[email protected]>
>> 
>> 
>>  <http://wso2.com/signature>
>> 
> 
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev

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

Reply via email to