开发者

See entire POST request from Android app

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 acce开发者_运维技巧ss 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());


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜