POST request results is HTTP 415 error through JMeter proxy - java

I try to implement a load test in jmeter for a web service written in java (Spring MVC+Hibernate). The server is RESTFull and a client (in angularjs) communicates with server.
I want to dump HTTP request with jmeter HTTP Request recorder the same as a tutorial on jmeter user guides.
The problem is that I keep on getting a 415 Http error while using jmeter as proxy on web browser. So the webpage is faced with an error while trying to post data and fails.

HTTP Status Code 415 stands for Unsupported Media Type, it means that Content-Type header is either incorrect or missing.
JMeter shouldn't be removing this header so my expectation is that either there is a problem with your application or with JMeter itself.
Try recording your test scenario using i.e. JMeter Chrome Extension and if it will be successful - please raise a ticket in JMeter Bugzilla

Related

Performance testing using JMeter script on an OAuth 2.0 Secure Web Application

I used BlazeMeter's chrome extension to build a .jmx file for testing our login page in JMeter. Most of our application is written in node js. We are using Auth0 for our login and the /login/callback is giving me a 400. I am not sure why. My goal is to test our applications with about 200 users. Any help would be great!
The HTTP 400 Bad Request response status code indicates that the server could not understand the request due to invalid syntax.
Most probably you are getting this error due to malformed request body or missing header, most probably you need to add a HTTP Header Manager and configure it to send Content-Type header with the value of application/json
Also be aware that OAuth authorization flow isn't something you will be able to record and replay, it is all about obtaining an Authorization Bearer token and sending it along with the requests requiring authorization via the aforementined HTTP Header Manager.
There are several ways of obtaining an OAuth token, check out How to Run Performance Tests on OAuth Secured Apps with JMeter guide for more details on bypassing OAuth login challenge in JMeter tests.

CAS Rest API always causing HTTP Status 415

Hi I'm trying to add rest support for my application which uses CAS.
I did all the steps of the tutorials, but when i try from Postman to test the tickets
http://localhost:8080/cas/v1/tickets?username=admin&password=admin
I'm always getting
HTTP Status 415
The server refused this request because the request entity is in a
format not supported by the requested resource for the requested
method.
and the response is always as an html page. what is still missing from my side, and what content type should i use ?
I get this too, from a set of new CAS servers I just upgraded from 3.5 to 4.2.5.
The requests succeed if I send them encoded as x-www-form-urlencoded using postman (and this is a workaround that I've implemented in our tools that use the REST interface), but not using the text/plain content type described in the documentation. My remaining 3.5 servers accept both content-types.
I'd much rather support both content types, since there are some tools floating around that use the old servers that we don't want to have to update.

"413 FULL head" error when sending a POST request

I have a Java application, hosted on Weblogic, which sends a REST POST request to a mock service hosted in SoapUI running on the same server.
The application gets as far as sending the request to the mock service via Spring's RestTemplate class before failing with a "413 FULL head" exception (org.springframework.web.client.HttpClientErrorException).
I have a Groovy script running on SoapUI which should log the headers that the request includes. If I send a POST request to the mock service from within SoapUI itself, the headers are printed by the script successfully. When the Java application sends a (failed) request, no headers are printed. This would would imply that the request is failing before the script is executed.
I am not sure how else I can identify what headers the POST request includes.
Looking on here, it seems like a lot of other times this issue has been reported is when using GET requests. I am definitely using a POST for this request.
Java: 1.7.0_02
Spring: 4.1.7
SoapUI: 5.2.1
Weblogic: 10.3.6.0
Thanks in advance for any assistance.
I used the TCP/IP Monitor in Eclipse to find that the "Accept-Charset" HTTP header included a large amount of data.
This was fixed by setting the writeAcceptCharset property on the StringHttpMessageConverter which was used by the Spring RestTemplate object.
The issue and solution is described here: https://jira.spring.io/browse/SPR-7316.

Getting junk/jumbled/encoded response from RESTservice

I am able to hit a rest service successfully and get the response properly when I use REST client and Junit test case. But, however,when I try to hit the same rest service via IE browser, I am getting some junk/jumbled/encoded response from the rest service.I have used wireshark tool to investigate.
When I try to access the rest service via browser, the following headers are additionally added by the browser
accept-encoding=gzip, Content-Encoding=gzip
The above headers are not added when I try using REST client or Junit test case.
I suspect that the above headers are the root cause for getting encoded response. If my assumption is true, is there any way to get rid of those headers?
I have already tried with the following, but not working:
'accept-encoding': 'gzip;q=0,deflate,sdch'
'accept-encoding: identity'
Any ideas?

How to test Webservice in JDeveloper that uses Basic Authentication?

I have created a web-service that uses basic authentication in JDeveloper 11.1.1.4.
When i test my application using a client application is runs correctly so i know that the authentication mechanism has no problems.
How can i pass authentication info into the HTTP Analyzer by right clicking on Webservices and selecting Test Web Service?
I have tried to pass credentials through SOAP Headers > :WS-Security:Header like below but is not working
I have also tried to pass authentication through Credentials option like shown below
In both cases i get this error 500 HTTP Analyzer Server Error The server sent HTTP status code 401: Unauthorized: .....
How can i get through this?
Thanks
UPDATE
I also tried to pass Authentication option to Request HTTP Headers but get the error message :
Error 403--Forbidden
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.4 403 Forbidden
The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.
If you're using Basic authentication, all you need is set request header Authorization. Value of this header: prefix Basic, one space, Base64 encoded string with usrname:password, so your header for Aladin:sesam open should be like this: Basic QWxhZGluOnNlc2FtIG9wZW4=.
On screenshot i see section Request HTTP headers, add Authorization header to it.
I am aware that this is an old post , but this may benefit those who run into this issue.
I am using Jdeveloper 11.1.2. I have secured the JAX-RPC web service (created by exposing PL/SQL poackage) using basic authentication. I attached the security policy: "Auth.xml" using the wizard.
I was able to test this using HTTP Analyzer. I just passed the user credentials in the SOAP Headers as shown below and it worked fine for me.(I also passed invalid creds and no creds to see if the security works as expected.)
Hope this helps !!!

Categories

Resources