Q:

How to know data package that send to server from android

I use the following code to send request to the server:
HttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(
                new AuthScope("localhost", 8080),
                new UsernamePasswordCredentials("username", "password"));

HttpHost targetHost = new HttpHost("www.myhost.com", 443, "https");
targetHost .setHeader("Accept-Language", "en-us,en;q=0.5");
targetHost .setHeader("Accept-Encoding", "gzip,deflate");
targetHost .setHeader("Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.7");
StringEntity se = new StringEntity(myRequestData, "UTF8");
se.setContentType("text/xml");
se.setContentEncoding("gzip,deflate");
targetHost .setEntity(se);
httpclient.excute(targetHost);

The problem is I want to see exactly what I send to server (header, data...) and the response package from server. I know  Wireshark maybe help but I don't know how to use it for my android code. I need some examples or tutorial to do it or maybe has another solution. Thanks in advance!

P/S: I don't have the administrator right and cannot control the server.

A:

Sure, learning how to use Wireshark won't hurt. If you've got the time there's a lot of learning materials on the project's site, including videos.
If you're pressed for time 'though, and especially because you're connecting over SSL, I think it would be faster to implement a "dummy" server that prints whatever it receives, and point your Android code to connect to it. Here's a refresher on server-side sockets in Java. You can also get the actual server's response from the execute's method return value.

