we are using the following code to talk to our website from our client side app, for some reason, we always get back status code of 503. but then when we manually load the site from browser, it just loads find. anything could be wrong with the code? or is there any special setting on server side that could cause this problem?
// the head method
httphead = new HttpHead(url);
httphead.getParams().setParameter("http.socket.timeout", this.socketTimeout);
httphead.getParams().setParameter("http.protocol.cookie-policy", CookiePolicy.IGNORE_COOKIES);
HttpResponse response = this.httpClient.execute(httphead);
statusCode = response.getStatusLine().getStatusCode();
I would start by using tcpdump (or winpcap in windows) to get packet dumps. Then you can see exactly how the two requests differ. Post the differences here if you still can't figure out the problem.
tcpdump -n -s 1000 -A port 80 and host {hostname}
This caused by any number of different things. Basically you are going to need to do your own investigation:
Check that you are actually using the right URL ...
Check the server side logs.
If you have a proxy or reverse proxy between the browser and the service, check to see how far the request gets ...
Attempt to capture the request and reply messages (for the cases that work and don't work) and figure out what the differences are.
Attempt to reproduce the working (browser) case the HttpClient library; i.e. do a GET with the same URL and the same headers.
And so on ...