Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

http response code 400 in httpurlconnection's getinputstream

 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. im baffled why the con.getInputstream() returns an http response code of 400. here is the code


any ideas? thanks
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. actually it works if the file is small. the problem arises when the file's big
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What size file breaks it? Is there a limitation on the server?
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic