• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Logging in with HttpClient from Apache

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.jsp

I've also prepared a testaccount for you to test, whether your ideas work or not.
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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Stefan Stadler
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Stefan Stadler
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In addition:

my plan is not to test a website. I have to write an automation for creating some entries on this website.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Stefan Stadler
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic