title: Why do I get Android : The target server failed to respond?
body: <p>API Link : <code>http://www.familybuds.com/storegrunt-new/api_home/validate_step_one/platform/1</code></p>
  
  <p>POST parameter : <code>store_name = "abc"</code> the code is on GoDaddy Server</p>
  
  <p>This api was working fine till 25July, but suddenly it stopped working from 26th morning on Android APP. The same api is working fine on iPhone APP.</p>
  
  <p><strong>Android Code:</strong></p>
  
  <pre><code>HttpParams httpParameters = new BasicHttpParams();
  HttpConnectionParams.setConnectionTimeout(httpParameters, 10000);
  HttpConnectionParams.setSoTimeout(httpParameters, 10000+12000);
  
  DefaultHttpClient  client = new DefaultHttpClient(httpParameters);
  HttpPost httppost = new HttpPost(url);
  
  HttpResponse response; 
  httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));  
  
  client.addRequestInterceptor(new HttpRequestInterceptor() {              
  
          @Override
          public void process(HttpRequest request, HttpContext context)
                  throws HttpException, IOException {
              // TODO Auto-generated method stub
              if (!request.containsHeader("Accept-Encoding")) {
                  request.addHeader("Accept-Encoding", "gzip");
              }
          }
  
      });
  
  client.addResponseInterceptor(new HttpResponseInterceptor() {
  
          public void process(
                  final HttpResponse response,
                  final HttpContext context) throws HttpException, IOException {
              HttpEntity entity = response.getEntity();
              if (entity != null) {
                  Header ceheader = entity.getContentEncoding();
                  if (ceheader != null) {
                      HeaderElement[] codecs = ceheader.getElements();
                      for (int i = 0; i &lt; codecs.length; i++) {
                          if (codecs[i].getName().equalsIgnoreCase("gzip")) {
                              response.setEntity(
                                      new GzipDecompressingEntity(response.getEntity()));
                              return;
                          }
                      }
                  }
              }
          }               
  
  
      });
  
  // Log.d(TAG, "Executing request: "+ methodToString(mMethod) +": "+ mUri.toString());
  response = client.execute(httppost);
  </code></pre>
  
  <p><strong>Stack trace(Log) for android:</strong></p>
  
  <pre><code>07-26 16:24:28.031: W/System.err(13642): org.apache.http.NoHttpResponseException: The target server failed to respond
  07-26 16:24:28.089: W/System.err(13642):    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:85)
  07-26 16:24:28.097: W/System.err(13642):    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
  07-26 16:24:28.097: W/System.err(13642):    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
  07-26 16:24:28.101: W/System.err(13642):    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
  07-26 16:24:28.105: W/System.err(13642):    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
  07-26 16:24:28.105: W/System.err(13642):    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
  07-26 16:24:28.105: W/System.err(13642):    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
  07-26 16:24:28.105: W/System.err(13642):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:421)
  07-26 16:24:28.109: W/System.err(13642):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
  07-26 16:24:28.113: W/System.err(13642):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
  07-26 16:24:28.113: W/System.err(13642):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
  07-26 16:24:28.117: W/System.err(13642):    at com.webhelper.WebApiRequest.performJSon(WebApiRequest.java:111)
  07-26 16:24:28.121: W/System.err(13642):    at com.webhelper.HttpHelper.doInBackground(HttpHelper.java:171)
  07-26 16:24:28.121: W/System.err(13642):    at com.webhelper.HttpHelper.doInBackground(HttpHelper.java:1)
  07-26 16:24:28.124: W/System.err(13642):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
  07-26 16:24:28.124: W/System.err(13642):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
  07-26 16:24:28.128: W/System.err(13642):    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  07-26 16:24:28.128: W/System.err(13642):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
  07-26 16:24:28.128: W/System.err(13642):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  07-26 16:24:28.132: W/System.err(13642):    at java.lang.Thread.run(Thread.java:1019)
  </code></pre>
  
  <p>Have tried out solution from : <a href="https://stackoverflow.com/questions/6216209/https-connection-android">Https connection Android</a> but with no luck..</p>
  
  <p>I tried putting the same server code on Amazon EC2 Server.. and API worked fine with android and iPhone APP.</p>
  
  <p>Can anyone help, what may be the reason for sudden non-working of Android app for communicating with server(API) on GoDaddy</p>