If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

Reply
New Contributor
DM9360
Posts: 7
Registered: ‎01-15-2013
My Device: Blackberry 9360
My Carrier: Tata Docomo
Accepted Solution

Push Server for Blackberry in C#

Hello,

 

I am trying to create push server for sending push notifications on Blackberry devices using BIS in C#. I have registered for eval and received an email with all the related information.

 

Also, I got some samples for the PAP xml generated for sending notification to device.

But whenever I send that request, I get "Unauthorised" in response.

The request looks like: 

 

--PMasdfglkjhqwert123 Content-Type: application/xml; UTF-8<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd">
<pap>
<push-message push-id="1358164672884" source-reference="app id received in email"

deliver-before-timestamp="2013-01-14T17:27:56Z">
<address address-value="device pin"/>
<quality-of-service delivery-method="confirmed"/>
</push-message>
</pap>
--PMasdfglkjhqwert123
Content-Encoding: UTF-8
Content-Type: text/plain
Push-Message-ID:1358164672884

Hello KK...
--PMasdfglkjhqwert123--

 

Does the url i am sending this request to is correct ? The url is : https://cpxxxx.pushapi.eval.blackberry.com/mss/PD_pushRequest (here xxxx : content provider ID)

 

Also, Plz tell me the steps for implementing Push server for BB.

Is Tomcat necessary in case of C# (.NET)?

 

What i know is first the device registers to RIM. (we r able to register)

Then the details are passed to push server for registering content provider.  (How to do this?)

Then the request is made to send notification on device (when needed). (got the request format, but don't understant why I am getting "Unauthorised").

 

 

Plz reply.

Its urgent and I am not getting any sample or link.

 

Thanks in advance.

Please use plain text.
BlackBerry Development Advisor (Retired)
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Push Server for Blackberry in C#

Hi,

 

You need to perform basic authentication. http://en.wikipedia.org/wiki/Basic_access_authentication

Are you providing the Authorization header with your App ID and password as part of your HTTP request?

 

Thanks,

 

Matt

Please use plain text.
New Contributor
DM9360
Posts: 7
Registered: ‎01-15-2013
My Device: Blackberry 9360
My Carrier: Tata Docomo

Re: Push Server for Blackberry in C#

[ Edited ]

Hi,

 

Thanks for reply.

 

Yes i am providing "Authorization" header in request header. The value is something like

 

Basic <base64string of appID and password>

 

Plz tell what is the Content Provider registration part and how we can do it ? 

 

thanks

 

DM

Please use plain text.
BlackBerry Development Advisor (Retired)
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Push Server for Blackberry in C#

The registration piece needs to be done, but that doesn't explain why you are getting Unauthorized on a push.

 

Are you sure your Authorization header is set correctly?


Do you have a colon (:smileyhappy: in between the App ID and password before you base64 encode the whole string?

 

Thanks,

 

Matt

Please use plain text.
New Contributor
DM9360
Posts: 7
Registered: ‎01-15-2013
My Device: Blackberry 9360
My Carrier: Tata Docomo

Re: Push Server for Blackberry in C#

Yes, there is a colon in between AppID and Password before encoding string to Base64.

Also the word "Basic" + space is added after the above string is encoded to Base64. Right?

 

Is there some chance of difference in the encoded strings by C# and Java ?

 

Also plz check the url in original post which I am using for sending request. Is it Ok ?

 

thanks

 

DM 

Please use plain text.
BlackBerry Development Advisor (Retired)
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Push Server for Blackberry in C#

The URL you are sending the push to looks correct.

 

And, no, there is no difference in the encoded strings between C# and Java.

 

Just curious, how long ago did you register with eval?  Could your application be expired maybe?

 

Thanks,

 

Matt

Please use plain text.
New Contributor
DM9360
Posts: 7
Registered: ‎01-15-2013
My Device: Blackberry 9360
My Carrier: Tata Docomo

Re: Push Server for Blackberry in C#

[ Edited ]

I am recieving response now. It was some problem in Base64 encoding.

 

Plz let me know what should be the "deliver-before-timestamp" in request.

Ok, I am receiving a success now.

 

Some problem in Base64 encoding.

 

Is it mean that device should receive a Notification ?

 

Bcoz I am not receiving any.

 

Or there is some more to go ?

 

Thanks Matt.

 

 

DM

 

Please use plain text.
BlackBerry Development Advisor (Retired)
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Push Server for Blackberry in C#

It's a date.  It's the date the push should be delivered before.  If the push has not been delivered before that timestamp is reached, then the push will expire.

Typically, we recommend setting it to one to two hours after the current time.

But, you can set it to what you'd like.

Please use plain text.
BlackBerry Development Advisor (Retired)
mdandrea
Posts: 311
Registered: ‎08-08-2012
My Device: BlackBerry Z10
My Carrier: Rogers

Re: Push Server for Blackberry in C#

In order to receive pushes, you have to register to the BlackBerry Push Service from your push-enabled application running on your BlackBerry itself.  Did you write your own app to receive pushes or are you using a sample one?

Please use plain text.
New Contributor
DM9360
Posts: 7
Registered: ‎01-15-2013
My Device: Blackberry 9360
My Carrier: Tata Docomo

Re: Push Server for Blackberry in C#

[ Edited ]

Hi Matt,

 

Now I am getting a success at push server in response of that PAP request.

also, I am able to register Blackberry device, by my own app.

 

But no push notification received on device. I implemented push notification receiving code.

But no notification received on device.

 

 

Also, plz let me know how we get the "Boundary" value in PAP push request ? 

 

Thanks,

 

DM

Please use plain text.