Home » SQL & PL/SQL » SQL & PL/SQL » utl_http how to close the request? (Oracle 11g)
utl_http how to close the request? [message #617137] Wed, 25 June 2014 07:26 Go to next message
tjagiello
Messages: 2
Registered: June 2014
Junior Member
Hi,
after invoking this piece of code several times I get an error 'ORA-29270: too many open HTTP requests'.
Does not UTL_HTTP.end_response close request?
   -- Initialize the CLOB.
  DBMS_LOB.createtemporary(v_response_clob, FALSE);
  generate_envelope(p_request, l_envelope,p_skip_records);
  l_http_request := UTL_HTTP.begin_request(p_url, 'POST','HTTP/1.1');
  UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml');
  UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_envelope));
  UTL_HTTP.set_header(l_http_request, 'SOAPAction', p_action);
  UTL_HTTP.write_text(l_http_request, l_envelope);
  l_http_response := UTL_HTTP.get_response(l_http_request);
   -- Copy the response into the CLOB.
   BEGIN
     LOOP
       UTL_HTTP.read_text(l_http_response, l_text, 32767);
       DBMS_LOB.writeappend (v_response_clob, LENGTH(l_text), l_text);
     END LOOP;
   EXCEPTION
     WHEN UTL_HTTP.end_of_body THEN
       UTL_HTTP.end_response(l_http_response);
   END;


I put end_request:
   -- Initialize the CLOB.
  DBMS_LOB.createtemporary(v_response_clob, FALSE);
  generate_envelope(p_request, l_envelope,p_skip_records);
  l_http_request := UTL_HTTP.begin_request(p_url, 'POST','HTTP/1.1');
  UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml');
  UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_envelope));
  UTL_HTTP.set_header(l_http_request, 'SOAPAction', p_action);
  UTL_HTTP.write_text(l_http_request, l_envelope);
  l_http_response := UTL_HTTP.get_response(l_http_request);
   -- Copy the response into the CLOB.
   BEGIN
     LOOP
       UTL_HTTP.read_text(l_http_response, l_text, 32767);
       DBMS_LOB.writeappend (v_response_clob, LENGTH(l_text), l_text);
     END LOOP;
   EXCEPTION
     WHEN UTL_HTTP.end_of_body THEN
       UTL_HTTP.end_response(l_http_response);
       UTL_HTTP.end_request(l_http_request);
   END;

and I get error ORA-29261: bad argument.
Did anyone encounter such problem?

Regards,
Tomasz
Re: utl_http how to close the request? [message #617142 is a reply to message #617137] Wed, 25 June 2014 08:11 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/u_http.htm#ARPLS71023
Re: utl_http how to close the request? [message #617143 is a reply to message #617137] Wed, 25 June 2014 08:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

You get this where?
Use SQL*Plus and copy and paste your session, including the creation of all elements you call in order we can do the same thing.
Before, Please read How to use [code] tags and make your code easier to read.

Re: utl_http how to close the request? [message #617149 is a reply to message #617143] Wed, 25 June 2014 08:33 Go to previous messageGo to next message
tjagiello
Messages: 2
Registered: June 2014
Junior Member
the problem is solved, it's my fault. I invoked utl_http.get_response two times in the same function but utl_http.end_response only once. Thanks.
Re: utl_http how to close the request? [message #617151 is a reply to message #617149] Wed, 25 June 2014 08:51 Go to previous message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Thanks to let us know.

Previous Topic: SQL script to find ACTIVE and INACTIVE CPU on HP-UX server
Next Topic: ORA-00060: deadlock detected while waiting for resource
Goto Forum:
  


Current Time: Mon May 19 12:47:02 CDT 2025