Need to send a POST request to a Service provider using HTTPS protocol, response from the service provider will be an xml file, need to read that also.
A:
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.
aprock
2010-10-21 17:55:02