Https请求未到达android服务器

Https请求未到达android服务器,android,json,web-services,http,https,Android,Json,Web Services,Http,Https,我试图访问HTTPS请求,但当我试图从Android应用程序访问它时,它并没有到达服务器,但相同的url在chrome http客户端上工作正常 这是我的POST HTTP请求代码 public String POST(String url){ InputStream inputStream = null; String result = ""; try { String jsonreply; StringBuilder builder

我试图访问HTTPS请求,但当我试图从Android应用程序访问它时,它并没有到达服务器,但相同的url在chrome http客户端上工作正常

这是我的POST HTTP请求代码

 public String POST(String url){
    InputStream inputStream = null;
    String result = "";
    try {
        String jsonreply;
        StringBuilder builder = new StringBuilder();
        HttpClient client = getNewHttpClient();
        HttpPost httpPost = new HttpPost(url);
        Log.d(TAG, "URLS"+url);
        try {
            HttpResponse response = client.execute(httpPost);
            StatusLine statusLine = response.getStatusLine();
            int statusCode = statusLine.getStatusCode();
            if (statusCode == 200) {
                HttpEntity entity = response.getEntity();
                InputStream content = entity.getContent();
                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(content));
                String line;
                while ((line = reader.readLine()) != null) {
                    builder.append(line);
                }
            } else {
                Log.d(TAG, "Status code"+statusCode);
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();

        } catch (IOException e) {
             e.printStackTrace();
        }
        jsonreply = builder.toString();
        return jsonreply;

    } catch (Exception e) {
        Log.d("InputStream", e.getLocalizedMessage());
    }

    // 11. return result
    return result;
}
代码始终返回状态代码404未找到。我非常确定这个url是正确的,因为我在其他应用程序中也访问相同的url。 我不能提供原始的网址,但假的,但类似的是这一个

https://test.test.se/user_session.json?email=test.test%40gmail.se&password=>Test12345%21%40%23%24&brand=LGE&phonemodel=Nexus+5&os_version=4.4.4&os_type=Android

感谢您的帮助

将您的url传递到此功能

公共静态字符串readFeedString URL {

结果是以字符串格式返回。

使用这个。。 试一试{ HttpClient HttpClient=新的默认HttpClient

            HttpContext localcon=new BasicHttpContext();
            HttpGet httpget=new HttpGet(url1);

            HttpResponse response=httpclient.execute(httpget,localcon);
            } catch (ClientProtocolException e) {

                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

您的服务器有自签名证书吗?在您的示例中,您是以GET方式提供参数的,这是有意的吗?是的,我的服务器有自签名证书,我的服务正在返回一些数据,这就是我添加GET的原因,我想我错了,但它是GET请求,我的是POST
            HttpContext localcon=new BasicHttpContext();
            HttpGet httpget=new HttpGet(url1);

            HttpResponse response=httpclient.execute(httpget,localcon);
            } catch (ClientProtocolException e) {

                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }