-1
Sending https via Oracle Version
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
PL/SQL Release 12.2.0.1.0 - Production
"CORE 12.2.0.1.0 Production"
TNS for Linux: Version 12.2.0.1.0 - Production
NLSRTL Version 12.2.0.1.0 - Production
Note 1) Wallet Installed
Obs 2) The problem would not be reproducible for safety reasons Note 3) I have tried with the supplier
I try to send a POST via PLSQL and I get the following error : Error : ORA-24263: Certificate of the remote server does not match the target address.
Question How can I know the value of req := utl_http.begin_request(url, 'POST',https_host =>'??????'); ? is mandatory ?
create or replace PROCEDURE "SMS_ENVIO2" (PNUMSMS IN VARCHAR2 ,
PTEXTO IN VARCHAR2 ,
PRETORNO OUT VARCHAR2)
/*alguns dados ocultos*/
AS
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'https://messaging.o2c.cloud/api/v2/sms/';--acho que posso citar o site
name varchar2(4000);
buffer varchar2(4000);
content varchar2(4000);
VS_USUARIO VARCHAR2(11) := '*****';
VS_SENHA VARCHAR2(20) := '*****';
VS_SERIAL VARCHAR2(8);--VARCHAR2(100);
VS_SCHEDULLE VARCHAR2(16) := TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI');
VS_AUTHOR_64 VARCHAR2(20) := '*********';
begin
UTL_HTTP.SET_WALLET('file:.....', '**********');
--
VS_SERIAL := LPAD(SMSENVIO_SERIAL_SEQ.NEXTVAL,8,'0');
content := ' { ' ||
' "sendSmsRequest": {' ||
' "to": "' || PNUMSMS ||'",' ||
' "message": "' || PTEXTO || '",' ||
' "id": "' || VS_SERIAL ||
' }' ||
' } ';
--
dbms_output.put_line(url);
dbms_output.put_line(content);
--
--req := utl_http.begin_request(url,'POST');
req := utl_http.begin_request(url, 'POST',https_host =>'???????');
utl_http.set_header(req, 'Content-Type', 'application/json');
utl_http.set_header(req, 'Content-Length', length(content));
utl_http.set_header(req, 'Authorization', 'Basic ' || utl_encode.base64_encode(VS_AUTHOR_64));
--
utl_http.write_text(req, content);
res := utl_http.get_response(req);
begin
loop
utl_http.read_line(res, buffer);
end loop;
utl_http.end_response(res);
exception
when utl_http.end_of_body then
utl_http.end_response(res);
end;
dbms_output.put_line('retorno ' || buffer);
exception
when others then
PRETORNO := 'Erro : ' || UTL_HTTP.GET_DETAILED_SQLERRM;
end;
We ended up making another solution, we called off the Oracle. It should work but it didn’t work ... , thankful for the answer however.
– Motta