Recently I had to call some web service for my development in Android and I used the following method to achieve that

HttpPost httpPost = new HttpPost(url);

ResponseHandler responseHandler = new BasicResponseHandler();

responseText = httpClient.execute(httpPost, responseHandler);

I got the reponseText as expected. After that I did not run the application for sometime. Now when I ran the application today it suddenly stopped working. I got an IOException saying “The target server failed to respond”. I rechecked everything and the web service was still working as expected in a browser. After struggling with lot of options, I changed HttpPost call to HttpGet call and viola, it started working again.

I have no clue why HttpPost call stopped working all of the sudden. It would be helpful if somebody throw some light on the problem.

Advertisements