File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes POST Request Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "POST Request Java" Watch "POST Request Java" New topic

POST Request Java

Abebe Kebede

Joined: Jun 04, 2013
Posts: 1
Hi every one.

I really stack on this issue. I am making a code that makes POST Request to a server with username and password as a parameter. I dont know why i am getiing 500 error. Here is the code, Please check it for me.

This is what i did.
1. First i send GET request and read the header of the HTTP response to
get the CookieName and CookieValue. This is working.

2. Then i create another HTTP connection to do the post Request, But
this time since it is a new connection the server generates NEW and
different Cookie(To be exact NEW session_ID)from the first one. So I am
sending NEW Request with the OLD session_ID. And i have to create a NEW
connection for ever Request i made, so i cant do both the GET and post
Requests with one Connection.

This one is my potential problem.

1. Do you think i can do the POST request without the Cookie sent again, based on the server login detail below?
2. If not, how can i do the POST request with the connection i created to read theheader(two requests with just one HTTP connection)?
3. The result i am getting is 500 error, Do you think the problem is ONLY from ther server side?
4. Finally What does it mean if i get "Wrong Username and password " message, does that mean surely my post request does work ?
Thank you!

Here is the Login deatail of the server, python based

And here is the source of the login page.

I agree. Here's the link:
subject: POST Request Java