How can I get html error description from server when failing to load XML -SOLVED-
in
Programming Questions
•
3 months ago
I have this query for a server:
// temp is a String containing the URL
- try{
- xml = loadXML(temp);
- }catch(Exception e){
- e.printStackTrace();
- }
I intentionally made a mistake in the
URL. When I copy and paste the URL in browser (or click it here) the browser displays a nice message specifying the error made. "
Missing parameter: autor". I'd like to access this information to display it to user. But the stackTrace is much more
cryptographic (pasted at the end) and do not contains the useful message above... How could I get that message?
Any more info needed?
Processing 2.0 willing to be javaScript compatible.
thanks
edit:
this is the html in the page:
- <html>
- <head></head>
- <body>
- <pre style="word-wrap: break-word; white-space: pre-wrap;">Missing parameter: autor. </pre>
- </body>
- </html>
"Java.io.IOException: Server returned HTTP response code: 500 for URL:
http://www.camara.gov.br/SitCamaraWS/Proposicoes.asmx/ListarProposicoes?sigla=PL&numero=&ano=1960&datApresentacaoIni=&datApresentacaoFim=&parteNomeAutor=&siglaPartidoAutor=&siglaUFAutor=&generoAutor=&IdSituacaoProposicao=&IdOrgaoSituacaoProposicao=&&codEstado=&codOrgaoEstado=&emTramitacao= at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436) at java.net.URL.openStream(URL.java:1010) at processing.core.PApplet.createInputRaw(PApplet.java:6960) at processing.core.PApplet.createInput(PApplet.java:6928) at processing.core.PApplet.createReader(PApplet.java:6722) at processing.core.PApplet.loadXML(PApplet.java:6070) at processing.core.PApplet.loadXML(PApplet.java:6060) at buildingQuery2_class$Query.makeQuery(buildingQuery2_class.java:161) at buildingQuery2_class.setup(buildingQuery2_class.java:23) at processing.core.PApplet.handleDraw(PApplet.java:2245) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243) at processing.core.PApplet.run(PApplet.java:2141) at java.lang.Thread.run(Thread.java:680)
http://www.camara.gov.br/SitCamaraWS/Proposicoes.asmx/ListarProposicoes?sigla=PL&numero=&ano=1960&datApresentacaoIni=&datApresentacaoFim=&parteNomeAutor=&siglaPartidoAutor=&siglaUFAutor=&generoAutor=&IdSituacaoProposicao=&IdOrgaoSituacaoProposicao=&&codEstado=&codOrgaoEstado=&emTramitacao= does not exist or could not be read java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:649) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at processing.data.XML.<init>(XML.java:170) at processing.core.PApplet.loadXML(PApplet.java:6070) at processing.core.PApplet.loadXML(PApplet.java:6060) at buildingQuery2_class$Query.makeQuery(buildingQuery2_class.java:161) at buildingQuery2_class.setup(buildingQuery2_class.java:23) at processing.core.PApplet.handleDraw(PApplet.java:2245) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243) at processing.core.PApplet.run(PApplet.java:2141) at java.lang.Thread.run(Thread.java:680)
1