Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8806101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:02:30+00:00 2026-06-14T02:02:30+00:00

Final EDIT working code (Huge thanks to Claus for taking time and solving it):

  • 0

Final EDIT working code (Huge thanks to Claus for taking time and solving it):

class WindowsPhonePushDelay
{
    const Immediate=0;
    const In450Sec=10;
    const In900Sec=20;
}

class WindowsPhonePushNotification
{
    private $notif_url = '';

    function WindowsPhonePushNotification($notif_url)
    {
        $this->notif_url = $notif_url;
    }

    public function send_raw($msg,$message_id=NULL, $delay = WindowsPhonePushDelay::Immediate)
    {
        return $this->send_push(NULL,$delay+3,$message_id, $msg);
    }

    public function send_normal_tile($image_url, $title, $count,$message_id=NULL, $delay = WindowsPhonePushDelay::Immediate)
    {
        $msg =  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
                "<wp:Notification xmlns:wp=\"WPNotification\">" .
                "<wp:Tile>" .
                "<wp:BackgroundImage>$image_url</wp:BackgroundImage>" .
                "<wp:Count>$count</wp:Count>" .
                "<wp:Title>$title</wp:Title>" .
                "</wp:Tile>" .
                "</wp:Notification>";
                return $this->send_push('token',$delay+1, $message_id,$msg);
    }
       public function send_iconic_tile($image_url_large, $image_url_small, $wide1, $wide2, $wide3, $title, $count,$message_id=NULL, $delay = WindowsPhonePushDelay::Immediate)
    {
        $msg =  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
                "<wp:Notification xmlns:wp=\"WPNotification\" Version=\"2.0\">" .
                "<wp:Tile Id=\"\" Template=\"IconicTile\">" .
                "<wp:SmallIconImage>$image_url_small</wp:SmallIconImage>" .
                "<wp:IconImage>$image_url_large</wp:IconImage>" .
                "<wp:WideContent1>$wide1</wp:WideContent1>" .
                "<wp:WideContent2>$wide2</wp:WideContent2>" .
                "<wp:WideContent3>$wide3</wp:WideContent3>" .
                "<wp:Count>$count</wp:Count>" .
                "<wp:Title>$title</wp:Title>" .
                "<wp:BackgroundColor>#00FFFFFF</wp:BackgroundColor>" .
                "</wp:Tile>" .
                "</wp:Notification>";
       echo $msg;
    return $this->send_push('token',$delay+1, $message_id,$msg);
    }

    public function send_toast($title, $message,$message_id=NULL, $delay = WindowsPhonePushDelay::Immediate)
    {
        $msg =  "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
                "<wp:Notification xmlns:wp=\"WPNotification\">" .
                "<wp:Toast>" .
                "<wp:Text1>$title</wp:Text1>" .
                "<wp:Text2>$message</wp:Text2>" .
                "</wp:Toast>" .
                "</wp:Notification>";

        return $this->send_push('toast',$delay+2,$message_id, $msg);
    }

    private function send_push($target,$delay,$message_id,$msg)
    {
        $sendedheaders=  array(
                            'Content-Type: text/xml; charset=utf-8 ',
                            'Accept: application/*',
                            "X-NotificationClass: $delay"
                            );
        if($message_id!=NULL)
        $sendedheaders[]="X-MessageID: $message_id";
        if($target!=NULL)
            $sendedheaders[]="X-WindowsPhone-Target:$target";

        $req = curl_init();
        curl_setopt($req, CURLOPT_HEADER, true); 
        curl_setopt($req, CURLOPT_HTTPHEADER,$sendedheaders);
        curl_setopt($req, CURLOPT_POST, true);
        curl_setopt($req, CURLOPT_POSTFIELDS, $msg);
        curl_setopt($req, CURLOPT_URL, $this->notif_url);
        curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
        $response = curl_exec($req);
        curl_close($req);

        $result=array();
        foreach(explode("\n",$response) as $line)
        {

        $tab=explode(":",$line,2);
        if(count($tab)==2)
            $result[$tab[0]]=trim($tab[1]);
        }

        return $result;
     }
}

EDIT: The XML (tried with both local image and remote image)

<?xml version="1.0" encoding="utf-16"?><wp:Notification xmlns:wp="WPNotification" Version="2.0"><wp:Tile Id="/" Template="IconicTile"><wp:SmallIconImage Action="Clear">/Images/LiveTiles/asot_iconic_small.png</wp:SmallIconImage><wp:IconImage Action="Clear">/Images/LiveTiles/asot_iconic_large.png</wp:IconImage><wp:WideContent1 Action="Clear">Test1</wp:WideContent1><wp:WideContent2 Action="Clear">Test2</wp:WideContent2><wp:WideContent3 Action="Clear">Test3</wp:WideContent3><wp:Count Action="Clear">1</wp:Count><wp:Title Action="Clear">Title</wp:Title><wp:BackgroundColor Action="Clear">#00FFFFFF</wp:BackgroundColor></wp:Tile></wp:Notification>

EDIT2 Full error msg:

"The XML payload contains invalid or improperly formatted XML or the notification type specified in the header does not match the payload type used.  The channel has been closed.  Check your XML payload for errors and reopen the channel to obtain a new URI."

EDIT3 Server response

HTTP/1.1 200 OK Cache-Control: private Server: Microsoft-IIS/7.5 X-DeviceConnectionStatus: Connected X-NotificationStatus: Received X-SubscriptionStatus: Active X-MessageID: 00000000-0000-0000-0000-000000000000 ActivityId: 5bd4c4b6-1d79-4964-9a56-7d49e2aa5972 X-Server: DB3MPNSM018 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Wed, 07 Nov 2012 19:35:59 GMT Content-Length: 0

I’m using the above code (made by Rudy Huyn) when trying to send a Push Notification. It works fine with sending a normal tile but I’m trying to update my app so it can receive a iconic tile instead. I’ve added the send_iconic_tile myself.

However when I’m sending an iconic tile notification I’m getting a PayloadFormatError on the phone. I can’t see any error in my code either since the payload seems to match what Microsoft has written here:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207009(v=vs.105).aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:02:32+00:00Added an answer on June 14, 2026 at 2:02 am

    Your payload is indeed invalid.

    The BackgroundColor needs to be in HEX format of #FF000000 (00FFFFFF for Transparent), and the Id="/" should be Id="".

    Remember there can’t be any whitespaces before or after the hex value for the background color.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[Edit: see final code below] I'm using the code below to randomly select 5
FINAL EDIT: After following the answer from Darin Dimitrov, I have found that the
Final goal: Have a few java objects sharing the same base class persisted into
Can someone please post the simplest of working code that can get the last
I am new to android/java so please bear with me. My code was working
I'm working with JSF2.1 and RichFaces 4.1 in JBoss AS 6.1.0.Final. Right now, I'm
I often refactor code first by creating an inner class inside the class I'm
I'm working with existing code that has an object store in the form of
I'm working on formatting C# code in HTML. I'm trying to replace tabs/indents with
final String message[] = {,,}; try{ String UID = null, UBAL = null; DateFormat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.