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 19:04:35 UTC

HttpClient : HTTPS and PostMethod problem/bug

Hi,
      The Get is working absolutely fine with me for any site using HTTPS.
      The Post is what just hangs in the executeMethod  for HTTPS urls.
      Is this a bug or am I doing something really wrong ?

      Is there any POST code snippet which someone has (working) ?
      That would be of so much help to me.
      I am trying to push the client to use this nice package, but am stuck
showing a small proof of concept.

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


"Ortwin Glück" <or...@nose.ch> on 08/21/2002 01:00:29 PM

To:    "Jakarta Commons Developers List" <co...@jakarta.apache.org>
cc:    Tilak Mitra/Fort Lauderdale/IBM@IBMUS
Subject:    [HttpClient] Re: HTTPS and PostMethod problem/bug



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>


Re: HttpClient : HTTPS and PostMethod problem/bug

Posted by Ortwin Glück <or...@nose.ch>.
I composed the POST variant of the above snippet. Although the request 
does not make any sense the response comes back correctly.



         try {
             HttpClient client = new HttpClient();
             client.startSession("www.verisign.com", 443, true);
             client.setSSLSocketFactory(null);
             PostMethod method = new 
PostMethod("/telecom/products/index.html?action=login", "C:\\temp");
               method.addParameter("usermail","<myloginname>") ;
               method.addParameter("password","<mypassword>") ;
               method.setFollowRedirects(false);
             client.executeMethod(method);
             System.out.print(method.getResponseBodyAsString());
             client.endSession();
         } catch(Exception e) {
             e.printStackTrace();
         }



Maybe your ASP page does not work correctly and hangs? Check with a 
normal web browser. Use the logging facility (escpecially the wirelog) 
of HttpClient to see what happens. If you use Log4J you can use the 
following properties:

log4j.rootCategory=ERROR, A1
log4j.category.httpclient.wire=DEBUG, A1
log4j.category.org.apache.commons.httpclient=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern = %d %-5p %c %3x - %m\n


Tilak Mitra wrote:
> Hi,
>       The Get is working absolutely fine with me for any site using HTTPS.
>       The Post is what just hangs in the executeMethod  for HTTPS urls.
>       Is this a bug or am I doing something really wrong ?
> 
>       Is there any POST code snippet which someone has (working) ?
>       That would be of so much help to me.
>       I am trying to push the client to use this nice package, but am stuck
> showing a small proof of concept.
> 
> 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>