Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid HTTPS Request
    primarykey
    data
    text
    <p>I have tried so many options, I'm going to go crazy. I continue to get an SSL exception every time I try to post to a URL.</p> <p>This works like a dream in C# using an HttpWebRequest.</p> <p>The errors I get are:</p> <pre><code>Not trusted server certificate java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found. </code></pre> <p>I am trying the following approach now, but I have tried custom SocketFactories, everything. Please help!</p> <pre><code> final String httpsURL = "https://..."; final DefaultHttpClient client = new DefaultHttpClient(); final HttpPost httppost = new HttpPost(httpsURL); //authentication block: final List&lt;BasicNameValuePair&gt; nvps = new ArrayList&lt;BasicNameValuePair&gt;(); nvps.add(new BasicNameValuePair("mail", username)); nvps.add(new BasicNameValuePair("password", password)); UrlEncodedFormEntity p_entity = null; try { p_entity = new UrlEncodedFormEntity(nvps, HTTP.UTF_8); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } httppost.setEntity(p_entity); //sending the request and retrieving the response: HttpResponse response = null; try { response = client.execute(httppost, _context); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpEntity responseEntity = response.getEntity(); //handling the response: responseEntity.getContent() is your InputStream try { final InputSource inputSource = new InputSource(responseEntity.getContent()); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload