I am trying to post some data on https url there is no certificate for that url because that are only webservices my code is given below
DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
String sourceURL=context.getResources().getString(R.string.web_service_url)+"/authenticateUser";
Log.d("INSIDE AUTHENTICATION", "URLSOFAuthenticateuser" +sourceURL);
HttpPost postMethod=new HttpPost(sourceURL);
List<NameValuePair> userDetails = new ArrayList<NameValuePair>();
userDetails.add(new BasicNameValuePair("userId", userId));
userDetails.add(new BasicNameValuePair("userPass", userPass));
try {
Log.d("inside", "&*&*&*&*"+userDetails);
postMethod.setEntity(new UrlEncodedFormEntity(userDetails));
Log.d("iNSIDE 1", "&*&*&*"+hc.execute(postMethod,res));
response=hc.execute(postMethod,res);
Log.d("iNSIDE 2", "&*&*&*");
}
catch(HttpResponseException g)
{
Log.d("", "&*&*&*HttpResponseException");
}
catch (UnsupportedEncodingException e) {
Log.d("", "&*&*&*UnsupportedEncodingException");
} catch (ClientProtocolException e) {
Log.d("", "&*&*&*ClientProtocolException");
} catch (IOException e) {
Log.d("", "&*&*&*IOException");
}
return response;
could you please help me regarding the problem.Is there any way to make an httppost on https urls.
Thanks
http://blog.crazybob.org/2010/02/android-trusting-ssl-certificates.html
This should help..let me know if you still face issues.