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

Java Development

Reply
Highlighted
New Developer
Posts: 10
Registered: ‎12-01-2008
My Device: Not Specified

Push Message gives error not able to send Message to device

Hi,

 

I've written a small Java application that receives push data from my backend. The application works fine with the simulators (server + device) but it doesn't on my real device/bes. I got a 8700 with OS 4.5.X and a BES for MDS applications 4.1.6.

 

i have check this article also

Check out the error descriptions from this KB article: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800878/800673/What_Is...

 

           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");
            //Write the data
            OutputStream out = conn.getOutputStream();
            out.write(data.getBytes());
            out.close();

/*Get Error


            InputStream ins =conn.getInputStream();
            int contentLength =conn.getContentLength();
            System.out.println( _resources.getString("HTTPPushDemo.status.contentLengthDescription")+ contentLength);
            if (contentLength > 0)
            {
                byte[] someArray = new byte [contentLength];
                DataInputStream dins = new DataInputStream(ins);
                dins.readFully(someArray);
                System.out.println(new String(someArray));
            }
*/

 

1) i am getting error code 401 as after that i am comment the /* Get error */ then i will not get any error.

2) i am not getting message alert on  device.i am using sample HttpPushApi from sample directory of JDE.

3)i use this URL like this http://XXX.XX.XXX.XX:8080/push?DESTINATION=XXXXXXXX&PORT=8090&REQUESTURI=XXX.XX.XXX.XX.

 

 

waiting for reply sir.

 

Thanks Regards

Ranjeet

 

 

New Developer
Posts: 10
Registered: ‎12-01-2008
My Device: Not Specified

Re: Push Message gives error not able to send Message to device

Sorry But can pls anyone solve my issue

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Push Message gives error not able to send Message to device

Where is this code running.  It seems to be on the BlackBerry, but the Push has to be done from the Server.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Push Message gives error not able to send Message to device

HTTP error code 401 means you're not authorized to make the request. The MDS push port probably requires you to provide some username + password (Basic authentication, most likely). Another issue you might bump into is that application-level reliability only works if the device has recently requested a web page via the MDS-CS (e.g., browsed the web via the BES/MDS connection) -- therefore, I suggest you remove the reliability header until everything starts working fine.