Hi,

I think i have found the problem...kind of...i dont think it is with SSL
now...i think it is with the authentication.  I tried another SSL site that
doesnt need authent to access it and it worked fine.  Here is my code:

                HttpClient client = new HttpClient();
 
                client.getParams().setParameter("http.useragent", "Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0)");

                client.getParams().setParameter("http.connection.timeout", 0);
                client.getParams().setParameter("http.socket.timeout", 0);

                HostConfiguration host = client.getHostConfiguration();
                
                try{
                host.setHost(new URI("https://www.securesite.com";, true));
                }
                catch(Exception e)
                {
                    
                }
              
                client.getState().setCredentials(
                        new AuthScope("www.securesite.com", 443, null),
                        new UsernamePasswordCredentials("uname", "passwd")
                    );

                
                client.getParams().setAuthenticationPreemptive(true);
                
                GetMethod get = new GetMethod("/");
                
                get.getParams().setParameter("http.useragent","Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0)");
                get.getParams().setParameter("http.connection.timeout",new
Integer(0));
                get.getParams().setParameter("http.socket.timeout", new
Integer(0));

                
                System.err.println("Authorization required by server");
                
                get.setDoAuthentication( true );

                
                try {

                    int statusCode = client.executeMethod(host, get);
                    
                    System.out.println(get.getResponseBodyAsString());

                } 
                catch(IOException e)
                {
                    e.printStackTrace();
                }
                finally {

                    get.releaseConnection();
                }

And this is the response i get:

20/04/2007 15:28:48 org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing
request: Connection timed out: connect
20/04/2007 15:28:48 org.apache.commons.httpclient.HttpMethodDirector
executeWithRetry
INFO: Retrying request

java.net.ConnectException: Connection timed out: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)


-- 
View this message in context: 
http://www.nabble.com/SSL-Site-tf3509897.html#a10091683
Sent from the HttpClient-User mailing list archive at Nabble.com.

Reply via email to