首页 > 解决方案 > “ORA-29024:证书验证失败”

问题描述

我正在尝试在 oracle 程序中使用 Rest API。我已经创建了 ACL 条目并将 SSL 证书添加到我的 oracle 钱包管理器中。但是当我尝试执行该过程时,我收到错误为“ORA-29024:证书验证失败”。以下是我的 oracle 程序的代码。

create or replace procedure TABADUL_TAS_AUTHENTICATION
 is
  req utl_http.req;
  res utl_http.resp;
  value VARCHAR2(1024);
  value1 VARCHAR2(1024);
  url varchar2(4000) := 'https://tapis.fasah.sa/tabadul/fasahqa/authorization/token';
  name varchar2(4000);
  buffer varchar2(4000); 
  content varchar2(4000) := '{"username":"ijsnj001","password":"P@ssw0rd"}';

begin
 UTL_HTTP.set_wallet('file:d:\tabadul', 'tas123456');
 req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
  utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
  utl_http.set_header(req, 'content-type', 'application/json;charset=utf-8');
  utl_http.set_header(req,'X-IBM-Client-Id','00a2f36e933e2bb9edc76faaf26659eb');
  utl_http.set_header(req,'X-IBM-Client-Secret','7c2829bd6b287b072ee269c9ad8f5ead');
  utl_http.set_header(req,'Accept-Language','en');
  utl_http.set_header(req,'Accept','application/json');

  utl_http.set_header(req, 'Content-Length', length(content));
  utl_http.write_text(req, content);
  res := utl_http.get_response(req);
  -- process the response from the HTTP call
  DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || res.status_code);
  --DBMS_OUTPUT.PUT_LINE('HTTP response reason phrase: ' || res.reason_phrase);

  FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(res) LOOP
    UTL_HTTP.GET_HEADER(res, i, name, value1);
    --DBMS_OUTPUT.PUT_LINE(name || ': ' || value1);
  END LOOP;

  --dbms_output.put_line(content);
  --dbms_output.put_line(utl_http.resp);
  begin
    loop
    --dbms_output.put_line('A');
      utl_http.read_line(res, value, true);
      --dbms_output.put_line(length(value));
      dbms_output.put_line(value);
      --INSERT INTO A VALUES (VALUE);
      --COMMIT;
    end loop;
    utl_http.end_response(res);
  exception
    when utl_http.end_of_body 
    then
      --dbms_output.put_line(SQLCODE||','||SQLERRM);
      utl_http.end_response(res);

    when others then
    --dbms_output.put_line(SQLCODE||','||SQLERRM);
      utl_http.end_response(res);
  end;
end TABADUL_TAS_AUTHENTICATION;

标签: oracleplsql

解决方案


这个问题已经解决了。我在这里写解决方案,它可能对其他人有帮助。因此,无需为实际的网站证书创建钱包,只需为证书链创建钱包。


推荐阅读