title: How to call https web service in Android
body: <p>Hello I am working on android application where I need to call Web Service where I am using <code>https</code> protocol. I am able to call simple <code>http</code> protocol based web service but did not find any correct solution to call <code>https</code>. I found many threads of stackoverflow like <a href="https://stackoverflow.com/questions/2703161/how-to-ignore-ssl-certificate-errors-in-apache-httpclient-4-0">How to ignore SSL certificate errors in Apache HttpClient 4.0</a> but all they are bypassing the SSL that results no mean of <code>https</code>. I don't want to bypass SSL.</p>
  
  <p>I am doing this but it is not working.</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
  
  // Prepare a request object
  HttpGet httpget = new HttpGet(url); 
  
  // Execute the request
  HttpResponse response;
  try {
      response = httpclient.execute(httpget);
      // Examine the response status
      Log.i("Praeda",response.getStatusLine().toString());
  
      // Get hold of the response entity
      HttpEntity entity = response.getEntity();
      // If the response does not enclose an entity, there is no need
      // to worry about connection release
  
      if (entity != null) {
  
          // A Simple JSON Response Read
          InputStream instream = entity.getContent();
          String result= convertStreamToString(instream);
          // now you have the string representation of the HTML request
          instream.close();
      }
  
  
  } catch (Exception e) {}
  </code></pre>
  
  <p>Please help me to do this. Thanks in advance.</p>