I'm working with Oracle 18c.
I want to make plsql procedures that retrieve data (GET/POST) from api through httsp protocol.
So, it work using http, but not with https despite all my efforts.
Below, my code :
set serveroutput on size 30000;
declare
v_req utl_http.req;
v_res utl_http.resp;
v_buffer varchar2(4000);
begin
utl_http.set_wallet('file:Z:\Documents\dev\plsql_http_request\wallets\ewallet.p12','iciC29000!');
v_req := utl_http.begin_request('https://www.google.com/');
v_res := utl_http.get_response(v_req);
utl_http.read_text(v_res, v_buffer, NULL);
utl_http.end_response(v_res);
dbms_output.put_line(v_res.status_code);
dbms_output.put_line(v_res.reason_phrase);
dbms_output.put_line(v_buffer);
end;
I have, off course, generate a wallet using orapki. I make folder and file himself set to convenient permissions (but i have some doubts) : permissions of my wallet and folder
Thanks a lot for your help :-) !
CodePudding user response:
i just have to specify location of the directory, not of the file.
correction :
set serveroutput on size 30000;
declare
v_req utl_http.req;
v_res utl_http.resp;
v_buffer varchar2(4000);
begin
utl_http.set_wallet('file:Z:\Documents\dev\plsql_http_request\wallets\','iciC29000');
v_req := utl_http.begin_request('https://www.google.com/');
v_res := utl_http.get_response(v_req);
utl_http.read_text(v_res, v_buffer, NULL);
utl_http.end_response(v_res);
dbms_output.put_line(v_res.status_code);
dbms_output.put_line(v_res.reason_phrase);
dbms_output.put_line(v_buffer);
end;
And i delete "!" in my password to avoid another oracle's error.
I have, already, an error : "ORA-29024: Certificate validation failure".