我读过这样的答案:PLSQL APPLE push notifiactions
但我不能使用Java。我认为应该有一种从PL/SQL中联系APNS的方法,因为我已经使用PL/SQL实现了GCM(Android通知)。
如何设置证书:我有一个pem文件,其中包含苹果推送证书和私钥。我也有委托的根证。我用orapki把它们加到钱包里。
我不擅长PL/SQL,所以我的代码中可能有一些问题:
v_url VARCHAR2(200) := 'https://gateway.push.apple.com:2195'; -- APNS url
v_request_body RAW(32767);
-- payload prep
v_token := '01234567890123456789012345678922';
v_data := '{ "aps" : { "alert" : "This is the alert text", "badge" : 1, "sound" : "default" }';
v_data_length := length(v_data);
v_request_body := UTL_RAW.cast_to_raw(0)||
UTL_RAW.cast_to_raw(0)||
UTL_RAW.cast_to_raw(32)||
UTL_RAW.cast_to_raw(v_token)||
UTL_RAW.cast_to_raw(0)||
UTL_RAW.cast_to_raw(v_data_length)||
UTL_RAW.cast_to_raw(v_data);
v_request_length := UTL_RAW.length(r => v_request_body);
-- request starts here
UTL_HTTP.set_wallet(path => 'file:/path/wallet', password => 'walletPass');
req := UTL_HTTP.BEGIN_REQUEST(url => v_url, method => 'POST');
UTL_HTTP.SET_HEADER(r => req,
name => 'Content-Type',
value => 'application/octet-stream');
UTL_HTTP.SET_HEADER(r => req,
name => 'Content-Length',
value => v_request_length);
-- UTL_HTTP.WRITE_TEXT(r => req, data => v_request_body);
utl_http.write_raw(r => req, data => v_request_body);
resp := UTL_HTTP.GET_RESPONSE(req);
如有任何建议,将不胜感激!
运行后的上述代码返回此错误:致命的SSL错误。
类似于这篇文章:HTTP?
对该帖子的答复的作者说:
最近也有一个错误20323753注册为11.2.0.4,但仍未修复。
这是我的版本,但我仍然认为这不是问题所在。我可能遗漏了一些关于APNS或PL/SQL的重要内容
谢谢。
发布于 2015-05-20 11:13:46
赞多,你把这个弄到手了吗你试过在沙箱里推信息吗?gateway.sandbox.push.apple.com
此外,我不确定使用UTL_HTTP是否是正确的方法,因为这不是一个HTTP服务?我正在尝试使用UTL_TCP实现同样的目标,尽管我还有其他问题要使证书设置正确:
declare
l_tcp_conn utl_tcp.connection;
l_returnvalue number;
begin
-- open connection
l_tcp_conn := utl_tcp.open_connection('gateway.sandbox.push.apple.com', 2195, charset => 'US7ASCII');
-- secure the connection
UTL_TCP.SECURE_CONNECTION(l_tcp_conn);
-- write to TCP stream
l_returnvalue := utl_tcp.write_line(l_tcp_conn, 'payload goes here');
end;
希望这能有所帮助!
谢谢。
https://stackoverflow.com/questions/30211182
复制相似问题