我正在尝试通过 POST 将数据发送到 Web 服务器。
这是我用来执行网络调用的代码:
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
HttpPost post = new HttpPost(url);
StringEntity se = new StringEntity(json.toString());
se.setContentEncoding("UTF-8");
se.setContentType("application/json");
post.setEntity(se);
HttpResponse response = client.execute(post);
json.toString()
我已经使用返回有效 JSON 的jsonlint 进行了验证。
我收到此错误消息作为响应:
11-29 11:03:53.080: I/Storefront(1470): Response = <HTML><HEAD><TITLE>Service Unavailable</TITLE></HEAD><BODY><H1>Service Unavailable - Zero size object</H1>The server is temporarily unable to service your request. Please try againlater.<P>Reference #15.163431d0.1322593433.2b040d2c</BODY></HTML>
“零大小对象”消息让我认为 JSON 数据未正确发送。