So I wanted to use this XML parser class to parse an XML file from one of my sites, which acts as an API. So I came across this XMLParser class over here: XMLParser.java
Since I use https over at my site, I quickly found out this isn't going to work with it, unless SSL is implemented within the code, where it fetches XML file from the URL using the following method:
getXmlFromUrl(String url)
So for my test environment I was quick to create a new httpClient method, which would accept any SSL certificate from.
public static HttpClient createHttpClient()
{
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
HttpProtocolParams.setUseExpectContinue(params, true);
SchemeRegistry schReg = new SchemeRegistry();
schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
return new DefaultHttpClient(conMgr, params);
}
So this is my final XMLParser.java after I did it. XMLParser_New.java
But this all went in vain, as I am repeatedly getting the following exception.
javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
Where have I gone wrong or what is it that I don't understand. Thank you :)