Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-29259 when calling REST API from PL/SQL

DDavidAug 14 2020 — edited Aug 19 2020

Hi all,

I have created a simple REST API in ORDS, defining methods manually through APEX Interface.

I tested the interface successfully from the Browser, Postman and also an APEX Simple Report.

However, when trying to call the API from PL/SQL, I get an error "ORA-29259: end-of-input reached" when obtaining the response. The code is the following:

declare

    req utl_http.req;

    res utl_http.resp;

    url varchar2(4000) := 'http://apex.oracle.com/pls/apex/dbento1/prueba/dept/';

    buffer varchar2(32000);

begin

    req := utl_http.begin_request(url, 'GET');

    dbms_output.put_line('begin request success');

    res := utl_http.get_response(req);   -- at this point I get ORA-29259 end-of-input reached

    dbms_output.put_line('get response success');

    -- process the response from the HTTP call

    begin

        loop

          utl_http.read_line(res, buffer);

          dbms_output.put_line(buffer);

        end loop;

        utl_http.end_response(res);

    exception

        when utl_http.end_of_body then

          utl_http.end_response(res);

    end;

end;

Any help will be sincerely appreciated.

Thanks in advance,
David

Comments
Post Details
Added on Aug 14 2020
10 comments
7,785 views