I am trying to connect to an https site from a java servlet, pull back the response and parse the results. I know that I was able to do this at one point, but the server I am using has just been upgraded and haven't tried it since then. I am not sure if something is different in security, or if that even has anything to do with it?
Here is my code:
StringBuffer sb = new StringBuffer();
sb.append(" sb.append("passurl=somevalue");
sb.append("&mode=normal");
try {
URL aURL = new URL(null, sb.toString(), new iaik.protocol.https.Handler());
HttpURLConnection huc = (HttpURLConnection) aURL.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(huc.getInputStream()));
String line = "";
StringBuffer resp = new StringBuffer();
while((line = br.readLine()) != null)
{
// do something here
}
br.close();
huc.disconnect();
} catch (MalformedURLException e){
System.out.println("MalformedURLException: " + e);
} catch (IOException e){
System.out.println("IOException: " + e);
}
And here is the exception that I get:
IOException: org.w3c. iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure
Any suggestions at all?
Thanks!
Mike
Here is my code:
StringBuffer sb = new StringBuffer();
sb.append(" sb.append("passurl=somevalue");
sb.append("&mode=normal");
try {
URL aURL = new URL(null, sb.toString(), new iaik.protocol.https.Handler());
HttpURLConnection huc = (HttpURLConnection) aURL.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(huc.getInputStream()));
String line = "";
StringBuffer resp = new StringBuffer();
while((line = br.readLine()) != null)
{
// do something here
}
br.close();
huc.disconnect();
} catch (MalformedURLException e){
System.out.println("MalformedURLException: " + e);
} catch (IOException e){
System.out.println("IOException: " + e);
}
And here is the exception that I get:
IOException: org.w3c. iaik.security.ssl.SSLException: Peer sent alert: Alert Fatal: handshake failure
Any suggestions at all?
Thanks!
Mike