Skip to content

XML exception is throwing when trying to send push messages to BlackBerry #676

Open
@silverhawk1086

Description

@silverhawk1086

I am using the latest version of PushSharp.

When I try to send push messages to BlackBerry, I am getting an XML exception. The exception is below:

System.Xml.XmlException: The 'HR' start tag on line 1 position 1071 does not match the end tag of 'body'. Line 1, position 1132.
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
   at System.Xml.XmlTextReaderImpl.ParseEndElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
   at PushSharp.Blackberry.BlackberryPushChannel.SendNotification(INotification notification, SendNotificationCallbackDelegate callback)

My code is as below.

private void SendNotificationViaBlackBerry(Notification notification, string notificationContent, string pushToken, int notificationCount)
       {
           PushSharp.Blackberry.BlackberryPushChannelSettings settings = new PushSharp.Blackberry.BlackberryPushChannelSettings("<app_id>", "<password>");
           push.RegisterBlackberryService(settings, "<app_id>");
           PushSharp.Blackberry.BlackberryNotification bNotification = new PushSharp.Blackberry.BlackberryNotification();
           bNotification.PpgNotifyRequestedTo = "https://cp1359.pushapi.na.blackberry.com";
           PushSharp.Blackberry.BlackberryRecipient recispent = new PushSharp.Blackberry.BlackberryRecipient(pushToken);
           recispent.Port = <port>;

           bNotification.SourceReference = "<app_id>";
           bNotification.Recipients = new List<PushSharp.Blackberry.BlackberryRecipient>() { recispent };
           bNotification.Content = new PushSharp.Blackberry.BlackberryMessageContent(notificationContent);
           push.QueueNotification(bNotification);
       }

Kindly let me know how this can be fixed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions