Getting 400 Bad request error when sending huge amont of data with post - ajax

I am using yahoo YUI Ajax call to post request.
Page is developed in JSP and server is Tomcat 6 and using Struts 2.x.
While i am sending small amount of data using Ajax call post request it is working fine.But when i am sending huge amount of data i am getting 400 bad request error.

The 400 error comes when The Web server thinks that the data stream sent by the client (e.g. your Web browser ) was 'malformed' i.e. did not respect the HTTP protocol completely. So the Web server was unable to understand the request and process it.
There could be possibilities that data is too large, so you should better encode the data using java script inbuilt function for example escape().

Please check maxPostSize attribute of Connector in conf/server.xml.
See the following doc for the details

In Tomcat, when the post data exceeds the maximum specified in maxPostSize (server.xml) it returns a 400 as error code

Related

How to send a file through http post using Data Fusion

Wanted to send a file to an http end point url using Data fusion.
Making this http call as a pipeline alert at the completion of the pipeline.
This is not working. Getting 500 response from API. Can someone help me on how do I send the file?
If this can be achieved with http plugin as sink, please let me know the steps.
I doubt you can send files using HTTP. You can create a request using the HTTP plugin as I answered one of your previous question - Data Fusion - Issue with http post plugin.
In HTTP Callback you can find information:
This action can be used when you want to perform an HTTP request at the end of a pipeline run.
Using this plugin, you can send a request or text, not a file.
If you would like to send a file, you should use File like it's mentioned in this thread: Some questions about google Data fusion
Regarding Error 500
The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
It means that there is an issue with your endpoint. It might be a firewall or HTTP server issue. Too many possibilities of what could be wrong with current details.
In addition, you can find some additional information in doc Ingest CSV data to BigQuery using Cloud Data Fusion - Batch ingestion

Firefox not sending request after response 500

As you guys can see below when I am trying to upload a file XLSX into my API in Firefox, if XLSX does not have all columns that I need to map it to a class, I will throw an Exception and it will return a status 500. If I do not change the file I will get error 500 infinite times. Like below
After some requests it does not send anymore. And it only happens when I change the file, the 4th request below should return status 200. When I debug my application in spring it is not even entering the endpoint.
In Chrome I do not have this problem, I can sent a lot of requests and the behavior is different. Do you guys know if firefox has some security to prevent multiple requests like this? If I reload the page and send the 4th request alone it will return status 200.
I am using Angular 5 + Spring Boot

JMeter error : java.net.SocketException: Unexpected end of file from server

I have read and tried the solutions shared in the previous posts for this error but nothing helped me to fix this. Kindly help.
I am making a HTTPS API call. A very simple call which accepts a 2 KB JSON message via POST method and sends a one word acknowledgement. It works perfectly fine in Postman tool. In JMeter, no. of threads (users) is kept as 25. It works perfectly fine one time with all 25 success response and at times getting few failure response as
Response code: Non HTTP response code: java.net.SocketException
Response message: Non HTTP response message: Unexpected end of file from server
No consistency at all. I have also tried with both enabling and disabling "use keepalive" checkbox. Both giving me all success one time ; few/all failure at another time with the above error. Please help. Thank you.
Below are the JMeter settings:
HTTP Header Manager : Content-Type - application/json
HTTPRequest sampler : protocol - HTTPS
Server Name or IP : project server name
Method : POST
PATH : The required path with https authentication details passed as parameters
IMPLEMENTATION : Set to JAVA (HTTPCLIENT4 was giving me “443 failed to respond” error)
Add header
Connection Keep-Alive
Both errors (Java implementation and Apache HTTPClient4 implementation), are essentially saying the same thing: The server closed the connection, without providing any response. I think there could be the following reasons:
Authentication problem. If server side checks authentication before processing a request (e.g. using Spring), it may be rejecting your request, it may be not bothering with any response if authentication is not considered correct.
Request Issue. Some less noticeable properties of the request you send via Jmeter are different from what you send in Postman. It could be some minor thing with formatting, or some headers server expects. Some of such inconsistencies can also cause Load Balancer (if you use one) to reject request before it's delivered to the server.
Certificate issues. Since you are using HTTPS, you need to make sure your certificate is setup correctly on JMeter side.
So I suggest:
Review server logs and see if your request makes it to the server. If yes, you might be able to see how it was rejected. If not, you need to trace back and see who rejected it (LB, authentication, etc)
Compare headers and body sent by JMeter vs Postman line to line (use TCPDump for example to obtain it).

How to do correlation on dynamic parameter that are occuring in request and not in response in JMETER?

I am developing a mobile script using jMeter. i.e trying to record and replay mobile web applications using JMeter 2.9 and firefox 43.0.4
I am able to record the application. But it throws an error during replay, as some dynamic parameter is passed with the post data as below:
POST data:
skin=&skinLoaderChecksum=&isAjaxRequest=true&**x=****0.7379947959390617**
When I checked the same flow in Load Runner, the same failure occurs on the same URL again.
In Load Runner:
HTTP Status-Code=500 (Internal Server Error) and {"errorCode":"UNEXPECTED_ERROR","errorMsg":"FWLSE0009W: User identity is null. Check your application''s authentication requirements. These settings must match to the deployed application [project mobile]"}
In JMeter:
Response headers:HTTP/1.1 401 Unauthorized in Sampler Result and in response data: /-secure- {"challenges":{"wl_antiXSRFRealm":{"WL-Instance-Id":"geqcaecehouktkfn0rfqmmdu6"}}}/
Is anyone able to help with this?
Responses will be highly appreciated :-).
I don't have Worklight server to play with now hence I can provide you only generic information. You need to properly simulate mobile application authentication flow, actually this dynamic parameter can be fetched from the previous response.
Reference links:
How to do Worklight Server performance testing
How to Load Test CSRF-Protected Web Sites

Parse.com cloud code httprequest status code 200 zero bytes returned

I'm trying to make a httprequest from Parse.com cloud code, but although it returns response status code 200, it doesn't have any data with it (content-length: 0).
Because of my company privacy I can't post an URL on which the request fails, however it returns data successfully when used on http://www.seznam.cz/ or https://gmail.com/ (which returns 301 as a redirection issue, but still succeeds), so it's not caused by a https thing (my url is an api url with https)
Do you have an idea of why would the request succeed but return zero bytes, when in browser the data loads correctly?
Thanks!
It turned out that parse.com httpRequest doesn't use gzip decompression, and the api does, so although it received the response, nothing was returned since no data could be get.
I've overcome this issue by writing a php script posted on my web which get's the api's response, and prints it afterwards, therefore parse.com's httpRequest doesn't need to decompress the gzip and everything works as expected. I needed the same for images, by the way.

Resources