As salamualikum (islamic greetings), brothers and sisters. :)
Hope you are well with the grace of Almighty Allah (swt)
If you confirm about creating Oracle Database ACL (Access Control List ) for 11g and higher,
and getting following error for calling a web service or web address, then this solution if for you.
Error
Error starting at line : 1 in command -
begin
PROC_URL_CALL;
end ;
Error report -
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1130
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "HR.PROC_URL_CALL", line 8
ORA-06512: at line 2
29273. 00000 - "HTTP request failed"
*Cause: The UTL_HTTP package failed to execute the HTTP request.
*Action: Use get_detailed_sqlerrm to check the detailed error message.
Fix the error and retry the HTTP request.
begin
PROC_URL_CALL;
end ;
Error report -
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1130
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "HR.PROC_URL_CALL", line 8
ORA-06512: at line 2
29273. 00000 - "HTTP request failed"
*Cause: The UTL_HTTP package failed to execute the HTTP request.
*Action: Use get_detailed_sqlerrm to check the detailed error message.
Fix the error and retry the HTTP request.
Where PROC_URL_CALL have the following code,
create or replace PROCEDURE PROC_URL_CALL AS
l_url VARCHAR2(500) := 'http://allieditbd.com';
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
-- Make a HTTP request and get the response.
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
-- Make a HTTP request and get the response.
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
and calling the procedure ,
begin
PROC_URL_CALL;
end ;
PROC_URL_CALL;
end ;
There is no error in the ACL creation, issue in the procedure where we set default value for url.
remove the http:// and add www.
Now the code will be
create or replace PROCEDURE PROC_URL_CALL AS
l_url VARCHAR2(500) := 'www.allieditbd.com';
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
-- Make a HTTP request and get the response.
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
-- Make a HTTP request and get the response.
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
Now run call the procedure
begin
PROC_URL_CALL;
end ;
PROC_URL_CALL;
end ;
and you will get
PL/SQL procedure successfully completed.
Thanks for reading the post and congratulation on your success.
No comments:
Post a Comment