Help with calling a secure (SSL) webservice in Android.

Posted by mmattax on Stack Overflow See other posts from Stack Overflow or by mmattax
Published on 2011-01-13T21:55:42Z Indexed on 2011/02/07 15:25 UTC
Read the original article Hit count: 260

Filed under:
|
|

I'm new to Android and am struggling to make a call to an SSL web service for an Android Application. My code is as follows:

Log.v("fs", "Making HTTP call...");
HttpClient http = new DefaultHttpClient();
HttpGet request = new HttpGet("https://example.com/api");

try {

    String response = http.execute(request, new BasicResponseHandler());
    Log.v("fs", response);

} catch (Exception e) {

    Log.v("fs", e.toString());
}

The Output is:

Making HTTP call...
javax.net.SSLPeerUnverifiedException: No peer certificate

Any suggestions to make this work would be great.

EDIT I should note that this is a valid cert. It is not self-signed.

© Stack Overflow or respective owner

Related posts about java

Related posts about android