0

I am making a stored procedure with 2 seperate HTTP Requests. The first one to get an Atuthentication Token and the second one that uses the token.

The first Request works without a problem and I get the token back.

The second Request throws the ora-29259 end-of-input reached exception. They both look exactly the same besides of the URL:

begin
  req := utl_http.begin_request(url,'POST',utl_http.http_version_1_1);
  utl_http.set_header(req, 'Authorization', Token/Credentials);
  utl_http.set_header(req, 'Content-Type', 'application/json');
  utl_http.set_header(req, 'Content-Length', length(content));
  utl_http.write_text(req, content);

  res := utl_http.get_response(req);
    loop
      utl_http.read_text(res, buffer);
      dbms_output.put_line(buffer);
    end loop;
    utl_http.end_response(res);
      
  exception
    when utl_http.end_of_body  then
      utl_http.end_response(res);
end;

I have found this from nearly 3 years ago which suggests updating the database. I am using Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production, is this the issue? I can't find any answer to this googling myself.

The first Website uses TLS 1.2 while the second one uses TLS 1.3, is my Oracle Version too old?

1 Answers1

0

Please provide a sample of your code for a more detailed answer.

But looking at the link you provided, I can already see something missing in the code, which is the exception for utl_http.end_of_body.

This is an example of my code, I used somewhere else:

begin
  req := utl_http.begin_request(url,'POST',utl_http.http_version_1_1);
  utl_http.set_header(req, 'Content-Type', 'application/xml;charset=UTF-8');
  utl_http.set_header(req, 'Content-Length', length(content));
  utl_http.write_text(req, content);

  res := utl_http.get_response(req);
    loop
      utl_http.read_text(res, buffer);
      dbms_output.put_line(buffer);
    end loop;
    utl_http.end_response(res);
      
  exception
    when utl_http.end_of_body  then
      utl_http.end_response(res);
end;
Tilen
  • 484
  • 1
  • 15
  • hi! My code looks exactly the same as yours except that I also have an Authorization Header. I will edit my original post to reflect that – Lukas Knirschnig Jan 04 '22 at 08:35