declare
http_req utl_http.req;
http_resp utl_http.resp;
request_env varchar2(32767);
response_env varchar2(32767);
begin
request_env:=
This is my message
'
';
dbms_output.put_line('Length of Request:' || length(request_env));
dbms_output.put_line ('Request: ' || request_env);
http_req := utl_http.begin_request('http://wsXXXX/Test_WebService/Service.asmx', 'POST', utl_http.HTTP_VERSION_1_1);
utl_http.set_header(http_req, 'Content-Type', 'text/xml; charset=utf-8');
utl_http.set_header(http_req, 'Content-Length', length(request_env));
utl_http.set_header(http_req, 'SOAPAction', '"http://tempuri.org/LogMessage"');
utl_http.write_text(http_req, request_env);
dbms_output.put_line('');
http_resp := utl_http.get_response(http_req);
dbms_output.put_line('Response Received');
dbms_output.put_line('--------------------------');
dbms_output.put_line ( 'Status code: ' || http_resp.status_code );
dbms_output.put_line ( 'Reason phrase: ' || http_resp.reason_phrase );
utl_http.read_text(http_resp, response_env);
dbms_output.put_line('Response: ');
dbms_output.put_line(response_env);
utl_http.end_response(http_resp);
Ref: http://www.lostechies.com/blogs/joshua_lockwood/archive/2007/09/14/calling-net-web-services-from-oracle.aspx
No comments:
Post a Comment