Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Call webservice via UTL_HTTP

AParmFeb 13 2014

Hi there

I am running the following code on 11g and I get an error, it is a simple routine and I don't see why it doesn't work, just trying to call a we service

set serveroutput on

--declaration 

declare  

soap_request varchar2(30000);

soap_respond varchar2(30000);

http_req utl_http.req;

http_resp utl_http.resp;

--PL/SQL procedure 

begin

--Webservice request schema

soap_request:= '<?xml version="1.0" encoding="utf-8"?>

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header>

<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/GetNewValue</Action>

</s:Header>

<s:Body>

<GetNewValue xmlns="http://tempuri.org/">

<value>500</value>

</GetNewValue>

</s:Body>

</s:Envelope>';

-- Set proxy details if no direct net connection. 

--HTTP request 

http_req:= utl_http.begin_request('http://server/Service1.svc' , 'POST' , 'HTTP/1.1');

--set authentication

utl_http.set_header(http_req, 'Content-Type', 'text/xml; charset=utf-8');

utl_http.set_header(http_req, 'Content-Length', length(soap_request));

utl_http.set_header(http_req, 'SOAPAction', 'http://server/Service1.svc');

utl_http.write_text(http_req, soap_request);

http_resp:= utl_http.get_response(http_req);

utl_http.read_text(http_resp, soap_respond);

utl_http.end_response(http_resp); 

dbms_output.put_line(soap_respond); 

end;

Error report:

ORA-29266: end-of-body reached

ORA-06512: at "SYS.UTL_HTTP", line 1330

ORA-06512: at line 31

29266. 00000 -  "end-of-body reached"

*Cause:    The end of the HTTP response body was reached.

*Action:   If the end of the HTTP response is reached prematurely, check if

           the HTTP response terminates prematurely.  Otherwise, end the

           HTTP response.

Any insight we be appreciated.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2014
Added on Feb 13 2014
0 comments
1,097 views