This discussion is archived
5 Replies Latest reply: Aug 24, 2011 8:47 PM by 884466 RSS

ORA-29266: end-of-body reached - using SOAP_API over SSL

512818 Newbie
Currently Being Moderated
Hey guys. I have a simple SOAP_API I am using to send SOAP over SSL. It seems to connect fine but give off some shaky results. This is the error I keep getting:

ERROR at line 1:
ORA-29266: end-of-body reached
ORA-06512: at "SYS.UTL_HTTP", line 1321
ORA-06512: at "LOANADMIN.SOAP_API", line 229
ORA-06512: at "LOANADMIN.GET_CITY_FROM_ZIPCODE", line 29
ORA-06512: at line 2

it seems to mainly happen on these two peices of code:

UTL_HTTP.write_text(l_http_request, l_envelope);

UTL_HTTP.read_text(l_http_response, l_envelope);

Sometimes the first and sometimes the latter. I know my XML is well formed, and im thinking the response is to big for the variable (im thinking the response could be larger than 32k. not sure though).

I've searched all over this forum, but it seems like the people who have solutions to this particular problem found it on meta-link. I dont have a meta-link account. Could someone please simply explain the solution and problem im running into?

That would help a lot. Thanks.

Mo
  • 1. Re: ORA-29266: end-of-body reached - using SOAP_API over SSL
    649102 Newbie
    Currently Being Moderated
    It means you have reached the end of the http response. You need to handle the utl_http.end_of_body exception and end the http response. If the response is too large you may want to read line by line with utl_http.read_line.
    EXCEPTION WHEN UTL_HTTP.end_of_body THEN
      utl_http.end_response(resp);
    END;
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_web.htm#sthref1537
  • 2. Re: ORA-29266: end-of-body reached - using SOAP_API over SSL
    BillyVerreynne Oracle ACE
    Currently Being Moderated
    This is not really an error. It is simply that the "end-of-file" has been reached for an I/O read (in this case UTL_HTTP).

    UTL_HTTP informs you (the caller) that there is no more data found by raising an exception. Similar to an implicit cursor that will tell you NO_DATA_FOUND.

    It is not an error but more like an exception notification. The underlying code telling you that it cannot do anymore what you the caller have asked.

    In such a case it is acceptable to catch that exception and simply suppress it. Typically though you would want to set some boolean flag to terminate the loop that is making these calls to the underlying I/O read code and do whatever resource cleanup required.
  • 3. Re: ORA-29266: end-of-body reached - using SOAP_API over SSL
    720285 Newbie
    Currently Being Moderated
    Hi there ,
    I am having the same problem, when I am trying to send a SOAP message to a server,

    I got that "end of file " exception
    and did as you suggested to handle the exception with response ending

    but I am still have problem with it, as the http response is not processing due to the exception !!!,

    but I need to get the actual response from the http response ??
    I have tried to put that code in the exception handling part, as the suggestion to just end the response !!!

    please can you help!
    any suggestions are appreciated,

    Regards,

    Edited by: Lamya on Dec 5, 2009 12:02 PM
  • 4. Re: ORA-29266: end-of-body reached - using SOAP_API over SSL
    876301 Newbie
    Currently Being Moderated
    I'm having the same problem, and it is inside the SOAP_API package from http://www.oracle-base.com/dba/miscellaneous/soap_api.sql :

    ORA-29266: end-of-body reached
    ORA-06512: at "SYS.UTL_HTTP", line 1330
    ORA-06512: at "NAPS.SOAP_API", line 119

    I understand the responses given:

    EXCEPTION WHEN UTL_HTTP.end_of_body THEN
    utl_http.end_response(resp);
    END;

    and the suggestion to use UTL_HTTP.read_line instead of UTL_HTTP.read_text, but would like some assistance in modifying the procedure to ensure I get the full response returned.

    The procedure with the error is:
    FUNCTION invoke(p_request IN OUT NOCOPY t_request,
    p_url IN VARCHAR2,
    p_action IN VARCHAR2)
    RETURN t_response AS
    -- ---------------------------------------------------------------------
    l_envelope VARCHAR2(32767);
    l_http_request UTL_HTTP.req;
    l_http_response UTL_HTTP.resp;
    l_response t_response;
    BEGIN
    generate_envelope(p_request, l_envelope);
    show_envelope(l_envelope);
    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);
    UTL_HTTP.read_text(l_http_response, l_envelope);
    UTL_HTTP.end_response(l_http_response);
    l_response.doc := XMLTYPE.createxml(l_envelope);
    l_response.envelope_tag := p_request.envelope_tag;
    l_response.doc := l_response.doc.extract('/'||l_response.envelope_tag||':Envelope/'||l_response.envelope_tag||':Body/child::node()',
    'xmlns:'||l_response.envelope_tag||'="http://schemas.xmlsoap.org/soap/envelope/"');
    -- show_envelope(l_response.doc.getstringval());
    check_fault(l_response);
    RETURN l_response;
    END;



    I have tested the exact call I am making using 'soapUI 2.5.1' so I can compare results to ensure I get the code right, and I am expecting a response of 1755 bytes (well short of the 32767 that is said to cause this error).

    My call is not over SSL, the call I am trying to make is:

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abr="http://abr.business.gov.au/ABRXMLSearchRPC/">
    <soapenv:Header/>
    <soapenv:Body>
    <abr:ABRSearchByABN soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <searchString xsi:type="xsd:string">11006489103</searchString>
    <includeHistoricalDetails xsi:type="xsd:string">N</includeHistoricalDetails>
    <authenticationGuid xsi:type="xsd:string">?</authenticationGuid>
    </abr:ABRSearchByABN>
    </soapenv:Body>
    </soapenv:Envelope>

    The calling code is:

    DECLARE
    l_request soap_api.t_request;
    l_response soap_api.t_response;
    l_return VARCHAR2(32767);

    l_url VARCHAR2(32767);
    l_namespace VARCHAR2(32767);
    l_method VARCHAR2(32767);
    l_soap_action VARCHAR2(32767);
    l_result_name VARCHAR2(32767);
    BEGIN
    l_url := 'http://abr.business.gov.au/abrxmlsearchRPC/ABRXMLSearch.asmx';
    l_namespace := 'http://abr.business.gov.au/ABRXMLSearchRPC/"';
    l_method := 'ABRSearchByABN';
    l_soap_action := 'http://abr.business.gov.au/ABRXMLSearchRPC/ABRSearchByABN';

    l_request := soap_api.new_request(p_method => l_method,
    p_namespace => l_namespace);

    soap_api.add_parameter(p_request => l_request,
    p_name => 'searchString',
    p_type => 'xsd:string',
    p_value => '11006489103');

    soap_api.add_parameter(p_request => l_request,
    p_name => 'includeHistoricalDetails',
    p_type => 'xsd:string',
    p_value => 'N');

    soap_api.add_parameter(p_request => l_request,
    p_name => 'authenticationGuid',
    p_type => 'xsd:string',
    p_value => '?');

    l_response := soap_api.invoke(p_request => l_request,
    p_url => l_url,
    p_action => l_soap_action);


    l_return := l_response.doc.getStringVal();
    dbms_output.put_line('-----------------------------------------------------------');
    dbms_output.put_line(l_return);
    END;
    /

    Edited by: 873298 on 18-Jul-2011 15:41
  • 5. Re: ORA-29266: end-of-body reached - using SOAP_API over SSL
    884466 Newbie
    Currently Being Moderated
    Hi,

    I am also facing the same problem. Were you able find out any solution? If so, could you please let me know. The code is exactly same as yours. There are special characters in the input given (which is required to be present) . The input has characters as «TEST»éàÕæÃ'.
    Thanks in advance.