如何解决Oracle http请求停止服务TNS的问题:当我尝试使用utl_http调用该操作时,允许的操作时间已到期错误

时间:2019-05-28 09:27:01

标签: oracle rest plsql

我尝试在PL / SQL中使用utl_http调用REST服务,该服务之前运行良好,但是现在我收到以下错误消息:

ORA-29273:HTTP请求失败

ORA-06512:到“ SYS.UTL_HTTP”,行1130

ORA-12535:TNS:测试时间已过

create or replace PROCEDURE PROCEDURE1() IS


    soap_req_msg VARCHAR2(2000);
    http_req  UTL_HTTP.req;
    http_resp UTL_HTTP.resp;
    buffer    varchar2(4000);
BEGIN

soap_req_msg := '{"emailReceiver": "example@mail.com"}'


 http_req := UTL_HTTP.begin_request('<ip_port>/path','POST','HTTP/1.1');
 UTL_HTTP.set_header(http_req, 'Accept-Encoding', 'gzip,deflate');
 UTL_HTTP.set_header(http_req, 'Content-Type', 'application/json');
 utl_http.set_header(http_req, 'SOAPAction', 'processEDIData');
 UTL_HTTP.set_header(http_req, 'Content-Length', length(soap_req_msg));
 UTL_HTTP.set_header(http_req, 'Host', '<ip_port>');

 UTL_HTTP.write_text(http_req, soap_req_msg);
 http_resp := UTL_HTTP.get_response(http_req);
 begin
   loop
     utl_http.read_line(http_resp, buffer);
     dbms_output.put_line(buffer);
   end loop;
   utl_http.end_response(http_resp);
   exception
   when utl_http.end_of_body then
     utl_http.end_response(http_resp);
 end;

END PROCEDURE1;

0 个答案:

没有答案