Skip to content Skip to sidebar Skip to footer

File Upload Through Android Gives 503, But Works Fine In Rest Client

I have a web service written in PHP (runs on LAMP stack) that I use to upload a file and process it. When I call this from my android app, the server returns error 503. In Androi

Solution 1:

There are a few things you can do to troubleshoot:

  1. Modify the server to dump the error.
  2. Try setting body content type to application/x-www-form-urlencoded
  3. Make sure the url is correct (http vs https).
  4. Look at the cookies in your rest client and make sure your headers match in the app.

To log all traffic going through HttpClient, use these terminal commands:

//        adb shell setprop log.tag.org.apache.http VERBOSE//        adb shell setprop log.tag.org.apache.http.wire VERBOSE

Add this to your Application class:

    java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);
System.setProperty("org.apache.commons.logging.Log","org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");
System.setProperty("http.keepAlive", "false");

Post a Comment for "File Upload Through Android Gives 503, But Works Fine In Rest Client"