0
我想張貼在HTTPS一些數據URL存在於該URL,因爲這是唯一的WebServices我的代碼如下張貼在HTTPS web服務的URL
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 url上製作一個httppost。 感謝
其實在給定的例子中,他正在從原始文件夾接受某個特定的密鑰庫,我想接受所有不受信任的證書。 – pyus13