Apache Httpclient Logging



Greenhorn
posted 11 years ago
  1. HttpClient provides full support for HTTP over Secure Sockets Layer (SSL) or IETF Transport Layer Security (TLS) protocols by leveraging the Java Secure Socket Extension (JSSE). JSSE has been integrated into the Java 2 platform as of version 1.4 and works with HttpClient out of the box.
  2. Context Logging Context logging contains information about the internal operation of HttpClient as it performs HTTP requests. Each class has its own log named according to the class's fully qualified name. For example the class HttpClient has a log named org.apache.commons.httpclient.HttpClient.
  • Optional 'thank-you' note:
Hi all,
I've got a really big problem. It's about to logging into a https-website with HttpClient.
Here is the site : https://www-930.ibm.com/support/esc/signin.jspLogging
I've also prepared a testaccount for you to test, whether your ideas work or not.

Apache HttpClient is very widely used for sending HTTP requests from java program itself. If you are using Maven, then you can add below dependencies and it will include all other required dependencies for using Apache HttpClient.


Username:

1337iceskater@arcor.de


PW:

1337ic3skat3r


The task is to log in to the site and then work automatically on this page. But it fails at the login, the working process shouldn't be the greatest problem (I hope so).
So here is my code:

I hope you have an idea and/or a solution for my problem =)
Thanks in advantage
Stefan
Rancher
posted 11 years ago

Apache Httpclient Logging Slf4j

  • Optional 'thank-you' note:
Welcome to JavaRanch.
That's a lot of code for doing a login. If you're planning to code real interactions with the web site I'd recommend to switch to a library like jWebUnit (or HtmlUnit, on which jWebUnit is based). That would make the task a lot easier.
If you want to stick with HttpClient, tells in more detail what 'it fails at the login' means - where (and how) does the code deviate from what you expected to happen?
Greenhorn
posted 11 years ago
  • Optional 'thank-you' note:
Thanks for your fast response!
The other tool would be a possibility. But the problem is shown at this piece of code:

That means that everything seems to be ok. But if I call the page, to which the program was redirected, it tells me, that it is at the log in page and on the log in page is a comment

Your login has failed. Please try again.


I think it could be because of the cookiehandling, but it's only a guess.
If I would change the tool to one of yours, could you give me a good tutorial or a hint how I should start?
Thanks in advantage
Stefan
Greenhorn
posted 11 years ago
  • Optional 'thank-you' note:
In addition:
my plan is not to test a website. I have to write an automation for creating some entries on this website.
Rancher
posted 11 years agoApache Httpclient Logging
  • Optional 'thank-you' note:

If I would change the tool to one of yours, could you give me a good tutorial or a hint how I should start?


Just to be clear, I'm not affiliated with these projects, except for having been an occasional satisfied user. For HtmlUnit, start with the 'How do I...' pages on http://htmlunit.sourceforge.net/. For jWebUnit, examples can be found at http://jwebunit.sourceforge.net/quickstart.html

my plan is not to test a website.


That's what I gathered. Both tools can be used outside of any test scenario as general-purpose tools for programmatic web access.
Greenhorn
posted 11 years ago
  • Optional 'thank-you' note:
Apache httpclient logging logback
ok, thanks
I try now with JWebUnit. Maybe this works :P If anybody has an idea, why the program above doesn't work, please let me know.
Thank you
Stefan

Httpclient C# Logging

Ranch Hand
posted 11 years ago

Apache Httpclient Log Request

  • Optional 'thank-you' note:

Apache Httpclient Logging Tools

I have worked on same application as you do have. Doing login in https site and then using other pages within the site. I have achieved the fuctionality using apache http client library using session management. Look more on session management with http client library, It will surely solve your problem.




Comments are closed.