Error consuming https web services [message #296009] |
Thu, 24 January 2008 03:29  |
marbi
Messages: 3 Registered: January 2008
|
Junior Member |
|
|
Hi,
I'm trying this piece of pl/sql code and I'm getting ORA-12547: TNS:lost contact error while trying to retrieve soap response at line UTL_HTTP.read_text(respuesta, envio); . What could be wrong? Thanks in advance.
declare
envio varchar2(32767);
peticion UTL_HTTP.req;
respuesta UTL_HTTP.resp;
cadena varchar2(32767);
begin
envio := 'xxx'; -- soap request
Utl_Http.Set_Response_Error_Check ( enable => true );
Utl_Http.Set_Detailed_Excp_Support ( enable => true );
utl_http.set_wallet('file:/oracle/wallets','xxx');
peticion := UTL_HTTP.begin_request ('https://xxx','POST','HTTP/1.1');
UTL_HTTP.set_header(peticion, 'Content-Type', 'text/xml');
UTL_HTTP.set_header(peticion, 'Content-Length', LENGTH(envio));
UTL_HTTP.set_header(peticion, 'SOAPAction','');
UTL_HTTP.write_text(peticion,envio);
respuesta := UTL_HTTP.get_response(peticion);
UTL_HTTP.read_text(respuesta, envio);
UTL_HTTP.end_response(respuesta);
dbms_output.put_line(envio);
exception
when Utl_Http.Request_Failed then
Dbms_Output.Put_Line ( 'Request_Failed: ' || Utl_Http.Get_Detailed_Sqlerrm );
when Utl_Http.Http_Server_Error then
Dbms_Output.Put_Line ( 'Http_Server_Error: ' || Utl_Http.Get_Detailed_Sqlerrm );
when Utl_Http.Http_Client_Error then
Dbms_Output.Put_Line ( 'Http_Client_Error: ' || Utl_Http.Get_Detailed_Sqlerrm );
when others then
Dbms_Output.Put_Line ('Otros: ' || SQLERRM);
end;
|
|
|
|
|
Re: Error consuming https web services [message #296539 is a reply to message #296009] |
Mon, 28 January 2008 02:21   |
marbi
Messages: 3 Registered: January 2008
|
Junior Member |
|
|
The problem is a database bug:
Bug 5575771 UTL_HTTP cannot handle https connections without a content-length
If UTL_HTTP is used to retrieve an HTTPS response with no content-length, it
throws an ORA-12547 on the final read (if the final read is shorter than the
buffer supplied).
Workaround:
Include a Content-Length section on all responses.
(This may not be possible since some responses may not
be under your control)
|
|
|
|