File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes problem accessing https through ssl connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "problem accessing https through ssl connection" Watch "problem accessing https through ssl connection" New topic
Author

problem accessing https through ssl connection

Geetha Gubendran
Ranch Hand

Joined: Sep 04, 2006
Posts: 72
Hi I tried the program. The HTTP is working fine but not https. I enquired our INFRA team. When I set the same proxy in my firewall client, I am able to hit both https and http but when I set the proxy in the code, I am able to hit only http and not https. Then the INFRA guy told me that the proxy that we set using http.proxyHost does not allow the traffic to go beyond the intranet. does this property (http.proxyHost) have any limitations? Can someone suggest how to get over this issue?

import java.net.URL;
import java.net.URLConnection;
import java.security.Security;
import org.apache.commons.codec.binary.Base64;
public class TestSSL {
public static void main(String[] args) {
System.getProperties().put( "proxySet","true" );
System.getProperties().put("http.proxyHost", "XXX");
System.getProperties().put("http.proxyPort", "XXX");


System.out.println("bfr");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.out.println("1");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.out.println("2");
try {


//System.getProperties().put("java.protocol.handler.pkgs", "HTTPClient");
//URL url = new URL("https://www.verisign.com/");



//URL url = new URL("https://apps.telstra.xora.com/xoraapps/services/XoraTimeTrackUtilityServices40?wsdl");
URL url = new URL("http://www.google.com");
//URL url = new URL("https://www.verisign.com");
System.out.println("3");
URLConnection con = url.openConnection();

con.setDoInput( true );
con.setDoOutput( true );
System.out.println("4");
//con.connect();
java.io.InputStream urlfs = con.getInputStream();
System.out.println("5");
System.out.println("Successful Connection Establishment =>"+url.getHost());

} catch (Exception e) {
System.out.println("Print Exception Details =>"+e.toString());
}

}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem accessing https through ssl connection