REST service, always give 404 Context Root Not Found error for the first time request, then work well - websphere

In my REST service, once I start or restart my websphere application server and do a request at the first time, the response will return 404 Context Root Not Found error, after this, do requests on this REST service can work well.
The problem is that the 404 error is always return at my first request after my server start.
Could you give some suggestions?

Related

Postman 503 Service Unavailable

I tried using postman to test my springboot project. When I sent the request, postman made a 503 error, but when I sent the request in the browser, it successfully got a response.
How to solve this problem?
I had the same issue I resolved it like this :
Postman settings
go to the top right of your postman window Settings > proxy > use the system proxy
for my case I added another proxy so I had to desable it when making a local api call. good luck !
503 Service Unavailable clearly states the server is overloaded, you may be running out of memory. Try again or try to restart the server. The post method will say bad request only. So you should try restarting the server if it is yours, or retry after sometime if it is a 3rd party service.
And also can you check and make sure your postman proxy is turned off. Even that causes problems like these sometimes. Check that in proxy tab.

403 error response from IIS on almost alternate request while load testing api

I have a web api which is deployed on IIS.
Api's are going through load test using load runner and almost on all alternative api call, getting 403 error response code, struggling to identify the issue, call is not going to the API, its returned back from IIS
I am doing bearer token authorization, somehow token which were incoming with each request were not valid, that is why the issue was occurring, to overcome this we have increased the lifetime of token to 1 hour and request load test team to generate the token once and send that token only with each request so that we can now see the proper execution time for each end point.
403 error indicates that access to the requested URL by the client is Forbidden for some reason. you need to provide detailed error message snapshot and what is the sub status code. and check that you assign this permission to the site folder:1) IIS_IUSRS,2)NETWORK SERVICE,3)IUSR

Rest template exchange method working incorrectly

I am consuming another restful web service that's https inside my rest WS. When I am running my application on localachine the code works fine. But as soon as I deploy it and then access my application through that url, that rest template call written inside my code gives 400 error.
Here is the log trace
400 Bad Request
: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:524)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:481)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:317)
at com.pekam.myandroid.MainActivity$HttpRequestTask.doInBackground(MainActivity.java:106)
at com.pekam.myandroid.MainActivity$HttpRequestTask.doInBackground(MainActivity.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Probably there should be an issue in your request. Either you are missing mandatory request parameters in your request XML or missing some headers which throw this 400 Bad request exception.
Please follow this Link.It may resolve your issue. Let us know for any issue.

A bad request call to my asmx service causes a http 500 error, what can I do to make it return a http-400 error instead?

I have an ASMX service hosted in IIS 7.5. When it is called with a bad http request (having an empty string value for "host" in the http header), the service returns a http-500 (internal server error). To satisfy company security requirements, it should return a http-400 (bad request) under this situation.
I have verified that the error occurs at the service infrastructure level, and the exception is not thrown from my code. I put try/catch block around the web method but nothing is caught, and the application log has nothing. So the error occurs before my code is executed.
I know WCF can handle the problem gracefully with IErrorHandler; but that's not an option for me at the moment.
Another interesting fact is that when testing inside Visual Studio, the same request causes a 400-error, my desired result.
So my question is: what can I do to make the service hosted under IIS also return a 400 error to a bad request?

Spring Rest Service getting 400 Bad Request after running 2-3 minutes

I have a rest client and server which we have developed using spring. The client will send requests to the server for 2-3 minutes and then starts getting org.springframework.web.client.HttpClientErrorException: 400 Bad Request errors.
Once the 400 error starts the client is unable to communicate with the server.
Any suggestions would be appreciated.
I will try to develop a working example that creates this error.
I have resolved this issue. The code was setting the following for every call:
// Add the Gson message converter
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());
I moved this code to the constructor and no longer getting the 400 Bad Request error.

Resources