2 Replies Latest reply: Jun 17, 2013 7:17 PM by Daryl E. RSS

    ORA-29269: HTTP server error 500 - at utl_http.get_response

    729456
      Web service gurus,

      I an getting following error at this line of code in pl/sql program - http_resp := utl_http.get_response(http_req);

      ORA-29269: HTTP server error 500 - Internal Server Error

      Following is the pl/sql code -
      ------------------------------------------

      procedure send_auth_response
      as
      soap_request varchar2(30000);
      soap_respond varchar2(30000);
      http_req utl_http.req;
      http_resp utl_http.resp;
      resp XMLType;
      i integer;
      value VARCHAR2(1024);
      begin
      --
      -- initiate wallet for AirClic certificate
      --
      dbms_output.put_line ('1');
      utl_http.set_wallet('file:<wallet path>','<wallet pwd>');
      --
      -- create soap request
      --
      dbms_output.put_line ('2');

      soap_request := '<?xml version="1.0" encoding="UTF-8"?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
      <ns2:sendAuthenticationResponse xmlns:ns2="http://webservice.airclic.com/">
      <authenticationResponse>
      <correlationId>4646735802698040711:2829@ac.prod.pa.z6.1256928493074</correlationId>
      <success>true</success>
      <username>changlanih</username>
      <password>dummy password</password>
      <firstName>hero</firstName>
      <lastName>changlani</lastName>
      <email>hero.changlani@gmail.com</email>
      <active>true</active>
      <timeZone>eastern</timeZone>
      <group>Northeast</group>
      <role>Service Manager</role>
      </authenticationResponse>
      </ns2:sendAuthenticationResponse>
      </S:Body>
      </S:Envelope>';

      --
      -- request that exceptions are raised for error Status Codes
      --
      dbms_output.put_line ('3');
      utl_http.set_response_error_check (true);

      --
      -- allow testing for exceptions like UTL_HTTP.http_server_error
      dbms_output.put_line ('4');
      utl_http.set_detailed_excp_support (true);

      --utl_http.set_transfer_timeout (ln_time_out);
      dbms_output.put_line ('5');
      utl_http.set_body_charset ('UTF-8');
      --
      -- begin request
      --
      dbms_output.put_line ('5.5');
      http_req:= utl_http.begin_request
      ('https://<server name>:443/webservice/product/fieldservice/v1/Webservice',
      'POST',
      'HTTP/1.1'
      );
      dbms_output.put_line ('6');
      utl_http.set_authentication(http_req, '<user to access secure web services>', '<user password>', 'Basic', false);
      dbms_output.put_line ('7');
      utl_http.set_persistent_conn_support (http_req, false);
      dbms_output.put_line ('8');
      utl_http.set_header(http_req, 'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
      dbms_output.put_line ('9');
      utl_http.set_header(http_req, 'Content-Length', length(soap_request));
      dbms_output.put_line ('10');
      utl_http.set_header(http_req, 'SOAPAction', ''); -- required to specify this is a SOAP communication
      dbms_output.put_line ('11');
      utl_http.write_text(http_req, soap_request);
      dbms_output.put_line ('12');
      http_resp := utl_http.get_response(http_req);
      --
      -- debug messages
      --
      DBMS_OUTPUT.PUT_LINE('-------utl_http.get_response---------------------');
      DBMS_OUTPUT.PUT_LINE('http_resp.status_code is :'||http_resp.status_code );
      DBMS_OUTPUT.PUT_LINE('http_resp.reason_phrase is :'||http_resp.reason_phrase);
      DBMS_OUTPUT.PUT_LINE('http_resp.http_version is :'||http_resp.http_version);
      DBMS_OUTPUT.PUT_LINE('http_resp.private_hndl is :'||http_resp.private_hndl);
      DBMS_OUTPUT.PUT_LINE('-------utl_http.get_response----------------------');
      --
      --utl_http.read_text(http_resp, soap_respond);
      LOOP
      utl_http.read_line(http_resp, value, TRUE);
      dbms_output.put_line(value);
      END LOOP;

      dbms_output.put_line ('13');
      utl_http.end_response(http_resp);
      --
      dbms_output.put_line ('14');

      exception
      when utl_http.request_failed then
      dbms_output.put_line('1 request failed: ' || utl_http.get_detailed_sqlerrm);
      when utl_http.http_server_error then
      dbms_output.put_line('2 server error: ' || utl_http.get_detailed_sqlerrm);
      when utl_http.http_client_error then
      dbms_output.put_line('3 client error: ' || utl_http.get_detailed_sqlerrm);
      when others then
      dbms_output.put_line('error msg : '||sqlerrm);
      dbms_output.put_line('detailed error code : ' || utl_http.get_detailed_sqlcode);
      dbms_output.put_line('detailed error msg : ' || utl_http.get_detailed_sqlerrm);

      end send_auth_response;


      The output of above program is -
      ------------------------------------------------
      Connecting to the database cpdev.
      1
      2
      3
      4
      5
      5.5
      6
      7
      8
      9
      10
      11
      12
      2 server error: ORA-29269: HTTP server error 500 - Internal Server Error
      Process exited.
      Disconnecting from the database cpdev.

      Any ideas what does "*ORA-29269: HTTP server error 500 - Internal Server Error*" error mean ?
      I have done lot of research for this error with regards to UTL_HTTP package but haven't found anything.

      Ideas ? thoughts ? anyone ?

      Thanx,
      Hero
        • 1. Re: ORA-29269: HTTP server error 500 - at utl_http.get_response
          Yogesh Sontakke
          Hi Hero,

          HTTP 500 suggests an error on the server side, which means that the server which hosts the Web Service you are calling had some kind of an error on it's side. The best way to find more details is check the error log of the server which hosts your WS for any messages with the timestamp of your WS invoke time.

          As an aside, if you want to make Web Service calls from the database then UTL_HTTP is not really recommended. For more details on the recommendations see the following article on My Oracle Support (formerly Metalink) :
          * FAQ : Oracle Database as a Web Services Client (Doc ID 838892.1)

          HTH,
          Yogesh
          • 2. Re: ORA-29269: HTTP server error 500 - at utl_http.get_response
            Daryl E.

            Same question/problem from me too ..

            The server is throwing back this error (which I figure is the 500 part of the message)

             

            JSON::ParserError - 757: unexpected token at 'current=1234':

                    /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/json/common.rb:155:in `parse'

                    /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/json/common.rb:155:in `parse'

                    /usr/local/rvm/gems/ruby-2.0.0-p195/gems/dashing-1.0.5/lib/dashing.rb:68:in `block in <top (required)>'

                    /usr/local/rvm/gems/ruby-2.0.0-p195/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `call'

                    /usr/local/rvm/gems/ruby-2.0.0-p195/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `block in compile!'