0

Envio de https via Oracle Versão

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

Obs 1) Wallet Instalado

Obs 2) O problema não seria reproduzível por questões de segurança Obs 3) Já tentei com o fornecedor

Tento enviar um POST via PLSQL e recebo o seguinte erro : Erro : ORA-24263: Certificate of the remote server does not match the target address.

Pergunta Como posso saber o valor de req := utl_http.begin_request(url, 'POST',https_host =>'???????'); ? é obrigatório ?


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;

1 Resposta 1

-4

Se o certificado não estiver emitido para o endereço que está usando, você coloca no https_hosts o endereco para o qual o certificado foi emitido. O certificado foi emitido novamente em maio e está igual, deveria funcionar agora sem precisar do https_hosts.

2
  • Acabamos fazendo outra solução , chamamos fora do Oracle. Deveria funcionar mas não funcionava ... , grato pela resposta todavia.
    – Motta
    1/07/2021 às 17:07
  • Resolvemos este problema na versão 19 , wallet habilitado o https funciona.
    – Motta
    20/12/2023 às 14:03

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .