• 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

HttpUrlConnection post request not working fine.

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Thanks in advance for reading the post.

I was trying to log in to a secured credit card site from a java application . the code which i used to connect to the site is given below.But I am not able to make the application working fine.

-----------Code---------------------------------------------------

String urlString = "https://www99.www99.testCardLogin/action?request_type=LogLogonHandler&location=test+logon_1";

URL url = new URL(urlString);

HttpURLConnection connection = (HttpURLConnection)url.openConnection();



connection.setRequestMethod("POST");
connection.setRequestProperty("UserID", "anyuser");
connection.setRequestProperty("Password", "pwd");
connection.setRequestProperty("Face", "someFaceValu");
connection.setRequestProperty("Logon", "valueforlogin");
connection.setRequestProperty("DestPage", "https://www99.testCardLogin.com/estatement/us/action?request_type=authreg_Statement&BPIndex=1&sorted_index=0&Face=nothing");
connection.connect();

-------------------------Code-------------------------------------


When I am reading from the Stream source from the connection object i am getting this in response.. "Our System is Not Responding"

but i put all the above values to variable in a sample html page and put method as "POST" it logged into the site.. I changed Post to Get and i got the same error as i get from my applicaiton "Our System is Not Responding". I think the system is not submitting it as Post.. what can be the solution for this issue?


Thanks a lot for your time.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this really the code you're trying to run? The domain is obviously bogus, so I'd be surprised if you got any response.

Also, you should be using javax.net.ssl.HttpsURLConnection, not java.net.HttpURLConnection, since this is an HTTPS connection.
 
sreekuttan nair
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the code i run and i got response 200 ok. but the request is not submitting properly..either it is not submitting as "post" or it is not submit the request varibales using requestproperites.

I am also suspecting the request property encoding can also be the issue.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic