403 forbidden error occurred while testing Rest client API on Jmeter - jmeter

403 forbidden error occurred while testing Rest client API on Jmeter , the same API works fine on Postman.What could be the difference between Jmeter and Postman calls?
There is no trace on server logs for the call from Jmeter, whereas when I run the test on Postman, we can see the entry in server.

If you can execute request in Postman it shouldn't be a problem to record it in JMeter.
Prepare JMeter for recording
The fastest and the easiest way to configure JMeter for recording is using JMeter Templates feature. From JMeter's main menu choose File -> Template -> Recording and click "Create"
Start JMeter's HTTP(S) Test Script Recorder: Expand Workbench, choose HTTP(S) Test Script Recorder and click "Start"
Prepare Postman for recording.
You need to configure Postman to use JMeter as a proxy. Postman respects --proxy-server argument where you can specify proxy host and port
C:\Users\your_username_here\AppData\Local\Postman\app-x.x.x\Postman.exe --proxy-server=localhost:8888
Now if you execute a request in Postman JMeter will record it and convert into the relevant HTTP Request sampler

Related

Not able to execute api call for delete through JMeter

I have a delete API http request in Jmeter which is like "serverName/ApplName/api/deleteDataset/{datasetId}"
In the header i have added the below information:
But strangely this api is failing with the below error:
Response code:400
Response message:Bad Request
Please note when i am trying the same API in postmen it is passing without any error. In fact i did not have to pass any header information apart from the access token.
I have tried removing the extra header information(accept,content-type) too from JMeter but that also did not work out.
If your request works fine in Postman the easiest way of replicating it in JMeter would be just recording it using JMeter's HTTP(S) Test Script Recorder
Start the HTTP(S) Test Script Recorder
Import JMeter's certificate into Postman, this way JMeter will be able to intercept and record HTTPS requests
Configure Postman to use JMeter as the proxy so the request to API would go through JMeter
Run your request in Postman
JMeter will generate HTTP Request Sampler and HTTP Header Manager
Correlate bearer token and replace hard-coded value with the appropriate JMeter Variable
You should be able to run the request successfully now

How to add postman body form data in jmeter

Hi im new to jmeter and wanted to check performance of api in jmeter but not sure how to use form data as im using video in my api not sure how to add and test
Postman : enter image description here
it would be helpful if some one helps
thanks in advance
The easiest conversion option is just recording it using JMeter's HTTP(S) Test Script Recorder
Start HTTP(S) Test Script Recorder
If you're using HTTPS protocol - import JMeter's self-signed certificate into Postman
Configure Postman to use JMeter as the proxy
Copy the file facial_10sec.webm file to "bin" folder of your JMeter installation, this way JMeter will be able to properly intercept the request and generate the request body
Run your request in Postman
JMeter will capture the request and generate the relevant HTTP Request sampler and the HTTP Header Manager
Postman Integration is demonstrated in this short video
It does not have the HTTPS Certificate integration. If you are using HTTPS, please import the JMeter CA certificate into the Postman.

SOAPACtion in Header Manager is not accepting while hitting the soap xml request

I am getting this error message: "No Action header was found with namespace" despite providing the correct details for SOAPAction value in header. Though my same service is running in SOAPUI tool. Is there anything else I need to add in JMeter to make it run.
It's hard to say what's wrong without seeing the request in SoapUI and in JMeter, most probably you didn't add the SOAPAction header in the HTTP Header Manager
In general if you're able to successfully execute your request in SoapUI you should be able to record it using JMeter's HTTP(S) Test Script Recorder
Prepare SoapUI for recording: configure it to use JMeter as the proxy
Prepare JMeter for recording, the fastest and the easiest way is using Recording Template feature
from JMeter's main menu choose File - Templates - Recording and click "Create"
go to HTTP(S) Test Script Recorder and click "Start"
Run your request in SoapUI
JMeter will capture the request and generate relevant HTTP Request sampler along with HTTP Header Manager

gets 404 error while runing SOAP UI in jmeter

Im trying to execute soapUI script in Jmeter but i am getting response as 404 in sampler result and Response Body is empty.
I have added SOAPAction and content type as well in header manager.
Can anyone please suggest.
Soap uses POST not GET HTTP method.
Ensure you add a Header Manager with correct SOAPAction header.
Use SOAP UI to generate the call from WSDL this will give you:
the URL
the Request Body
the correct headers
Alternatively, what you can do to be sure to send same data as SoapUI is to use JMeter Recording template, and put JMeter as a proxy of SoapUI then call WS from SoapUI, this will be recorded by JMeter
HTTP Status 404 means Not Found which basically indicates that you're hitting the wrong URL in JMeter.
Switch to "Raw" mode in the SoapUI and you will be able to see the correct URL and headers you will need to supply:
Also be aware that you can just record the request(s) from SoapUI using JMeter's HTTP(S) Test Script Recorder
Prepare JMeter for recording, the fastest and easiest way is using JMeter Templates Feature
from JMeter's main menu choose File -> Templates -> Recording and click "Create"
Expand HTTP(S) Test Script Recorder and click "Start"
Prepare SoapUI for recording
from SoapUI main menu choose File -> Preferences -> Proxy
configure it to match the JMeter settings
click "Proxy" button in SoapUI main toolbar
More information: Apache JMeter HTTP(S) Test Script Recorder

403 forbidden error in jmeter but api works fine in postman

I have an API that is running in GET method. It works fine in postman with 200 status code. But when I try to run the API in jmeter it throws 403 forbidden error. I have configured the debug sampler and tried to re-run the test. The debug sampler passed with 200 but http request still fails.
I have tried to correlate but even that fails.
I removed the port number from the HTTP request, it still fails.
I have added the authorization manager and enter the username and password still fails.
HTTP cookie manager and cache manager added in the script.
As per HTTP Status Code 403 description
The HTTP 403 Forbidden client error status response code indicates that the server understood the request but refuses to authorize it.
This status is similar to 401, but in this case, re-authenticating will make no difference. The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.
Most probably you have inconsistencies between requests originated from Postman and from JMeter.
There are 2 possible causes:
You failed to configure JMeter's HTTP Request sampler properly. Given your request works fine in Postman you can try to record it using JMeter's HTTP(S) Test Script Recorder
Prepare JMeter for recording. The easiest way is going for JMeter Templates Feature
From JMeter's main menu choose File -> Templates -> Recording and click "Create"
Open HTTP(S) Test Script Recorder and click "Start"
Prepare Postman for recording.
On Settings page set proxy host to 127.0.0.1 and port to 8888
Execute the request in Postman
JMeter will capture the request and store it under the Recording Controller
Postman uses specific Authorization header which cannot be recorded and replayed. Look into Authorization tab for the request and check which one is used, once you figure out - implement the same in JMeter:
Status Code 403 means you are not authorized to access it, so Ensure you are using the right Authorization for your GET call.
Add cookie manager in jmeter http sampler.

Resources