我正在尝试在 https url 上发布一些数据,该 url 没有证书,因为那只是 web 服务,我的代码在下面给出
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;
你能帮我解决这个问题吗?有什么方法可以在 https 网址上发布 httppost。谢谢