Dynamic entry while posting a json body in jmeter
up vote
0
down vote
favorite
I been trying to write jmeter load test for a SAML secured web-service. So for i have a http request sampler which gets the access code and stores in a variable named access_code. But the web-service accepts post request in the form:
api.service.edu/api/authentication with body data as { "code":"${access_code}","redirect_uri":"some site"} .
but whenever I tried running the jmeter , my sampler gives the following error :
Thread Name: Basic App Usage Flow 1-1
Sample Start: 2018-11-07 21:08:50 EST
Load time: 1209
Connect Time: 0
Latency: 1208
Size in bytes: 370
Sent bytes:0
Headers size in bytes: 324
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Internal Server Error
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
is it because of the way I am parsing the access_code? if so how can I parse a dynamic value via a json post request?.
jmeter saml-2.0
add a comment |
up vote
0
down vote
favorite
I been trying to write jmeter load test for a SAML secured web-service. So for i have a http request sampler which gets the access code and stores in a variable named access_code. But the web-service accepts post request in the form:
api.service.edu/api/authentication with body data as { "code":"${access_code}","redirect_uri":"some site"} .
but whenever I tried running the jmeter , my sampler gives the following error :
Thread Name: Basic App Usage Flow 1-1
Sample Start: 2018-11-07 21:08:50 EST
Load time: 1209
Connect Time: 0
Latency: 1208
Size in bytes: 370
Sent bytes:0
Headers size in bytes: 324
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Internal Server Error
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
is it because of the way I am parsing the access_code? if so how can I parse a dynamic value via a json post request?.
jmeter saml-2.0
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I been trying to write jmeter load test for a SAML secured web-service. So for i have a http request sampler which gets the access code and stores in a variable named access_code. But the web-service accepts post request in the form:
api.service.edu/api/authentication with body data as { "code":"${access_code}","redirect_uri":"some site"} .
but whenever I tried running the jmeter , my sampler gives the following error :
Thread Name: Basic App Usage Flow 1-1
Sample Start: 2018-11-07 21:08:50 EST
Load time: 1209
Connect Time: 0
Latency: 1208
Size in bytes: 370
Sent bytes:0
Headers size in bytes: 324
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Internal Server Error
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
is it because of the way I am parsing the access_code? if so how can I parse a dynamic value via a json post request?.
jmeter saml-2.0
I been trying to write jmeter load test for a SAML secured web-service. So for i have a http request sampler which gets the access code and stores in a variable named access_code. But the web-service accepts post request in the form:
api.service.edu/api/authentication with body data as { "code":"${access_code}","redirect_uri":"some site"} .
but whenever I tried running the jmeter , my sampler gives the following error :
Thread Name: Basic App Usage Flow 1-1
Sample Start: 2018-11-07 21:08:50 EST
Load time: 1209
Connect Time: 0
Latency: 1208
Size in bytes: 370
Sent bytes:0
Headers size in bytes: 324
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Internal Server Error
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
is it because of the way I am parsing the access_code? if so how can I parse a dynamic value via a json post request?.
jmeter saml-2.0
jmeter saml-2.0
asked Nov 8 at 2:11
Harun Guna
113
113
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
HTTP Status Code 500 stands for Internal Server Error, according to HTTP protocol specification the problem is on the server side as client status codes (i.e. malformed requests) should have HTTP Status code between 400 and 499. So I would recommend checking server-side logs, most probably you will be able to figure out what's wrong from them.- It might be the case your
${access_code}
variable is not defined, i.e. the relevant Post-Processor failed to extract it from the previous response. Double check it's value using Debug Sampler and View Results Tree listener combination
It might be the case your
${access_code}
variable contains some special characters which are not allowed in JSON and must be escaped
Backspace is replaced withb
Form feed is replaced withf
Newline is replaced withn
Carriage return is replaced withr
Tab is replaced with t
Double quote is replaced with"
Backslash is replaced with\
If your
${access_code}
variable contains any of the above - the resulting JSON will be incorrect. To be on the safe side I would recommend replacing your${access_code}
variable reference with __groovy() function call
${__groovy(org.apache.commons.lang3.StringEscapeUtils.escapeJson(vars.get('access_code')),)}
- It might be the case you're not sending a proper Content-Type header so make sure to add HTTP Header Manager and configure it to send
application/json
as the Content-Type
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
HTTP Status Code 500 stands for Internal Server Error, according to HTTP protocol specification the problem is on the server side as client status codes (i.e. malformed requests) should have HTTP Status code between 400 and 499. So I would recommend checking server-side logs, most probably you will be able to figure out what's wrong from them.- It might be the case your
${access_code}
variable is not defined, i.e. the relevant Post-Processor failed to extract it from the previous response. Double check it's value using Debug Sampler and View Results Tree listener combination
It might be the case your
${access_code}
variable contains some special characters which are not allowed in JSON and must be escaped
Backspace is replaced withb
Form feed is replaced withf
Newline is replaced withn
Carriage return is replaced withr
Tab is replaced with t
Double quote is replaced with"
Backslash is replaced with\
If your
${access_code}
variable contains any of the above - the resulting JSON will be incorrect. To be on the safe side I would recommend replacing your${access_code}
variable reference with __groovy() function call
${__groovy(org.apache.commons.lang3.StringEscapeUtils.escapeJson(vars.get('access_code')),)}
- It might be the case you're not sending a proper Content-Type header so make sure to add HTTP Header Manager and configure it to send
application/json
as the Content-Type
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
add a comment |
up vote
0
down vote
HTTP Status Code 500 stands for Internal Server Error, according to HTTP protocol specification the problem is on the server side as client status codes (i.e. malformed requests) should have HTTP Status code between 400 and 499. So I would recommend checking server-side logs, most probably you will be able to figure out what's wrong from them.- It might be the case your
${access_code}
variable is not defined, i.e. the relevant Post-Processor failed to extract it from the previous response. Double check it's value using Debug Sampler and View Results Tree listener combination
It might be the case your
${access_code}
variable contains some special characters which are not allowed in JSON and must be escaped
Backspace is replaced withb
Form feed is replaced withf
Newline is replaced withn
Carriage return is replaced withr
Tab is replaced with t
Double quote is replaced with"
Backslash is replaced with\
If your
${access_code}
variable contains any of the above - the resulting JSON will be incorrect. To be on the safe side I would recommend replacing your${access_code}
variable reference with __groovy() function call
${__groovy(org.apache.commons.lang3.StringEscapeUtils.escapeJson(vars.get('access_code')),)}
- It might be the case you're not sending a proper Content-Type header so make sure to add HTTP Header Manager and configure it to send
application/json
as the Content-Type
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
add a comment |
up vote
0
down vote
up vote
0
down vote
HTTP Status Code 500 stands for Internal Server Error, according to HTTP protocol specification the problem is on the server side as client status codes (i.e. malformed requests) should have HTTP Status code between 400 and 499. So I would recommend checking server-side logs, most probably you will be able to figure out what's wrong from them.- It might be the case your
${access_code}
variable is not defined, i.e. the relevant Post-Processor failed to extract it from the previous response. Double check it's value using Debug Sampler and View Results Tree listener combination
It might be the case your
${access_code}
variable contains some special characters which are not allowed in JSON and must be escaped
Backspace is replaced withb
Form feed is replaced withf
Newline is replaced withn
Carriage return is replaced withr
Tab is replaced with t
Double quote is replaced with"
Backslash is replaced with\
If your
${access_code}
variable contains any of the above - the resulting JSON will be incorrect. To be on the safe side I would recommend replacing your${access_code}
variable reference with __groovy() function call
${__groovy(org.apache.commons.lang3.StringEscapeUtils.escapeJson(vars.get('access_code')),)}
- It might be the case you're not sending a proper Content-Type header so make sure to add HTTP Header Manager and configure it to send
application/json
as the Content-Type
HTTP Status Code 500 stands for Internal Server Error, according to HTTP protocol specification the problem is on the server side as client status codes (i.e. malformed requests) should have HTTP Status code between 400 and 499. So I would recommend checking server-side logs, most probably you will be able to figure out what's wrong from them.- It might be the case your
${access_code}
variable is not defined, i.e. the relevant Post-Processor failed to extract it from the previous response. Double check it's value using Debug Sampler and View Results Tree listener combination
It might be the case your
${access_code}
variable contains some special characters which are not allowed in JSON and must be escaped
Backspace is replaced withb
Form feed is replaced withf
Newline is replaced withn
Carriage return is replaced withr
Tab is replaced with t
Double quote is replaced with"
Backslash is replaced with\
If your
${access_code}
variable contains any of the above - the resulting JSON will be incorrect. To be on the safe side I would recommend replacing your${access_code}
variable reference with __groovy() function call
${__groovy(org.apache.commons.lang3.StringEscapeUtils.escapeJson(vars.get('access_code')),)}
- It might be the case you're not sending a proper Content-Type header so make sure to add HTTP Header Manager and configure it to send
application/json
as the Content-Type
answered Nov 8 at 4:52
Dmitri T
67k33257
67k33257
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
add a comment |
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
Thank you for the reply. I found that I am not receiving the access_code from the previous sampler. I am still going to replace the ${access_code} with the groovy function.
– Harun Guna
Nov 8 at 20:46
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53200580%2fdynamic-entry-while-posting-a-json-body-in-jmeter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown