1

I've a strange problem with WNS and Push Notification for Windows\ windows phone devices (8.1). If I send a push notification it works well. The problem is when I try to send to the WNS a X-WNS-Match request. I'm sending the current header:

DELETE /?token=<CHANNEL>
HTTP/1.1
Host: db3.notify.windows.com
Accept: */*
Authorization: Bearer <TOKEN>
content-type: text/xml
X-WNS-Match: type=wns/toast;all
Content-Length: 0

The answer from the service is:

HTTP/1.1 400 Bad Request
Content-Length: 0
X-WNS-STATUS: dropped
X-WNS-ERROR-DESCRIPTION: Content type not supported
X-WNS-MSG-ID: C51E1A17972EA7A
X-WNS-DEBUG-TRACE: DB3WNS2011131
Strict-Transport-Security: max-age=31536000; includeSubDomains
Date: Wed, 13 May 2015 21:05:06 GMT

I've also tried to set in request header the:

X-WNS-Type: wns/toast

Now my doubt is: Maybe is the server that doesn't support DELETE method for HTTP? Or maybe I need to set something of different for content type? I've followed the wns documentation: https://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx I'm testing on an azurewebsite (iis) and on another domain with server apache 2.2.26

Requests are in php with curl. Thank you.

1 Answers1

1

I've found the problem. I can't send the content-type for MATCH to WNS, so I've deleted the row:

curl_setopt($request,CURLOPT_POSTFIELDS, $template);

Where template was empty, After this, I need to pass the content-length (that's required for HTTP) this way:

$Header["ContentLength"] = "Content-Length : ".strlen($template);
curl_setopt($request,CURLOPT_HTTPHEADER, $Header);

And the response status now is 200 OK

Thank you however, hope this can help someone

  • Thanks! This helped me. I add that: 1) the X-WNS-Type header must be removed 2) the correct X-WNS-Match value starts with `type=wns` and not `type:wns` as stated in the official documentation! – mcont Jun 22 '15 at 14:05