grant execute on utl_http to wc
grant execute on dbms_lock to wc;
BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => 'local_test_acl_file.xml',
description => 'A test of the ACL functionality',
principal => 'WC',
is_grant => TRUE,
privilege => 'connect',
start_date => SYSTIMESTAMP,
end_date => NULL);
end;
/
begin
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'local_test_acl_file.xml',
host => 'ws.domain.local',
lower_port => 5000,
upper_port => NULL);
end;
/
create or replace
procedure send_post_requests
( p_string in varchar2
, p_number in number
) is
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'http://ws.domain.local:5000/test';
name varchar2(4000);
buffer varchar2(4000);
content varchar2(4000) := '{
"string_type":"'||p_string||'",
"number_type":"'||p_number||'"
}';
begin
req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(req, 'content-type', 'application/json');
utl_http.set_header(req, 'Content-Length', length(content));
utl_http.write_text(req, content);
res := utl_http.get_response(req);
-- 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 send_post_requests;
/
begin
send_post_requests('stringggggggg', 123456789);
end;
/
drop procedure send_post_requests;
begin
DBMS_NETWORK_ACL_ADMIN.UNASSIGN_ACL(
host => 'tko.nida.local',
lower_port => 5000);
end;
/
begin
DBMS_NETWORK_ACL_ADMIN.DROP_ACL(
acl => 'local_test_acl_file.xml');
end;
/