How to make HTTPS Post request from android to different port (not 443)?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 02:56:20

问题


Here is how I try to make HTTPS Post request in android

String server ="https://myserver.com:4343/api";
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(server);

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("property", value));
request.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));

client.execute(request);

Now I have an error "No peer certificate", though certificate is correct and I can access server from browser with GET request.

I've tried different ways of doing POST request, tried to not specify schema or port in server string. No luck. What am I doing wrong?

来源:https://stackoverflow.com/questions/21264255/how-to-make-https-post-request-from-android-to-different-port-not-443

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!