How to call Https from standalone java client
843811May 7 2003 — edited May 8 2003I have a java client program which tries to send a XML request to a servlet over https. I have imported the JSSE jar files and placed them in %JAVA_HOME%/jre/lib/ext. I have also prepared the certificate keystore. Then I modified the server.xml file under jakarta-tomcat-3.3.1/conf to include the Http10Connector for the SSL port 8443.
In the program I was able to open the connection like this :
URL myUrl = new URL("https://vbadrina-pc.apac.cisco.com:8443/spe-2.1/com.cisco.cns.remote.http.CNSServlet");
con.setDefaultHostnameVerifier(DO_NOT_VERIFY);
con = (HttpsURLConnection)myUrl.openConnection();
con.connect();
Till this point, I didnt face any problem. Then, I want to send the XML request to this URL by the following code :
OutputStream out = con.getOutputStream();
out.write(post.toString().getBytes());
where post is a StringBuffer object containing the XML request.
Now when the command intResCode = con.getResponseCode(); is executed, its returning 404 as response code and page not found error in the tomcat console.
Can anybody help me out as to what else should be done as part of configuring SSL and HTTP.
thanks
vijay