我正在根据一个例子开发(ExampleClient.zip)我来自http://catalogue.fi-ware.eu/sites/default/files/storage/enablers/ExampleClient.zip
但我对此错误有一些问题
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
当我尝试使用我的猎户座上下文的Json响应时,就会发生这种情况。
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);
我打印了我的猎户座的响应,我认为在json响应结束时有一个null和一些/ln
,可能会产生这个错误,当我将响应的字符与{{1}进行比较时与我所做的回复打印不一样,总是多5个字符。
这种情况下的XML响应是
connection.getContentLength()
错误,可能是响应无效的问题,或者我没有想到什么。?