【发布时间】:2011-03-28 09:29:53
【问题描述】:
我正在尝试调试我在使用 Web 服务时遇到的一个小问题。我不能 POST 到网络服务,但我可以 GET 就好了。
当我尝试将数据发布到网络服务时,我收到一个 HTTP 1/1 400 错误请求。
有没有办法可以查看更多详细信息?.. 我无权访问托管 Web 服务的服务器
HTTP 邮政编码
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://lino.herter.dk/Service.svc/Data/");
StringBuilder sb = new StringBuilder();
StringEntity se = new StringEntity("test");
se.setContentType("text/xml");
httppost.setHeader("Content-Type","text/xml");
httppost.setEntity(se);
HttpResponse response2 = httpclient.execute(httppost);
sb = inputStreamToString(response2.getEntity().getContent());
【问题讨论】:
-
你能粘贴负责制作 POST 的代码吗?
标签: android wcf post httprequest http-post