我正在尝试通过 WNS 将通知推送到我的 Windows 应用程序,
我每次都会收到 404 响应。
我已经验证了 Channel URI 是有效的,因为每次启动应用程序时,我都会获取 channel URI 并立即使用它进行测试。
这是我打的 curl 电话
curl -i -d "<tile><visual><binding template='TileSquareText01'><text id='1'>tile one text</text></binding><binding template='TileSquareText02'><text id='2'>tile two text</text></binding></visual></tile>" -H "Authorization: Bearer EgAeAQMAAAAEgAAACoAAFQOHLfF3CMYK/IUs8MgTUFoS9vwOM4AFavJ3TLGAczjxBJNm02+rMlWFGYNWAefkuCw/Qg62++O+5GdrLRqQCdBSSI+cZPPXwOKk6lagOLDXNzd41hPMG9/NYi/Li1dHddMLLkPVWuZ6Te+t1ofOeL30PDA9p8JVEVDAX/CfLXGNAFoAjQAAAAAAL+oNSH9RuFB/UbhQ60gEAA8AMTIzLjIwMS4xMzUuNTMAAAAAAF4AbXMtYXBwOi8vUy0xLTE1LTItMTIxMTkzNzMyNS0yNTg0NzczMzMzLTE1ODE1OTA0OTYtNDE4NTk0OTY5OS0yNDEwMjc4ODgzLTM4NjU2MTI0NzAtOTM5MDAzNTk0AA==" -H "content-type: text/xml" -H "content-length: 190" -H "X-WNS-Type: wns/tile" "https://sin.notify.windows.com:443/?token=AgYAAAA/Bcry6hlYw8kOU5f4LHaS+dycP7UxcsT45eUcNlxfznxCltMK3emgIsHRAiRUk1X5VnQ0h0FC7fbOno+QI5aqUt2Q05foUg+XYeFvIcdsp6wwoMJ8VEjyOBzcT+z1JNM="
我得到以下回复
HTTP/1.1 404 Not Found
Content-Length: 0
X-WNS-MSG-ID: 1FD852615FA1E9DA
X-WNS-DEBUG-TRACE: SINWNS2012431
Date: Fri, 30 Nov 2012 06:57:46 GMT
我检查了标头都正确,通过放置错误的标头并获得 400 Bad request 来测试它。
这是我获取频道 URI 的应用代码
get_channel_uri :function(){
var channel;
var pushNotifications = Windows.Networking.PushNotifications;
var channelOperation = pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();
return channelOperation.then(function (channel) {
if(channel.uri){
// send to server
}
},
function (error) {
}
);
}
任何想法我错过了什么?