• Post Reply Bookmark Topic Watch Topic
  • New Topic

Login and Download file over https  RSS feed

 
Mike Boota
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
S Hayes
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!