1 2 3 4 Previous Next 46 Replies Latest reply on Nov 19, 2018 2:57 PM by cagreek Go to original post
      • 45. Re: 401 Unauthorized in REST Web Service Source
        rareddy

        'x' is the column name defined in your XMLTABLE definition. What Steve gave in that example is sample XML document, you need to replace with yours.

        • 46. Re: 401 Unauthorized in REST Web Service Source
          cagreek

          We had a similar issue with one of our JDV services that access a JSON, REST object.

           

          1) When creating your REST source model, the invokeHttp is created.   You will noticves that the results blob field should be in the begining of the procedure as noted.  by Steven Hawkins on Oct 31, 2017 8:08 AM above.  Once adjusted, import back the teiid ddl in to your project.

           

           

          CREATE FOREIGN PROCEDURE invokeHttp (

              OUT result blob NOT NULL RESULT,

          IN action string(4000),

          IN request object,

          IN endpoint string(4000),

          IN stream boolean NOT NULL,

          OUT contentType string(4000),

          IN headers clob

          );

           

           

          2) for your view, take a look a close look at the invokeHttp.  If you have a bearer token, make sure the "headers section is defined as jsonObject

           

          BEGIN

          DECLARE STRING VARIABLES.qp = ''

          SELECT A.response AS response FROM (EXEC SourceModel.invokeHttp(action => 'GET', endpoint => VARIABLES.qp, stream => 'TRUE', headers => jsonObject('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx' as "Authorization"))) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS response string PATH 'text()') AS A; 

          END

           

          1 2 3 4 Previous Next