SET SERVEROUTPUT ON SIZE 40000
DECLARE
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
BEGIN
UTL_HTTP.SET_WALLET(path => 'system:');
req := UTL_HTTP.BEGIN_REQUEST('https://login.windows.net/common/discovery/keys');
resp := UTL_HTTP.GET_RESPONSE(req);
DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
UTL_HTTP.END_RESPONSE(resp);
END;
/
If this test is successful, then a PL/SQL procedure successfully completed
message appears.
If the following messages appear, then it means that a database network access control list (ACL) policy blocked your test and you will need to temporarily set an access control list policy to allow you to test this:
ORA-29273: HTTP request failed
ORA-24247: network access denied by access control list (ACL)
- Set the ACL as follows:
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'username_placeholder',
principal_type => xs_acl.ptype_db));
END;
/
Replace username_placeholder
with the user name
of the database user who is running the test. For
example:
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'ADB_USER',
principal_type => xs_acl.ptype_db));
END;
/
- Try running the test again.
- Remove the ACL, because you now no longer need it. For example, to remove the ACL
for
adb_user
:BEGIN
DBMS_NETWORK_ACL_ADMIN.REMOVE_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'ADB_USER',
principal_type => xs_acl.ptype_db));
END;
/