无法使用 Oracle PL/SQL 访问 Web 服务
Cannot reach web service with Oracle PL/SQL
我会从 PL/SQL Oracle 11g 调用 Web 服务,但以下脚本不起作用:
declare
v_Endpoint varchar2(500) := '<my_endpoint>';
v_Http_Req Utl_Http.Req;
begin
Utl_Http.Set_Wallet('<my_wallet_path>','<my_wallet_password>');
Utl_Http.Set_Proxy('<proxy_url>:<proxy_password>@<proxy-url>:8080');
v_Http_Req := Utl_Http.Begin_Request(v_Endpoint, 'POST', 'HTTP/1.1');
exception
when others then
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||SQLERRM);
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||UTL_HTTP.GET_DETAILED_SQLERRM);
end;
EXCEPTION: ORA-29273: richiesta HTTP non riuscita
ORA-06512: a "SYS.UTL_HTTP", line 1130
ORA-53203: violazione di sicurezza
EXCEPTION: ORA-06512: a "SYS.UTL_HTTP", line 1130
ORA-06512: a line 7
EXCEPTION: ORA-53203: violazione di sicurezza
Procedura PL/SQL completata correttamente.
使用 SOAPUI 可以毫无问题地连接到端点。我可以使用代理 :8080/script_proxy.pac 在浏览器中打开 URL
钱包包含从下载的证书。
我已在 ACL 中插入 URL test.salesforce.com 并授予运行我的脚本的用户访问权限。
如何解决问题?
您可能需要定义一个ACL 来访问外部网络服务。检查输出:
SELECT * FROM DBA_NETWORK_ACLS;
SELECT * FROM DBA_NETWORK_ACL_PRIVILEGES;
并查看 CREATE_ACL Procedure 的文档:
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
acl IN VARCHAR2,
description IN VARCHAR2,
principal IN VARCHAR2,
is_grant IN BOOLEAN,
privilege IN VARCHAR2,
start_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,
end_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL );
我会从 PL/SQL Oracle 11g 调用 Web 服务,但以下脚本不起作用:
declare
v_Endpoint varchar2(500) := '<my_endpoint>';
v_Http_Req Utl_Http.Req;
begin
Utl_Http.Set_Wallet('<my_wallet_path>','<my_wallet_password>');
Utl_Http.Set_Proxy('<proxy_url>:<proxy_password>@<proxy-url>:8080');
v_Http_Req := Utl_Http.Begin_Request(v_Endpoint, 'POST', 'HTTP/1.1');
exception
when others then
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||SQLERRM);
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
DBMS_OUTPUT.PUT_LINE('EXCEPTION: '||UTL_HTTP.GET_DETAILED_SQLERRM);
end;
EXCEPTION: ORA-29273: richiesta HTTP non riuscita
ORA-06512: a "SYS.UTL_HTTP", line 1130
ORA-53203: violazione di sicurezza
EXCEPTION: ORA-06512: a "SYS.UTL_HTTP", line 1130
ORA-06512: a line 7
EXCEPTION: ORA-53203: violazione di sicurezza
Procedura PL/SQL completata correttamente.
使用 SOAPUI 可以毫无问题地连接到端点。我可以使用代理
如何解决问题?
您可能需要定义一个ACL 来访问外部网络服务。检查输出:
SELECT * FROM DBA_NETWORK_ACLS;
SELECT * FROM DBA_NETWORK_ACL_PRIVILEGES;
并查看 CREATE_ACL Procedure 的文档:
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
acl IN VARCHAR2,
description IN VARCHAR2,
principal IN VARCHAR2,
is_grant IN BOOLEAN,
privilege IN VARCHAR2,
start_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,
end_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL );