I am trying to implement SMS application in Java. I am facing an error. No idea How to fix it.
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 400 for URL: http://www.way2sms.com/FirstServletsms?custid=
Java Result: 1
Appreciate your response on it in advance!!
Anjali GauravSingh wrote:shud
Use real words please.
wll you please share more advice on this
Put the number in the URL:
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.
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!