• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Login and Download file over https

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to automate (i.e. write a program to replace) the manual process of having a human use a web browser to log into a company's HTTPS website and download a file.

I have tried to hunt for code examples and forum issues about doing the same, but no luck. I hope someone will point me at how to get started.

Thanks
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would look at using Apache Commons HttpClient to do this. It has support for SSL along with different login methods.
 
Mike Boota
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I looked at HttpClient and tried the following example. But somehow I can't connect and it keeps giving error. Here is the code I am trying:



but I keep getting the following error. Can someone please help me out here:



If I open a browser and copy the following in URL it directly logs me in

https://my.domain.com/bin/default.asp&UserId=userid?Password=password

How can I log-in throug my script. Thanks
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this when you're compiling or running it?

It looks like your call to the getStatusCode() method on line 47 throws a javax.net.ssl.SSLHandshakeException. I think you just need to catch it.
 
Mike Boota
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's throwing exception here:



Can someone please tell me what might be wrong.
 
S Hayes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That line is probably where you need to catch the exception.

Could you provide a link to the Javadocs for the Apache files? I could probably be of more help to you then.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic