Thursday, July 12, 2012

[android-developers] SSL in Android

Hi all,

How i can use "https://" instead of "http://" in web service
call in my app.


HttpClient httpclient = new
DefaultHttpClient();
HttpPost httppost = new HttpPost("https://example.com");
try {
httppost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpresponse = httpclient.execute(httppost);
responseCode = httpresponse.getStatusLine().getStatusCode();
Log.d("getStatusCode", "" + responseCode);
HttpEntity httpEntity = httpresponse.getEntity();
response = EntityUtils.toString(httpEntity);
Log.d("Response in post httpCall", "" + response);
} catch (ClientProtocolException e) {
Log.d("ClientProtocolException", "" + e);
} catch (IOException e) {
Log.d("IOException", "" + e);
}

Thanks and Regards

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment