I wrote a code to get the answer from the api, which works correctly in Oracle 21. But in Oracle 11, even though I typed the acl codes, it still gives me the acl error.
Error:
ORA-29273: HTTP request failed ORA-06512: at “SYS.UTL_HTTP”, line 1339 ORA-29261: bad argument ORA-06512: at “APEX_200100.WWV_FLOW_WEB_SERVICES”, line 1284 ORA-29273: HTTP request failed ORA-06512: at “SYS.UTL_HTTP”, line 1130 ORA-24247: network access denied by access control list (ACL)
Code to get information from api:
declare
vClob clob;
vDetectEMP number;
begin
vClob := apex_web_service.make_rest_request(p_url => 'http://localhost:8002',
p_http_method => 'GET');
APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(p_collection_name => 'API_RESPONSE');
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'API_RESPONSE',
p_C001 => vClob);
end;
ACL:
DECLARE
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to '*' and give APEX_030200
-- the "connect" privilege if APEX_030200 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
-- Before checking the privilege, make sure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
--
-- ORA-44416: Invalid ACL: Unresolved principal 'APEX_030200'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
--
SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
FROM XDB.XDB$ACL A, PATH_VIEW P
WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;
DBMS_XDBZ.ValidateACL(ACL_ID);
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_200100',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_200100', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_200100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
------------------------------------------------------------------------------------------------
declare
acl_path varchar2(4000);
begin
select acl
into acl_path
from dba_network_acls
where host = '*'
and lower_port is null
and upper_port is null;
if dbms_network_acl_admin.check_privilege( acl_path, 'APEX_200100', 'connect' ) is null then
dbms_network_acl_admin.add_privilege( acl_path, 'APEX_200100', true, 'connect' );
end if;
exception
when no_data_found then
dbms_network_acl_admin.create_acl(
'power_users.xml',
'acl that lets power users to connect to everywhere',
'APEX_200100',
true,
'connect' );
dbms_network_acl_admin.assign_acl( 'power_users.xml', '*' );
end;
/
-----------------------------------------------------------------------------------------------------
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'ANY_HOST_ACCESS.xml',description => 'POWER ACCESS USER',
principal => 'JRUSER',is_grant => true,privilege => 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'ANY_HOST_ACCESS.xml',
principal => 'JRUSER',is_grant => true,privilege => 'resolve');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'ANY_HOST_ACCESS.xml',
principal => 'APEX_200100',is_grant => true,privilege => 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'ANY_HOST_ACCESS.xml',
principal => 'APEX_200100',is_grant => true,privilege => 'resolve');
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'ANY_HOST_ACCESS.xml',host => '*',lower_port => 1,upper_port => 9999);
end;
/
commit;
/
------------------------------------------------------------------------------------------------
DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
-- Look for the ACL currently assigned to '*' and give APEX_200100
-- the "connect" privilege if APEX_200100 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_200100',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_200100', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_200100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
------------------------------------------------------------------------------------------------
DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
-- Look for the ACL currently assigned to 'localhost' and give APEX_200100
-- the "connect" privilege if APEX_200100 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = 'localhost' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_200100',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_200100', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to 'localhost'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('local-access-users.xml',
'ACL that lets users to connect to localhost',
'APEX_200100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('local-access-users.xml','localhost');
END;
/
COMMIT;
Please help me if anyone knows