[英]BasicNetwork.performRequest: Unexpected response code 500
I am using volley for POST method to server. 我正在使用凌空服务器的POST方法。 I am sending two parametars and I am getting this Unexpected response code 500. 我发送了两个参数,并且得到了这个意外响应代码500。
Here is JsonObjectReguest
code: 这是JsonObjectReguest
代码:
JsonObjectRequest req = new JsonObjectRequest(Request.Method.POST,URL, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
VolleyLog.v("Response:%n %s", response.toString(4));
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("Error: ", error.getMessage());
}
}){
protected HashMap<String, String> getParams() {
HashMap<String, String> params = new HashMap<String, String>();
params.put("cid", String.valueOf(id));
params.put("positions", string);
return params;
}
@Override
public HashMap<String, String> getHeaders() throws AuthFailureError {
HashMap<String,String> headers = new HashMap<String, String>();
headers.put("Content-Type","application/x-www-form-urlencoded");
return headers;
}
};
AppController.getInstance().addToRequestQueue(req);
}
Here is my logcat: 这是我的日志:
04-08 02:44:05.110 32385-32511/com.example.bukic.postexample I/System.out﹕ propertyValue:true 04-08 02:44:05.114 32385-32511/com.example.bukic.postexample I/System.out﹕ [socket][3] connection maps.b1.finki.ukim.mk/194.149.138.7:80;LocalPort=45144(2500) 04-08 02:44:05.115 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]connect[maps.b1.finki.ukim.mk/194.149.138.7:80] tm:2 04-08 02:44:05.116 32385-32511/com.example.bukic.postexample D/Posix﹕ [Posix_connect Debug]Process com.example.bukic.postexample :80 04-08 02:44:05.189 32385-32511/com.example.bukic.postexample I/System.out﹕ [socket][/192.168.1.100:45144] connected 04-08 02:44:05.189 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]rx timeout:2500 04-08 02:44:05.302 32385-32511/com.example.bukic.postexample I/System.out﹕ Shutdown rx/tx 04-08 02:44:05.303 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]close[45144] 04-08 02:44:05.304 32385-32511/com.example.bukic.postexample I/System. 04-08 02:44:05.110 32385-32511 / com.example.bukic.postexample I / System.out属性值:true 04-08 02:44:05.114 32385-32511 / com.example.bukic.postexample I / System .out:[socket] [3]连接maps.b1.finki.ukim.mk/194.149.138.7:80;LocalPort=45144(2500)04-08 02:44:05.115 32385-32511 / com.example.bukic。 postexample I / System.out:[CDS] connect [maps.b1.finki.ukim.mk/194.149.138.7:80] tm:2 04-08 02:44:05.116 32385-32511 / com.example.bukic.postexample D / Posix:[Posix_connect调试]处理com.example.bukic.postexample:80 04-08 02:44:05.189 32385-32511 / com.example.bukic.postexample I / System.out:[socket] [/ 192.168。 1.100:45144]已连接04-08 02:44:05.189 32385-32511 / com.example.bukic.postexample I / System.out:[CDS] rx超时:2500 04-08 02:44:05.302 32385-32511 / com .example.bukic.postexample I / System.out:关闭rx / tx 04-08 02:44:05.303 32385-32511 / com.example.bukic.postexample I / System.out:[CDS] close [45144] 04- 08 02:44:05.304 32385-32511 / com.example.bukic.postexample I /系统。 out﹕ Shutdown rx/tx 04-08 02:44:05.305 32385-32511/com.example.bukic.postexample I/System.out﹕ Shutdown rx/tx 04-08 02:44:05.307 32385-32511/com.example.bukic.postexample I/System.out﹕ close [socket][/0.0.0.0:45144] 04-08 02:44:05.309 32385-32511/com.example.bukic.postexample E/Volley﹕ [3280] BasicNetwork.performRequest: Unexpected response code 500 for http://maps.b1.finki.ukim.mk/MapController/save 04-08 02:44:05.313 32385-32385/com.example.bukic.postexample E/Volley﹕ 1 2.onErrorResponse: Error: out:关闭rx / tx 04-08 02:44:05.305 32385-32511 / com.example.bukic.postexample I / System.out:关闭rx / tx 04-08 02:44:05.307 32385-32511 / com.example .bukic.postexample I / System.out:关闭[套接字] [/ 0.0.0.0:45144] 04-08 02:44:05.309 32385-32511 / com.example.bukic.postexample E / Volley:[3280] BasicNetwork。 performRequest:对于意外的响应码500 http://maps.b1.finki.ukim.mk/MapController/save 44:05.313 32385-32385 / com.example.bukic.postexample E /排球:2月4日至8日1 2。 onErrorResponse:错误:
![One of params is cid ][1] ![参数之一是cid ] [1]
[1]: http://i.stack.imgur.com/lY1R5.jpg one of params is cid [1]: http : //i.stack.imgur.com/lY1R5.jpg参数之一是cid
![One of params is cId ][1] ![参数之一是cId ] [1]
[1]: http://i.stack.imgur.com/B0AHG.jpg one of params is cId instead of cid [1]: http ://i.stack.imgur.com/B0AHG.jpg参数之一是cId而不是cid
I recommend you a extension of chrome named Postman . 我建议您将Chrome扩展名为Postman 。 We can send http request and verify the result by using it and it is very useful. 我们可以发送http请求并使用它来验证结果,它非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.