Home > Mobile >  JMeter POST response body is null
JMeter POST response body is null

Time:06-09

Response code is 200 with error count 0 but response body is null. PostMan Request: i hit the api from postman with this request body.

{"body": {
"distance": 3466567.8,
"latitude": 45.7,
"longitude": 80.7}}

Postman response: I got this reponse on postman.

 "requestId": "LME2206071048390000193004",
"msgId": "LME2206071048390000191004",
"accDate": null,
"startDateTime": [
    2022,
    6,
    7,
    10,
    48,
    39,
    100000000
],
"locale": "zh_CN",
"routeInfo": "LME"
.......................

Now if i hit the same API with same request body from the JMeter, i got the below mentioned response.

{
"msgId": null,
"source": null,
"locale": null,
"body": null,
"userId": null,
"uri": null,
"accDate": null,
"startDateTime": null,
"requestId": null,
"msgCd": "SYS00001",
"msgInfo": null}
................

Can anyone help me how to resolve this issue.

CodePudding user response:

We cannot "help me how to resolve this issue" unless you share the Postman and JMeter's enter image description here

  • enter image description here

  • Run your request in Postman

  • That's it, JMeter should intercept the request and generate the relevant HTTP Request sampler and friends so you can replay it with increased load

  • More information: How to Convert Your Postman API Tests to JMeter for Scaling

    CodePudding user response:

    Above mentioned Issue is resolved. The main issue was the order of the fields in the request body. I was sending this request from postman and it was working fine.

    { "body": {
    "distance": 3466567.8,
    "latitude": 45.7,
    "longitude": 80.7
    }}
    

    And when i send this same request from jmeter it was not working fine. i was getting null values in the fields of response body. Then i realized and change the order of fields in the request body as according to my business logic and it works.

    {
    "body": {
    "latitude": 45.7,
    "longitude": 80.7,
    "distance": 3466567.8
    }}
    
    • Related