Need to send a POST request to开发者_Python百科 a Service provider using HTTPS protocol, response from the service provider will be an xml file, need to read that also.
You could start by taking a look at AndroidHttpClient and at HttpPost.
Something like this should work:
final AndroidHttpClient httpClient = AndroidHttpClient.newInstance(this.getClass().getSimpleName());
HttpResponse httpresponse = null;
HttpEntity httpentity = null;
HttpUriRequest httprequest = new HttpPost("https://...");
byte[] xmlByteArray = null;
if ((httpresponse = httpClient.execute(httprequest)) != null) {
if ((httpentity = httpresponse.getEntity()) != null) {
xmlByteArray = EntityUtils.toByteArray(httpentity);
}
}
Also, my RestClient on github might be useful. Note: I use GET to retrieve the data, so YMMV.
精彩评论