Thanks for the detailed information. I have implemented this and got status
code and custom error message as part of the reply body. Our's is a mobile
application that calles these services. In the mobile client, the
"getstatuscode()" method works fine and gets the same status code that I have
given at the sever. However, the custom message does not appear in
"geterrorreason()" method and only appears in the body; I have to read the
"inputstream" to get the error.
In other words: Normally, the result for 404 appears as "HTTP/1.1 404 Not
Found". In this case at the cleint "getstatuscode()" returns 404 and
"geterrorreason()" returns "Not Found".
My requirement is that I send the custom message as follows "HTTP/1.1 535
message1" and "HTTP/1.1 536 message2" etc.. and so at the client
"getstatuscode()" returns 535 and "geterrorreason()" returns message1.
By using the exceptions mentioned in the links, I am getting the reply in the
following way
"HTTP 1.1/ 535
(body) message1"
As a result "getstatuscode()" returns 535 and "geterrorreason()" returns
null.
I do agree that with the help of inputstream the message1 (body) can be
obtained. I just want to know whethere there is a way to get the error as per
my requirement.
--
[Message sent by forum member 'rkonkimalla']
View Post: http://forums.java.net/node/789369