I'm writing a client to connect to some RESTfull web services using HttpsURLConnection.
I know that these services, when a failure occurs will return an HTTP response code (500, 400, etc) and also send and XML document in the response body that contains an error message. Unfortunately, the call to getOutputStream() throws an IOException when the response code is 400.
Is there another way to read the response that allows me to see both the HTTP response code and the body of the response under these condition?
I know that these services, when a failure occurs will return an HTTP response code (500, 400, etc) and also send and XML document in the response body that contains an error message. Unfortunately, the call to getOutputStream() throws an IOException when the response code is 400.
Is there another way to read the response that allows me to see both the HTTP response code and the body of the response under these condition?