请教oracle 如何调用webservice 接口
展开全部
一般都是创建一个process来调用的,给个模板给你参考:
CREATE OR REPLACE PROCEDURE pro_test() IS
http_req UTL_HTTP.req;
request_env VARCHAR2(32767);
BEGIN
request_env := '
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProcessData xmlns="你的公司地址(例如:www.baidu.com)/">
<参数1>' || 参数1 || '</参数1>
<参数2>' || 参数2 || '</参数2>
</ProcessData>
</soap:Body>
</soap:Envelope>
';
http_req := UTL_HTTP.
begin_request('http://' || 你的ServerIP || 'WebService地址',
'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://www.baidu.com/你的WebService Function_name"');
UTL_HTTP.write_text(http_req, request_env);
UTL_HTTP.END_REQUEST(HTTP_REQ);
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
--Write log
END pro_test;
CREATE OR REPLACE PROCEDURE pro_test() IS
http_req UTL_HTTP.req;
request_env VARCHAR2(32767);
BEGIN
request_env := '
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ProcessData xmlns="你的公司地址(例如:www.baidu.com)/">
<参数1>' || 参数1 || '</参数1>
<参数2>' || 参数2 || '</参数2>
</ProcessData>
</soap:Body>
</soap:Envelope>
';
http_req := UTL_HTTP.
begin_request('http://' || 你的ServerIP || 'WebService地址',
'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://www.baidu.com/你的WebService Function_name"');
UTL_HTTP.write_text(http_req, request_env);
UTL_HTTP.END_REQUEST(HTTP_REQ);
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
--Write log
END pro_test;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询