0

I am developing under an example (ExampleClient.zip) I dowloand from http://catalogue.fi-ware.eu/sites/default/files/storage/enablers/ExampleClient.zip

But I have some problems with this error

Exception in thread "main" org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3511)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
at noNamespace.UpdateContextSubscriptionResponseDocument$Factory.parse(UpdateContextSubscriptionResponseDocument.java:71)
at com.sap.research.fiware.ngsi10.test.server.exampleclient.ExampleClient.main(ExampleClient.java:92)
Caused by: org.xml.sax.SAXParseException; systemId: file:; lineNumber: 1; columnNumber: 1; Unexpected end of file after null
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    ... 5 more

this happend when I try to work with the Json Response of my Orion Context.

String Addrres = "http://CENTOS-66.cloudapp.net:1026/version";
    URL url = new URL(Addrres);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();

InputStream inputStream = connection.getInputStream();

UpdateContextSubscriptionResponseDocument respDoc = UpdateContextSubscriptionResponseDocument.Factory.parse(inputStream);

I print the response of my Orion and I realice there is a null and some /ln at the end of the json response that maybe produces this error and when I compare the characters of the response with connection.getContentLength() are not the same with the print of the response that i make, always 5 characters more.

the XML response in this case is

<orion>
<version>0.19.0</version>
<uptime>6 d, 23 h, 23 m, 42 s</uptime>
<git_hash>1ad73b298cd261861203fbffb9c789f6ade2796d</git_hash>
<compile_time>Wed Feb 11 13:00:19 CET 2015</compile_time>
<compiled_by>fermin</compiled_by>
<compiled_in>centollo</compiled_in>
</orion>

the error, It could be problem of the null of the response, or maybe i didn`t realice something.?

Sevle
  • 3,109
  • 2
  • 19
  • 31
  • the way I Print the response is the next one: – Ricardo Diez Mar 23 '15 at 22:51
  • `StringBuffer text = new StringBuffer(); InputStreamReader in = new InputStreamReader((InputStream) connection.getInputStream()); // getContent()); BufferedReader buff = new BufferedReader(in); System.out.println("Getting data ..."); String line; do { line = buff.readLine(); text.append(line + "\n"); } while (line != null);` – Ricardo Diez Mar 23 '15 at 22:55
  • I would need information in terms on API request/responses to help. In particular, could you edit your questions to include XML/JSON of the request (along with the HTTP verb + URL) you are using and the XML/JSON of the response you are receiving, please? Thanks! – fgalan Mar 25 '15 at 15:11
  • In this case I don't use any XML/JSON in the request because it was my first test with the API, and the URL was: http://CENTOS-66.cloudapp.net:1026/version – Ricardo Diez Mar 25 '15 at 16:52
  • the response is 0.19.0 6 d, 23 h, 23 m, 42 s 1ad73b298cd261861203fbffb9c789f6ade2796d Wed Feb 11 13:00:19 CET 2015 fermin centollo – Ricardo Diez Mar 25 '15 at 16:54
  • From Orion REST API point of view, request and response seems to be ok, so I think the questions is related with the Java way of producing the request and/or consuming the response. I would recommend you to add "java" and other more specific labels to the question. – fgalan Mar 26 '15 at 10:08

0 Answers0