title: PL/SQL utl_http get xml
body: <p>I am trying to implement a very simple <code>PL/SQL</code> procedure able to get an <code>xml</code> file from the web.</p>
  
  <p>The <code>PL/SQL</code> code is the following one:</p>
  
  <pre><code>SET serveroutput ON SIZE 40000
  set escape on
  
  create or replace procedure testProc as 
  
  url   VARCHAR2(256) := 'http://www.mypage.com/testXML.xml';
  
  req   sys.utl_http.req;
  resp  sys.utl_http.resp;
  txt   VARCHAR2(100); 
  
  begin
    req := sys.utl_http.begin_request(url,'GET','HTTP/1.0'); 
    utl_http.set_header(req, 'content-type', 'text/xml;charset=UTF-8');   
    utl_http.set_header(req, 'content-length', length(txt));
    resp := sys.utl_http.get_response(req);
  
    LOOP
      sys.utl_http.read_line(resp, txt, TRUE);
      dbms_output.put_line(txt);
    END LOOP;
    sys.utl_http.end_response(resp);
  
  EXCEPTION WHEN sys.utl_http.end_of_body THEN
  sys.utl_http.end_response(resp);
  
  end testProc;
  /
  </code></pre>
  
  <p>I successfully built the procedure by SQLPlus.
  However when I try to execute it I get the following error:</p>
  
  <pre><code>SQL&gt; exec testProc;
  &lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
  &lt;html&gt;&lt;head&gt;
  &lt;title&gt;413 Request Entity Too Large&lt;/title&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;h1&gt;Request Entity Too Large&lt;/h1&gt;
  The requested resource&lt;br /&gt;/trentad/testXML.xml&lt;br /&gt;
  does not allow request data with GET requests, or the amount of data provided in
  the request exceeds the capacity limit.
  &lt;/body&gt;&lt;/html&gt;
  
  PL/SQL procedure successfully completed.
  </code></pre>
  
  <p>This is weird as the xml file I'd like to read is the following one:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;note&gt;
      &lt;body&gt;Don't forget me this weekend!&lt;/body&gt;
  &lt;/note&gt;
  </code></pre>
  
  <p>Given that the same code, without the <code>_ set_header_  functions</code> works fine for a normal <code>HTML</code>, providing correctly its source page, please could anybody explain me why it does not work with a simple <code>xml</code> file?</p>