Re: [Dev] EI6.4.0 : Expected value type - 'null', but found - 'STRING'.

2019-06-24 Thread Bernard Paris
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]"
Value type miss match, Expected value type - 'null', but found - 
'STRING'[\r][\n]"


My service definition:


INSERT INTO inscriptions values (:id , :xyz_ref , now() , null 
)










Bernard


> Le 17 juin 2019 à 11:32, Bernard Paris  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
> Value type miss match, Expected value type - 'null', but found - 
> 'STRING'
> 
> 
> 
> Bernard
> 
> 
> 
>> Le 14 juin 2019 à 11:47, Samith Dassanayake > > 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 

Re: [Dev] EI6.4.0 : Expected value type - 'null', but found - 'STRING'.

2019-06-17 Thread Bernard Paris
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
Value type miss match, Expected value type - 'null', but found - 
'STRING'



Bernard



> Le 14 juin 2019 à 11:47, Samith Dassanayake  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  > 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 

Re: [Dev] EI6.4.0 : Expected value type - 'null', but found - 'STRING'.

2019-06-14 Thread Samith Dassanayake
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 inscription*s*,
the correct payload should be {"_postinscription*s*": {"id":
"001122334466"}}

I hope this will be satisfactory to you.

Regards,
Samith

On Wed, Jun 12, 2019 at 2:31 PM Bernard Paris 
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; -d
> '{"_postinscription": {"id": "001122334466"}}'
>
>
> And here is the dataservice query definition :
>
> 
> INSERT INTO inscriptions values ( now(), now() ,:id)
> 
> 
>
>
> 
> 
> 
> 
> 
>
>
> 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 ?
>
>
>
> class="org.apache.axis2.json.JSONMessageFormatter"/> contentType="application/json"
> class="org.apache.axis2.json.JSONOMBuilder"/>
>
>
> Bernard
>
>
>
> 

[Dev] EI6.4.0 : Expected value type - 'null', but found - 'STRING'.

2019-06-12 Thread Bernard Paris
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; -d 
'{"_postinscription": {"id": "001122334466"}}'


And here is the dataservice query definition :


INSERT INTO inscriptions values ( now(), now() ,:id)





 




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 ?





Bernard



___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev