7 Replies Latest reply on Nov 3, 2014 9:41 PM by Ramesh Reddy

    Error while executing a VDB with REST API as a source

    Jaideep Joshi Newbie

      Created a source model, view model and a VDB for a REST API as a source. Followed all the instructions specified in this blog: How to Consume a JSON REST Web Service in Teiid Designer


      While executing the query select * from ( exec "MyViewModel"."getBookViaISBN"('0-7356-0877-6') ) AS X_X, getting following error:


      org.teiid.runtime.client.TeiidClientException: java.lang.RuntimeException: Remote org.teiid.core.TeiidProcessingException: TEIID30152 Failed to evaluate XQuery expression; Please check the query and correct errors in syntax or usage.


      Here is the code for the procedure:


      DECLARE STRING VARIABLES.qp = ('http://demo33-prod.apigee.net/v0/observationtypes' || MyViewModel.getBookViaISBN.isbn);

      SELECT A.ISBN AS ISBN, A.TITLE AS TITLE FROM (EXEC MySourceModel.invokeHttp('GET', 'http://demo33-prod.apigee.net/v0/observationtypes', VARIABLES.qp, 'TRUE')) AS f, XMLTABLE('/response/books' PASSING JSONTOXML('response', f.result) COLUMNS ISBN string PATH 'book/ISBN/text()', TITLE string PATH 'book/TITLE/text()') AS A;

      Can someone help?