Content is not allowed in prolog.
lewis.watson Jun 19, 2014 11:13 AMHello,
I'm in the process of setting up a REST web API as a data source in JBoss Data Virtualization. I created a API using Python REST API Framework — Eve 0.4-dev documentation but ran into difficulties when previewing my view.
SELECT A.location AS location, A.role AS role, A.firstname AS firstname, A.born AS born, A.lastname AS lastname FROM (EXEC Eve_People_source.invokeHttp('GET', null, 'http://eve-demo.herokuapp.com/people', 'TRUE')) AS f, XMLTABLE('/resource/resource' PASSING XMLPARSE(DOCUMENT f.result) COLUMNS location string PATH 'location/text()', role string PATH 'role/text()', firstname string PATH 'firstname/text()', born string PATH 'born/text()', lastname string PATH 'lastname/text()') AS A
SQL Results
select * from "Eve_People_view"."people" TEIID30151 Remote org.teiid.core.TeiidProcessingException: TEIID30151 Error building Source for context item. Elapsed Time: 0 hr, 0 min, 1 sec, 896 ms.
Server Console
15:55:56,751 ERROR [stderr] (Worker1_QueryProcessorQueue3) Error on line 1 column 1 15:55:56,751 ERROR [stderr] (Worker1_QueryProcessorQueue3) SXXP0003: Error reported by XML parser: Content is not allowed in prolog. 15:55:56,754 WARN [org.teiid.PROCESSOR] (Worker0_QueryProcessorQueue2) TEIID30020 Processing exception for request 0NOkK/7jXj13.0 'TEIID30151 Error building Source for context item.'. Originally TeiidProcessingException 'Content is not allowed in prolog.' org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source). Enable more detailed logging to see the entire stacktrace.
I believe the problem comes down to a missing line in the XML response from http://eve-demo.herokuapp.com/people.
It currently returns
<resource href="eve-demo.herokuapp.com/people" title="people"> <link rel="parent" href="eve-demo.herokuapp.com" title="home"/><resource href="eve-demo.herokuapp.com/people/539fdea42b996e00026114fb" title="person"> ...
but I think Teiid wants
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <resource href="eve-demo.herokuapp.com/people" title="people"> <link rel="parent" href="eve-demo.herokuapp.com" title="home"/><resource href="eve-demo.herokuapp.com/people/539fdea42b996e00026114fb" title="person"> ...
I don't know how common it is for REST API's to drop the "<?xml..." line but I think ideally Teiid should be able to handle it. Is there something I can do at the Teiid end or will I have to rely on the API maintainer to provide 100% valid XML?
Thanks in advance!
Lewis