Android 调用web服务时出错

Android 调用web服务时出错,android,httpurlconnection,android-volley,Android,Httpurlconnection,Android Volley,在进行了大约8次API调用之后,当我尝试使用volley调用web服务时,我收到了400个错误代码。此版本可在三星galaxy tab的4.0.4版中复制。但它在更高版本的android中运行良好 错误日志: 05-21 10:25:40.880 3947-3947/com.tc D/Volley? [1] DiskBasedCacheclear: Cache cleared. 05-21 10:25:40.890 3947-4028/com.tc I/qtaguid? Failed

在进行了大约8次API调用之后,当我尝试使用volley调用web服务时,我收到了400个错误代码。此版本可在三星galaxy tab的4.0.4版中复制。但它在更高版本的android中运行良好

错误日志:

05-21 10:25:40.880    3947-3947/com.tc D/Volley? [1] DiskBasedCacheclear: Cache cleared.
05-21 10:25:40.890    3947-4028/com.tc I/qtaguid? Failed write_ctrl(t -1 2533528184876433408 -1) res=-1 errno=9
05-21 10:25:40.890    3947-4028/com.tc I/qtaguid? Tagging socket -1 with tag 2328e67600000000(-1557600650) for uid -1 failed errno=-9
05-21 10:25:40.890    3947-4028/com.tc I/NetworkManagementSocketTagger? tagSocketFd(-1, -1557600650, -1) failed with errno-9
05-21 10:25:41.160    3947-4028/com.tc I/qtaguid? Failed write_ctrl(t -1 2533528184876433408 -1) res=-1 errno=9
05-21 10:25:41.160    3947-4028/com.tc I/qtaguid? Tagging socket -1 with tag 2328e67600000000(-1557600650) for uid -1 failed errno=-9
05-21 10:25:41.160    3947-4028/com.tc I/NetworkManagementSocketTagger? tagSocketFd(-1, -1557600650, -1) failed with errno-9
05-21 10:25:41.430    3947-3947/com.tc E/TC? Web service tag: get_config_api_call
05-21 10:25:41.430    3947-3947/com.tc E/TC? onErrorResponse ----1com.android.volley.NoConnectionError: java.io.IOException: Unexpected response code for CONNECT: 400
05-21 10:25:41.430    3947-3947/com.tc E/TC? onErrorResponse com.android.volley.NoConnectionError: java.io.IOException: Unexpected response code for CONNECT: 400
-21 13:05:33.080    2515-2801/com.tc W/System.err? java.io.IOException: Unexpected response code for CONNECT: 400
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeTunnel(HttpsURLConnectionImpl.java:508)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:462)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:441)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:133)
出于测试目的,我用httpurlconnection替换了截击调用,并得到了类似的错误

错误日志:

05-21 10:25:40.880    3947-3947/com.tc D/Volley? [1] DiskBasedCacheclear: Cache cleared.
05-21 10:25:40.890    3947-4028/com.tc I/qtaguid? Failed write_ctrl(t -1 2533528184876433408 -1) res=-1 errno=9
05-21 10:25:40.890    3947-4028/com.tc I/qtaguid? Tagging socket -1 with tag 2328e67600000000(-1557600650) for uid -1 failed errno=-9
05-21 10:25:40.890    3947-4028/com.tc I/NetworkManagementSocketTagger? tagSocketFd(-1, -1557600650, -1) failed with errno-9
05-21 10:25:41.160    3947-4028/com.tc I/qtaguid? Failed write_ctrl(t -1 2533528184876433408 -1) res=-1 errno=9
05-21 10:25:41.160    3947-4028/com.tc I/qtaguid? Tagging socket -1 with tag 2328e67600000000(-1557600650) for uid -1 failed errno=-9
05-21 10:25:41.160    3947-4028/com.tc I/NetworkManagementSocketTagger? tagSocketFd(-1, -1557600650, -1) failed with errno-9
05-21 10:25:41.430    3947-3947/com.tc E/TC? Web service tag: get_config_api_call
05-21 10:25:41.430    3947-3947/com.tc E/TC? onErrorResponse ----1com.android.volley.NoConnectionError: java.io.IOException: Unexpected response code for CONNECT: 400
05-21 10:25:41.430    3947-3947/com.tc E/TC? onErrorResponse com.android.volley.NoConnectionError: java.io.IOException: Unexpected response code for CONNECT: 400
-21 13:05:33.080    2515-2801/com.tc W/System.err? java.io.IOException: Unexpected response code for CONNECT: 400
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeTunnel(HttpsURLConnectionImpl.java:508)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:462)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:441)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)
05-21 13:05:33.150    2515-2801/com.tc W/System.err? at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:133)

我注意到,只有在发出多个请求后才调用API的情况下,才会出现这个问题。如果我只是在对之前的多个请求进行注释后调用它,那么它将正常工作。

如果知道服务器的行为,就不可能找到这个问题的根源。@Egor:这个问题与服务器有关吗?我试过用其他android设备(4.4、5.0、4.2)测试它,没有问题。至少知道在什么情况下服务器返回400是好的。