I am getting data from a REST based web service outputting data in XML format.
As I am using DOM and later parsing it to a doc using the DocumentBuilder I am not able to get the server's HTTP Status Code if there is any error.
So, is it Possible to return the HTTP Status Code?
Here is a little snippet:
url = "MY_URL";
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
Any advice is much appreciable.
Thanks