I'm trying to do a REST/HTTP request from PL/SQL in OCI.
I am stumped when trying UTL_HTTP ( but successful using APEX_WEB_SERVICE package).
Has anyone had success using UTL_HTTP on OCI AutonomousDB?
BEGIN
UTL_HTTP.SET_WALLET('');
http_request := UTL_HTTP.begin_request(UTL_URL.Escape([url]), 'GET');
http_response := UTL_HTTP.get_response(http_request);
UTL_HTTP.read_text(http_response, return_text);
DBMS_OUTPUT.put_line (return_text);
END;
Error report – ORA-01031: insufficient privileges ORA-06512: at "SYS.UTL_HTTP", line 136 ORA-06512: at "SYS.UTL_HTTP", line 1410
ORA-06512: at line 7
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without the necessary privileges.
*Action: Ask your database administrator or designated security administrator to grant you the necessary privileges
I have setup ACL as follows so http privilege is granted:
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '[domain]',
lower_port => 443,
upper_port => 443,
ace => xs$ace_type(privilege_list => xs$name_list('http'),
principal_name => '[name]',
start_date => SYSTIMESTAMP,
principal_type => xs_acl.ptype_db));
END;
/