I've got to write a java servlet to Login to a website which uses SSL. When
you look at the web page that does the log on, the form uses a post.

I create the url

  url = (URL) new
URL("https://www.nxtrains.co.uk/NASApp/Neg/RoutingControl";);

then set up a connection 

 HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
 conn.setRequestMethod("POST");
 conn.setDoOutput(true);
  conn.setDoInput(true); 
  conn.setRequestProperty("Content-Length", ""+postData.length());

Then do the connect

 conn.connect();
 OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream());
os.write(postData, 0, postData.length());
os.flush();
os.close();

But it isn't returning the screen which confirms the log on.

Do I need to do an SSL handshake first, and if so what does it look like ?

Thanks

David

Reply via email to