Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
silverhawk1086 opened this issue Apr 6, 2016 · 4 comments

Comments

@silverhawk1086
Copy link

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.

@Redth
Copy link
Owner

Redth commented Apr 7, 2016

My guess is you have some malformed XML in your BlackberryMessageContent

@silverhawk1086
Copy link
Author

Is it possible for you to send a sample code on how to implement BB push notification using PushSharp?

@Redth
Copy link
Owner

Redth commented Apr 8, 2016

Sorry but I don't have any way to test on blackberry.

You're going to have to try and do this alone :(

Only thing I can say is someone in the past has used this code successfully!

@silverhawk1086
Copy link
Author

Is there a documentation or sample code for this in BlackBerry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants