You are here

Test Push service with MDS and BlackBerry Widgets

 You will find the both push demo and the blackberry widgets demo soure here:
http://docs.blackberry.com/en/developers/deliverables/10605/Push_install_sample_app_server-side_882946_11.jsp

I have done everything following the tuturial step by step, but when i tried to send push data using the push demo, i always get the "400 Response error' from local MDS server.
Logs:  400 PushServlet: FAILED -#06 The specified delivery method is not possible

It took me almost one day to debug and try to find the iusse, but no result. Util i found this document:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800662/Support_-_The_specified_delivery_method_is_not_possible.html?nodeid=1233987&vernum=0

Configure the BlackBerry MDS or MDS Simulator with ports used with the application-level reliability mode. To do so, open the rimpublic.property file and add a push.application.reliable.ports parameter that lists the ports used for pushing data with the application-level reliability mode.

 The official push demo snippet codeto send push data:

           URL url = getPushURL(_pinField.getText());
            System.out.println(_resources.getString("HTTPPushDemo.status.sendingToString") + url.toString());

            //open the connection using the static member...
            HttpURLConnection conn =(HttpURLConnection)url.openConnection();
            conn.setDoInput(true);//For receiving the confirmation
            conn.setDoOutput(true);//For sending the data
            conn.setRequestMethod("POST");//Post the data to the proxy
            conn.setRequestProperty("X-RIM-PUSH-ID", pushId);
            conn.setRequestProperty("X-RIM-Push-NotifyURL", notifyURL);
            conn.setRequestProperty("X-RIM-Push-Reliability-Mode","APPLICATION");
                       
            System.out.println("begin to post data");
            //Write the data
            OutputStream out = conn.getOutputStream();
            out.write(data.getBytes());

 

You need change
conn.setRequestProperty("X-RIM-Push-Reliability-Mode","APPLICATION");
TO
conn.setRequestProperty("X-RIM-Push-Reliability","Application-Preferred");

 Then the push demo works fine, with 200 Http OK response. My MDS version is 4.0.

 

ref: http://devblog.blackberry.com/2010/02/pushing-data-down-to-your-blackberry-widget/
http://docs.blackberry.com/en/developers/deliverables/10605/Push_install_sample_app_server-side_882946_11.jsp

 

 

Comments

I like your blog,and also like the article,and thank you for provide me so much information :))

Thanks a lot for this post. It quite gets on ones nerves with delivered sample apps from vendors don't work. You post is a result of a week's research. Appreciate the post.
Regards,
K

Good post.

This worked for me by commenting the line

// conn.setRequestProperty("X-RIM-Push-Reliability-Mode","APPLICATION");

Thanks and Regards

I was having this exact problem running the HTTPPushDemo. You've saved me that precious day of debugging you had to endure! So thank you so much for posting your solution.

There are a few users on the Blackberry Developer forum having this problem and the Blackberry rep didn't solve it for them, just re-iterated the tutorial steps as though they were wrong to report this error. Honestly, releasing buggy sample code is inexcusable. Shame on RIM. Thanks again!

When i am running run.bat for server side application, it running and immediately closing.

client side application is working on simulator.

This site is like a classroom, ecxept I don't hate it. lol

It should not to be closed, somewhere wrong

Good point. I hadn't thuohgt about it quite that way. :)