/*接口调用描述:在EBS数据库,使用utl_http调用OA https的接口'https://oa.ynby.cn/sys/webservice/sysNotifyTodoWebService?wsdl'报错
报错信息:
ORA-29273: HTTP 请求失败
ORA-06512: 在 "SYS.UTL_HTTP", line 1130
ORA-28860: 致命的 SSL 错误
说明:之前OA接口为http类型时'http://oa.ynby.cn/sys/webservice/sysNotifyTodoWebService?wsdl',可以正常调用。
*/
DECLARE
p_debug_flag VARCHAR2(3) := 'Y';
x_SOAP_REQUEST VARCHAR2(30000);
x_soap_respond varchar2(30000);
x_http_req utl_http.req;
x_http_resp utl_http.resp;
x_request_xml xmltype;
x_response_xml xmltype;
x_return_status varchar2(10);
x_response_status varchar2(10);
x_response_message varchar2(1000);
x_service_url varchar2(500) := 'https://oa.ynby.cn/sys/webservice/sysNotifyTodoWebService?wsdl';
--x_service_url varchar2(500) := 'http://192.168.3.83/sys/webservice/sysNotifyTodoWebService?wsdl';
x_user varchar2(50) := 'FlowSP';
x_password varchar2(50) := '6723a0ef5dd98a4d0e711a538c750b5e';
begin
--将调用地址、用户名、密码配置在快码'CUX_NOTIFY_INFO'中
/*begin
select flv.tag,flv.meaning,flv.description
into x_user,x_password,x_service_url
from fnd_lookup_values flv
where flv.lookup_type = 'CUX_NOTIFY_INFO'
and flv.language = 'ZHS'
and flv.enabled_flag = 'Y'
and nvl(flv.end_date_active, sysdate) >= sysdate;
exception
when others then
null;
end;*/
x_SOAP_REQUEST:='<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
||'<soap:Header>'
||'<tns:RequestSOAPHeader xmlns:tns="http://sys.webservice.client">'
||'<tns:user xmlns="http://sys.webservice.client">'||x_user||'</tns:user>'
||'<tns:password xmlns="http://sys.webservice.client">'||x_password||'</tns:password>'
||'</tns:RequestSOAPHeader>'
||'</soap:Header>'
||'<soap:Body>'
||'<ns2:sendTodo xmlns:ns2="http://webservice.review.km.kmss.landray.com/">'
||'<arg0>'
||'<appName>'||'ebs'||'</appName>'
||'<subject>'||'代办事项通知测试01'||'</subject>'
||'<modelName>'||'EBS'||'</modelName>'
||'<modelId>'||'00003'||'</modelId>'
||'<link>'||'http://eduapp.ynby.cn:8003'||'</link>'
||'<type>'||'2'||'</type>'
||'<targets>{"LoginName":"'||'BEST_KJ'||'"}</targets>'
||'<createTime>'||'2018-05-15 15:01:01'||'</createTime>'
||'</arg0>'
||'</ns2:sendTodo>'
||'</soap:Body>'
||'</soap:Envelope>';
DBMS_OUTPUT.PUT_LINE('Step0000');
utl_http.set_transfer_timeout(300);
utl_http.set_wallet('file:/erpdbfs/erpdev/oracle/product/11.2.0/dbhome_1/admin/DEV_erptest30/wallet','Wallet123');
DBMS_OUTPUT.PUT_LINE('Step000111');
x_http_req := utl_http.begin_request(x_service_url,
'POST'
,'HTTP/1.1'
);
DBMS_OUTPUT.PUT_LINE('Step0001');
utl_http.set_header(x_http_req, 'Content-Type', 'text/xml;charset=UTF-8');
--utl_http.set_authentication(x_http_req,g_osb_service_user_name,g_osb_service_user_password);
utl_http.set_header(x_http_req, 'Content-Length', lengthb(x_SOAP_REQUEST));
utl_http.write_text(x_http_req, x_SOAP_REQUEST);
x_request_xml := xmltype.createxml(x_SOAP_REQUEST);
DBMS_OUTPUT.PUT_LINE('Step0002');
x_http_resp := utl_http.get_response(x_http_req);
DBMS_OUTPUT.PUT_LINE('Step00021');
--utl_http.read_text(x_http_resp, x_soap_respond);
DBMS_OUTPUT.PUT_LINE('Step00022');
utl_http.end_response(x_http_resp);
DBMS_OUTPUT.PUT_LINE('Step0003');
x_response_xml := xmltype.createxml(x_soap_respond);
insert into cuxeas_serv_msg values(1,x_response_xml,sysdate) ;
commit;
exception
when others then
DBMS_OUTPUT.PUT_LINE('Step0004');
DBMS_OUTPUT.PUT_LINE(SQLERRM);
end;
