UTL_HTTP Call a Web Service and Pass Parameters as Part of the URL

SET DEFINE OFF
SET SERVEROUTPUT ON

DECLARE
  req UTL_HTTP.REQ;
  resp UTL_HTTP.RESP;
  value VARCHAR2(32767);
  V_DATA VARCHAR2(100) := 'strDate=”31-APR-2012”&strName=”TestName”';
BEGIN
  req := UTL_HTTP.BEGIN_REQUEST('http://myServer/Test/TestWebService.asmx/StartBiztalkProcedure', 'POST', 'HTTP/1.0');
  utl_http.set_header(req, 'Content-Type', 'application/x-www-form-urlencoded');
  utl_http.set_header(req, 'Content-Length', length(v_data));
  utl_http.write_text(req, v_data);
  resp := UTL_HTTP.GET_RESPONSE(req);
  LOOP
     UTL_HTTP.READ_LINE(resp, value, TRUE);
     DBMS_OUTPUT.PUT_LINE(value);
  END LOOP;
  UTL_HTTP.END_RESPONSE(resp);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
  UTL_HTTP.END_RESPONSE(resp);
END;
/

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。