1 Reply Latest reply on Dec 12, 2012 5:16 AM by Billy~Verreynne

    utl_http read text strange issue

    user650888
      This is not the entire code sample but I tried to give a subset of what I am doing

      SO I am using utl_http to request and response to get the data, and below code snippet is in a procedure,

      I am calling the procedure twice from my main procedure, First time the read_text gives me accurate result

      But from my main procedure when I call the below procedure again, read_text is not giving me anything, just the empty xml tags

      am I missing something ? I am calling the below proc twice by passing chunks of data because size of var is exceeding 32 k
      l_http_request UTL_HTTP.req;
      l_http_response UTL_HTTP.resp;
      var VARCHAR2(32767);
      v_envl VARCHAR2(32767);
      
      Loop 
      
      
      
      Begin
      
      
      
      l_http_request := UTL_HTTP.begin_request('someipaddress', '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(var));
      
      
      
      UTL_HTTP.set_header(l_http_request, 'SOAPAction', 'http://xys.com');
      
      
      
      UTL_HTTP.write_text(l_http_request, var);
      
      
      
      -- to test
      
      --raise Utl_Http.Http_Server_Error;
      
      
      
      l_http_response := UTL_HTTP.get_response(l_http_request);
      
      
      
      exit;
      
      
      
      exception
      
      
      
      when Utl_Http.Http_Server_Error
      
      
      
      then
      
      
      
      begin
      
      
      
      null;
      
      end;
      
      
      
      end;
      
      
      
      END LOOP;
      
      
      UTL_HTTP.read_text(l_http_response, v_envl);
      
      -- PROBLEM HERE, V_ENVL VALUE HAS NO DATA IN IT, JUST TAGS when calling second time
      
      utl_http.End_response(l_http_response);