13 Replies Latest reply: Aug 5, 2013 1:47 AM by Hema RSS

    ORA-29273: HTTP request failed

    Hema


      My oracle version:

       

      Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

      PL/SQL Release 11.2.0.3.0 - Production

      CORE 11.2.0.3.0 Production

      TNS for Linux: Version 11.2.0.3.0 - Production

      NLSRTL Version 11.2.0.3.0 - Production

       

      Please help me in the below piece of code to invoke webservice using utl_http. I seems a admin set up. But, I could not get the steps to go and ask my admin.

      Please give me the steps to invoke the webservice.

       

      DECLARE
        v_base_url            VARCHAR2(500) := 'https://abcdefghijklmn.com/abc/xyz/PushService/pushToDB.json?';
        v_conn_req            utl_http.req;
        v_conn_resp           utl_http.resp;
        v_time_out            PLS_INTEGER := 60;
        v_error_msg           VARCHAR2(4000) DEFAULT NULL;
        v_reply_message       VARCHAR2(2000);
        v_reply_line          VARCHAR2(2000);
        v_receive_message     VARCHAR2(2000);
        v_receive_code        NUMBER;

      BEGIN
          v_conn_req := utl_http.begin_request(v_base_url, 'GET','HTTP/1.0');
          utl_http.set_header(v_conn_req, 'Content-Type', 'application/json');
          utl_http.set_header(v_conn_req,
                              'Content-Length',
                              to_char(LENGTH(v_base_url)));
          utl_http.set_header(v_conn_req, 'HTTP', v_base_url);
          utl_http.set_transfer_timeout(v_time_out);
          utl_http.write_text(v_conn_req, v_base_url);
          -- Initialize Response
          v_conn_resp     := utl_http.get_response(v_conn_req);
          v_reply_message := '';
          -- Retrieve response
          utl_http.read_line(v_conn_resp, v_reply_line, TRUE);
          v_reply_message := v_reply_message || v_reply_line;
          utl_http.end_response(v_conn_resp);
        EXCEPTION
          WHEN UTL_HTTP.END_OF_BODY THEN
            utl_http.end_response(v_conn_resp);
          WHEN UTL_HTTP.request_failed THEN
              DBMS_OUTPUT.PUT_LINE(SQLERRM);
          WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);
      END;

       

      Error :

      ORA-29273: HTTP request failed

       

      ORA-06512: at "SYS.UTL_HTTP", line 1130

       

      ORA-24247: network access denied by access control list (ACL)