I've implemented in PL\SQL a procedure to call a external Web Service, using package UTL_HTTP.
In a particular case when the request SOAP message is very big ( around 1080001 characters), I get always this error: ORA-12547: TNS:lost contact.
With smaller messages it works fine.
l_envelope CLOB;
l_blob BLOB;
buffer VARCHAR2 (32767);
amount PLS_INTEGER :=4000;
offset PLS_INTEGER := 1;
l_dest_offset NUMBER := 1;
l_src_offset NUMBER := 1;
l_lang_context NUMBER := 0;
l_warning NUMBER;
dbms_lob.createtemporary(l_blob, FALSE, dbms_lob.call);
dbms_lob.converttoblob(dest_lob => l_blob,
src_clob => l_envelope,
amount => dbms_lob.lobmaxsize,
dest_offset => l_dest_offset,
src_offset => l_src_offset,
blob_csid => nls_charset_id('AL32UTF8'),
lang_context => l_lang_context,
warning => l_warning);
req_length := dbms_lob.getlength(l_blob);
http_req := utl_http.begin_request(c_url,'POST','HTTP/1.1');
UTL_HTTP.set_header (http_req, 'Content-Type', 'text/xml;charset=UTF-8');
UTL_HTTP.set_header (http_req, 'SOAPAction', action);
UTL_HTTP.set_transfer_timeout (600);
IF (req_length >32767)
UTL_HTTP.set_header (http_req, 'Transfer-Encoding', 'chunked');
WHILE (offset < req_length)
LOOP
DBMS_LOB.read (l_blob,
amount,
offset,
buffer);
UTL_HTTP.write_text (http_req, buffer);
offset := offset + amount;
END LOOP;
END IF;
l_http_response := utl_http.get_response(http_req);
DBMS_LOB.FREETEMPORARY(l_blob);
Below Error :
ORA-29273: HTTP request failed
ORA-12547: TNS:lost contact
ORA-06512: at "SYS.UTL_HTTP", line 606
ORA-06512: at "SYS.UTL_HTTP", line 1212
Please suggest solution or possible workaround on this.