The server is returning status code 400, which means it didn't understand your request -- i.e., the data you sent to the server was ill-formed. We can't tell you how to fix it, since you're not showing us any code.
The stack trace doesn't tell us anything -- the original error message has all the information you need. The URL you're trying to use is not valid; the server doesn't like the inputs you're sending to it. I don't know anything about this servlet or what it expects. You need to learn about it so you can send the correct parameters. I don't think we can help you any more here; you're going to have to go do a little research on the proper way to post to that servlet. In other words, it's not a Java programming problem.
Joined: Nov 03, 2009
Well, I am still trying to debug the application. Could not find the solution. URL is valid when i execute it from browser. Any advice is appreciable
Anjali GauravSingh wrote:Well, I am still trying to debug the application. Could not find the solution. URL is valid when i execute it from browser. Any advice is appreciable
I had same issue as your's and ONLY work-around I found was to use apache commons http-client. Usng HttpURLConnection, I can not connect several web servers, and I use http-client from commons in that case. Still exploring the root cause of failure.
Joined: Nov 03, 2009
Thanks for your advice but will you please elaborate your suggestion little bit more.
Joined: Sep 17, 2008
Anjali GauravSingh wrote:Thanks for your advice but will you please elaborate your suggestion little bit more.
You can get lots of example on how to use HttpClient. Here I am attaching one sample code to do so. Hope it helps. You have to write one function (see comments)
Right now I could not explain why HttpURLConnection gets 4xx errors, in spite of adding User-Agent property. I let you know if I find.">
I experienced the same error while writing a similar sms class. After much running around and searching, i eventually found it was the proxy server at my office that was refusing connections.
I suggest you also look at this possibility in your own case.
oops! old thread... I didn't look at the dates. Hope my contribution still helps someone though!