Could not read document: Unrecognized token 'Request': was expecting ('true', 'false' or 'null')

9,473 views
Skip to first unread message

srin...@gmail.com

unread,
Sep 21, 2016, 10:57:38 PM9/21/16
to Gatling User Group
Hi,

My Test Cases are working fine with Gatling Except few of them which have JSON Request Payload as 

{
"trackingId":"7013761683470",
"activationSource":"WG",
"accountNumber":"3112007054516172",
"activationChannel":"WG",
"activationType":"TECH",
"deliveryPlatform":"IMS",
"customerType":"RES",
"cpeIpAddress":"69.241.25.27,10.54.141.240,10.54.141.127,10.54.141.244",
"browserType":"PC",
"workOrderInfo":{
"workOrderNumber":"1",
"workOrderType":"SERVICE_REQUEST",
"workOrderStatus":"OPEN",
"orderScheduleDate":1449028800000},
"customerInfo":{
"firstName":"TEST",
"lastName":"TEST",
"city":null,
"postalAddress":null,
"state":null,
"zipCode":null
},
"asyncProcessReasons":null,
"accountStatus":null,
"autoDiscoveredCmMac":null,
"ccRefTrackingId":null
}

Errors are:

[WARN ] i.g.h.a.ResponseProcessor - Request 'TestCaseName' failed: status.find.is(200), but actually found 400
TestCaseName service Response :Some({"timestamp":1474512729361,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read document: Unrecognized token 'Request': was expecting ('true', 'false' or 'null')
 at [Source: java.io.PushbackInputStream@7ad54264; line: 1, column: 15]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Request': was expecting ('true', 'false' or 'null')
 at [Source: java.io.PushbackInputStream@7ad54264; line: 1, column: 15]","path":"/ServicesOrderRs/PrepareServicesOrder"})

Any Help Regarding this Exception.




Nikolay Degkin

unread,
Sep 22, 2016, 5:21:16 AM9/22/16
to Gatling User Group
How do you send it? Do you read it from JSON file?
you can try following:

exec(http("LOGIN")
 
.post("/my_path")
 
.body(StringBody("""{"trackingId":"7013761683470","activationSource":"WG","accountNumber":"3112007054516172","activationChannel":"WG","activationType":"TECH","deliveryPlatform":"IMS","customerType":"RES","cpeIpAddress":"69.241.25.27,10.54.141.240,10.54.141.127,10.54.141.244","browserType":"PC","workOrderInfo":{"workOrderNumber":"1","workOrderType":"SERVICE_REQUEST","workOrderStatus":"OPEN","orderScheduleDate":1449028800000},"customerInfo":{"firstName":"TEST","lastName":"TEST","city":null,"postalAddress":null,"state":null,"zipCode":null},"asyncProcessReasons":null,"accountStatus":null,"autoDiscoveredCmMac":null,"ccRefTrackingId":null}""")).asJSON
 
)


srin...@gmail.com

unread,
Sep 22, 2016, 9:24:57 PM9/22/16
to Gatling User Group
Thanks Nikolay,

I tried by hardcoding JSON string body as specified by you, but still I am getting 

"Could not read document: Unrecognized token 'Request': was expecting ('true', 'false' or 'null')
 at [Source: java.io.PushbackInputStream@7ad54264; line: 1, column: 15]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Request': was expecting ('true', 'false' or 'null')"


srin...@gmail.com

unread,
Sep 22, 2016, 10:21:34 PM9/22/16
to Gatling User Group
Hi,

Look Like your JSON not get parsed properly. nested exception is com.fasterxml.jackson.core.JsonParseException:
I validated that My JSON value is correct using http://json.parser.online.fr/ and also using Same JSON values the APIs working using postman.
Does this is core Gatling Bug? Any thoughts?

On Thursday, September 22, 2016 at 3:21:16 AM UTC-6, Nikolay Degkin wrote:

Nikolay Degkin

unread,
Sep 23, 2016, 5:08:18 AM9/23/16
to Gatling User Group
Could you please provide your code?
There should be no problems with StringBody as Json
Reply all
Reply to author
Forward
0 new messages