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

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.

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 )

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’)”

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?

Could you please provide your code?
There should be no problems with StringBody as Json