I am using below code for server connection
HttpResponse response = null;
// Creating HTTP client
HttpClient httpClient = new DefaultHttpClient();
// Creating HTTP Post
HttpEntity entity = null;
String data = null;
// Making HTTP Request
try {
if (method == KEY_GET) {
HttpGet httpget = new HttpGet(url);
response = httpClient.execute(httpget);
} else if (method == KEY_POST) {
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json; charset=utf8");
httpPost.addHeader("Accept", "application/json");
//convert parameters into JSON object
StringEntity se = null;
//passes the results to a string builder/entity
try {
se = new StringEntity(postParameter.toString());
} catch (Exception e) {
}
//sets the post request as the resulting string
httpPost.setEntity(se);
response = httpClient.execute(httpPost);
}
entity = response.getEntity();
data = EntityUtils.toString(entity);
} catch (ClientProtocolException e) {
// writing exception to log
e.printStackTrace();
} catch (IOException e) {
// writing exception to log
e.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
}
Earier it was working for all requests. But now after Implementing SSL on server its giving me "javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found." error.
How can I resolve it?
Thanks in advance