查看来自 Android 应用程序的整个 POST 请求
我正在尝试调试网络服务方面的一个小问题。我无法 POST 到网络服务,但我可以 GET 得很好。
当我尝试将数据发布到 Web 服务时,我收到 HTTP 1/1 400 错误请求。
有没有办法让我看到更多详细信息?..我无权访问托管 Web 服务的服务器
HTTP Post 代码
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());
I'm trying to debug a little problem I have with a web service. I cannot POST to the webservice, but I can GET just fine.
When I try to post data to the webservice I get a HTTP 1/1 400 Bad Request.
Is there a way I can see more details?.. I dont have access to the server, on which the webservice is hosted
HTTP Post code
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());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法可能是在开发计算机上设置 Wireshark,并捕获 Android 和服务器之间的流量。您必须在混杂模式下运行 Wireshark,我认为这是默认选项。
It might be easiest to set up Wireshark on your development machine, and capture the traffic between your Android and the server. You'll have to run Wireshark in Promiscuous mode, which I think is the default option.