CREATE OR REPLACE PROCEDURE pro_test_ws(name in varchar2,
resmark out varchar2) IS
--定义四个变量,http请求,http返回,请求报文,返回报文
http_req UTL_HTTP.REQ;
http_Resp UTL_HTTP.RESP;
request_env VARCHAR2(32767);
l_Replyline VARCHAR2(1000);
BEGIN
--开始pl/sql体
request_env := '<?xml version="1.0" encoding="utf-8"?><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><DHYGetPrescriptionStatus xmlns="http://tempuri.org/"><jsonPspNum>{"Pspnum":"72771316","hospitalName":"第一附属医院"}</jsonPspNum></DHYGetPrescriptionStatus></soap:Body></soap:Envelope>'; --POST参数的内容,格式为:变量=值&变量=值
--打印请求报文
/*dbms_output.put_line(request_env);*/
--请求WS地址
http_req := UTL_HTTP.begin_request('http://192.168.8.50:7003/bmcm.asmx?wsdl',
'POST',
UTL_HTTP.http_version_1_1);
-- 保持连接状态
Utl_Http.Set_Persistent_Conn_Support(http_req, TRUE);
--设置编码
Utl_Http.Set_Header(http_req, 'Content-Type', 'text/xml;charset=utf-8');
Utl_Http.Set_Header(http_req, 'SOAPAction', '');
--设置字符集
Utl_Http.Set_Body_Charset(http_req, 'utf-8');
--该参数代表我发送的POST报文多长,不可少
Utl_Http.Set_Header(http_req, 'Content-Length', Lengthb(request_env));
Utl_Http.Write_Line(http_req, request_env);
--赋值http返回
http_Resp := Utl_Http.Get_Response(http_req);
--将请求报文赋值给 l_Replyline
Utl_Http.Read_Text(http_Resp, l_Replyline);
/* dbms_output.put_line(l_Replyline);*/
--付给存储过程出参
resmark := l_Replyline;
END;
服务器未能识别 HTTP 头 SOAPAction 的值:
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。