This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes http response code 400 in httpurlconnection's getinputstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "http response code 400 in httpurlconnection Watch "http response code 400 in httpurlconnection New topic
Author

http response code 400 in httpurlconnection's getinputstream

mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
hi. im baffled why the con.getInputstream() returns an http response code of 400. here is the code


any ideas? thanks


Website/Java Games: http://www.chitgoks.com
Tech Blog: http://tech.chitgoks.com
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

A HTTP 400 error code is a "Bad Request". Can you reach the site with a browser? I see you are attempting to upload some data. Is there a service on the server side that can receive data?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
yes. actually it works if the file is small. the problem arises when the file's big
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

What size file breaks it? Is there a limitation on the server?
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
hey joe i will let you know. my friend who did the server side module modified the code to accept an xml with base64 rather than sending the inputstream byte array when http posting
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: http response code 400 in httpurlconnection's getinputstream
 
Similar Threads
how to extract rar or zip files in java?
java.net.ProtocolException: Does not support output
Send file to applet from PHP
Problem writing to http URL with PUT (and HttpURLConnection)!
File COuld not be posted on IIS 5.0 via Servlet