10 Replies Latest reply on Apr 11, 2017 8:46 AM by rareddy

    Odata support with TEIID issue




      I am accessing the teiid with odata support




      where webservice is a vdb, Customers is model name and CustomersView is my view name.

      using restEasy client but i am getting below error



      i am using correct credentials user and id.

      BUT using simpleclient query --

      mvn exec:java -Dvdb="webservice" -Dsql="select * from Customers.CustomersView" -Dusername="app" -Dpassword="password"

      i am able to get the result.


      not via odata url.


      Please look if somebody can assist.




        • 1. Re: Odata support with TEIID issue

          Did you try it using a browser issuing the same request? I suspect some issue in passing credentials in your Resteasy client.

          • 2. Re: Odata support with TEIID issue

            Yes Ramesh I tried using browser as well but getting same issue

            • 3. Re: Odata support with TEIID issue

              Well that does not make any sense. What is the Teiid version you are using? In Teiid 9.1 on wards we removed the OData V2 support, so you can try the OData V4 and see if that works for you. The equivalent URL for that would be



              • 4. Re: Odata support with TEIID issue

                Your user needs to have role 'odata' assigned.


                One more question. Did you modified web.xml descriptor of teiid-odata.war in any way?

                • 5. Re: Odata support with TEIID issue

                  yes got it and working fine 




                  one more issue is:

                  i have rest service which is returning a JSON response i  am creating a view and fetching  json response in VDB like below---

                  (EXEC CustomerSource.invokeHttp('GET', null, '<URL>', 'TRUE'))

                       AS f, XMLTABLE('/data' PASSING JSONTOXML('data', f.result) COLUMNS

                           id string PATH 'id/text()',.....


                  IS IT correct format for JSON??


                  VDB is deployed and active but i am not getting data in this view.


                  using simpleclient getting below exception--



                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:606)

                      at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)

                      at java.lang.Thread.run(Thread.java:745)

                  Caused by: org.teiid.jdbc.TeiidSQLException: TEIID20018 Unable to find a component used authenticate on to Teiid

                      at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:135)

                      at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:71)

                      at org.teiid.jdbc.SocketProfile.connect(SocketProfile.java:66)

                      at org.teiid.jdbc.TeiidDriver.connect(TeiidDriver.java:107)

                      at org.teiid.jdbc.TeiidDriver.connect(TeiidDriver.java:55)

                      at java.sql.DriverManager.getConnection(DriverManager.java:571)

                      at java.sql.DriverManager.getConnection(DriverManager.java:215)

                      at JDBCClient.getDriverConnection(JDBCClient.java:70)

                      at JDBCClient.main(JDBCClient.java:59)

                      ... 6 more

                  Caused by: org.teiid.net.CommunicationException: TEIID20018 Unable to find a component used authenticate on to Teiid

                      at org.teiid.net.socket.SocketServerConnection.selectServerInstance(SocketServerConnection.java:147)

                      at org.teiid.net.socket.SocketServerConnection.<init>(SocketServerConnection.java:95)

                      at org.teiid.net.socket.SocketServerConnectionFactory.getConnection(SocketServerConnectionFactory.java:316)

                      at org.teiid.jdbc.SocketProfile.connect(SocketProfile.java:64)





                  • 6. Re: Odata support with TEIID issue

                    Yes, that looks right. Basically you convert the JSON payload into XML format and use the XMLTABLE construct to parse it into tabular data. On the exception, it looks like your VDB is not ACTIVE or connecting to wrong VDB name.

                    • 7. Re: Odata support with TEIID issue

                      thanks ramesh.


                      i am not getting correct example of ODATA POST method call in VDB.

                      In VDB I marked OPTIONS (UPDATABLE 'TRUE') and calling a webservice using GET method

                      data is populating using odata get method  but POST is not working

                      I tried but getting below exception






                      "code": null

                      "message": "TEIID30492 Metadata does not allow updates on the group: .CustomersView"



                      Pls assist with any example for POST method with support Odata.




                      • 8. Re: Odata support with TEIID issue



                        The error message saying that you do not have UPDATABLE 'TRUE' on your CustomersView table. So, the issue is not POST, the issue is not able to update because of metadata. You can try using SQL client and issue a UPDATE against the CustomersView you will see the same error.



                        • 9. Re: Odata support with TEIID issue

                          hi ramesh i made it UPDATABLE 'TRUE' and tried but same issue.


                          Another issue i am facing is:





                          "code": null

                          "message": "TEIID30171 Unexpected multi-valued result was returned for XMLTable column "id". Path expressions for non-XML type columns should return at most a single result."




                          If I have multiple values in JSON for same feild then how to fetch it in a view from rest webservice.

                          I am trying but getting above exception.

                          Is it possible in teiid with odata to get multiple values for a particular field fro rest as a webservice json format???




                          • 10. Re: Odata support with TEIID issue

                            I would need to see your VDB for your update issue. You can attach the XML version of the VDB to the issue.


                            On the multiple values issue, it is not a OData issue, it is your View design issue. You need to have your root of the document on XMLTABLE as the parent element where the multiple values exist. If you need ancestor values use "../???" in your XPATH for the fields.