I am trying to use the HttpsURLConnection as described by sedj in previous posts in the archives and its just not working. The urlConn variable is properly instantiated but when I try to grab the getOutputStream so I can post my XML to it the code exits without even an exception.
Anyone have any ideas? Works fine non-ssl. This code snippet below is the WORKING non-ssl version, the commented lines are what I am uncommenting (and commenting out the non-ssl line) to switch to SSL and have my failure.
Thanks!
Anyone have any ideas? Works fine non-ssl. This code snippet below is the WORKING non-ssl version, the commented lines are what I am uncommenting (and commenting out the non-ssl line) to switch to SSL and have my failure.
Thanks!
Code:
String URL = "[URL unfurl="true"]http://www.site.com");[/URL]
//String URL = "[URL unfurl="true"]https://www.site.com/";[/URL]
URL url = new URL (URL);
URLConnection urlConn = url.openConnection();
//HttpsURLConnection urlConn= null;
try{
//urlConn = (HttpsURLConnection)url.openConnection();
urlConn = url.openConnection();
} catch(Exception e){
System.err.println("ERROR:"+e.getMessage());
}
urlConn.setDoInput (true);
urlConn.setDoOutput (true);
urlConn.setUseCaches (false);
urlConn.setRequestProperty("Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded");[/URL]
printout = new DataOutputStream (urlConn.getOutputStream ());