• 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

Problems in HTTPS Post Login to a form inside Iframe from Java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying to login to a website https://online.firstdata.de/esp/concardis/

The problem is that the login form through which a post request is made to the server is placed inside an iframe. The url of the login form is actually a redirect link and the user is redirected to another url which then renders the after login page. When I make a post request to the url of this login form from java then instead of redirecting the page to the another url the post request returns an error page. Does anybody have any knowledge of how to login to a form inside an iframe which redirects to another link from Java?




 
Saloon Keeper
Posts: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what the problem is, but if this was my problem, I'd use the HtmlUnit library - IMO the best Java library for programmatic web access.
 
Ishan Ganeshan
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 reply. Problem is that my post request to the login form is rejected as the url that i post to is a redirect link to another url. It logs in my correctly when i do from browser. But from java some reason it is not.
 
Tim Moores
Saloon Keeper
Posts: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HtmlUnit can be set to handle redirects (or even does so by default, I'm not sure).
 
Ishan Ganeshan
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 would try with htmlunit
 
Ishan Ganeshan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried using htmlunit but since the redirect page is the same as the page containing the form inside an iframe hence it enters into an infinite loop. This is a general problem with html unit i think. When the url of the redirect page is the same as the page from which the request originates then it enters into an infinite loop. Problem is that in my page the form is inside an iframe. Below is a brief description of problem :


I am trying to login to a web page https://online.firstdata.de/esp/concardis/ using HTMLunit library in Java. The thing is that this page contains a form inside a couple of iframes. The source of the iframe containing the form is https://online.firstdata.de/login/postlogin/UserDispatcher . When a form is submitted then one of the redirect links before the next page is rendered is also the same link as mentioned above. So, this creates an infinite loop when I use it from Java. However, when the login happens from the browser because the main source of the originating page was the link ending with /concardis the redirect link is not the same as this link and hence there is no infinite loop. How can I simulate this same behaviour from Java? Here is my code :


 
Tim Moores
Saloon Keeper
Posts: 7590
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess would be that either cookies or the referer header are not set and/or sent correctly - both seem to be missing from the code.
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic