You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Tilak Mitra <tm...@us.ibm.com> on 2002/08/21 16:43:14 UTC

HTTPS and PostMethod problem/bug

Hello,
      I am trying to connect to a https site using the PostMethod to post
some data and get the response back.


      // code snippet, using JSSE from Sun as the provider
      Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());


            HttpClient client = new HttpClient();
            client.startSession("airmail.trondent.com",443,true) ;
            try
            {
                  PostMethod post = new PostMethod(
"/login.asp?action=login","C:\\temp") ;
                  post.addParameter("usermail","<myloginname>") ;
                  post.addParameter("password","<mypassword>") ;
                  post.setFollowRedirects(false);

                  client.executeMethod(post);

                  String response = post.getResponseBodyAsString();

                  System.out.println(response) ;

            }
            catch ( Exception e )
            {
                  e.printStackTrace() ;
            }
      }



      The code hangs in the executeMethod, and nothing happens ... no
output, no error , nothing ...

      Can you please advise me, where I am going wrong.
      I am trying to push to use this beautiful package of yours, but am
failing to do a simple proof of concept.

      Please help.

Regards
Tilak

Tilak Mitra
   IT Architect
   IBM Global Services EAD Group
   6301 Northwest 5th Way
   Ft Lauderdale , Fl - 33309
   Cell: 954 263 9050
   Home: 954 227 6669



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[HttpClient] Re: HTTPS and PostMethod problem/bug

Posted by Ortwin Glück <or...@nose.ch>.
I can not try a POST but a GET works when I try (using JDK 1.4 and JSSE):

         try {
             HttpClient client = new HttpClient();
             client.startSession("www.verisign.com", 443, true);
             client.setSSLSocketFactory(null);
             HttpMethod method = new GetMethod("/");
             client.executeMethod(method);
             System.out.print(method.getResponseBodyAsString());
             client.endSession();
         } catch(Exception e) {
             e.printStackTrace();
         }

Please include "[HttpClient]" in front of the subject of further 
postings to this mailing list. The list is high traffic and is filtered 
by many people. So your posting may go unnoticed if you do not prefix 
the subject.

HTH

Odi
I am back to life from vacation

Tilak Mitra wrote:
> Hello,
>       I am trying to connect to a https site using the PostMethod to post
> some data and get the response back.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>