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
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha
Accepted Solution

Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

[ Edited ]

Hi all,

 

I have got mail from RIM for BlackBerry Push Service Evaluation Credentials.

I have configured required credentials and other stuff, and able to run "Sample Push Initiator". But, when I pushed a notification from this I got an error :

ERROR: Unauthorized to communicate with the PPG at URL:
https://pushapi.eval.blackberry.com/mss/PD_pushRequest with username: 1234-
45545534534534 and password: ${samplepushinitiator.public.password}

 

Note : 1234-45545534534534 (Fake App-Id).

Please explain me what can be wrong??

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 228
Registered: ‎10-01-2011
My Device: Passport

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

 ${samplepushinitiator.public.password}

 

That hasn't been substituted from your code sample,  that will be the casue, so the question is why this has not been substitued. Have you set you rpassword in 

 

sample-push-initiator.properties?

 

Check the property

 

application.public.password=<your password goes here>

 

--------------------------------------------------------------------

If I helped you please press the LIKE button

Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

 

Hi Cryspyoz, thanks for your input.

 

I have got RIM Mail in this format

 

Configuration properties for the Push Initiator (server application)

 

Name:

myApp

 

App ID:

1234-45545534534534

 

Pwd:

mypassword

 

CPID (Content Provider ID):

XXXX

 

Start Date (MM/DD/YYYY):

6/19/2012

 

Expiry Date (MM/DD/YYYY):

10/20/2012

 

Service Type:

Essentials

 

PPG Base URL**

https://pushapi.eval.blackberry.com

 

Source IP:

Whitelisting no longer required

 

Usage:

BIS

 

And, I have put 


application.public.password=<mypassword>

 

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

Can anybody help me out to resolve this..?

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

Anybody from RIM please look into this issue... I am stuck with this. have reset the password again, trying again and again but  still not able to solve it.

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 228
Registered: ‎10-01-2011
My Device: Passport

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

[ Edited ]

Kanak you need a support contract with RIM if you want RIM to do your touble shooting for you. I am sure they wll be happy to sign you up. Or of you want others of us with Blackberry expertise to be at your beck and call then I'm happy to be contracted on a daily rate to do your coding for you also. Otherwise you have to be a bit patient.

 

You are probably better to ask this question in the group dedicated to push, but it's pretty quiet group.  Here is the link:

 

http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/bd-p/Applications_using_Push_Tech...

 

However, I suspect that you are just using this sample application to test your push work, so instead you can use my sample push code that can be found here:

 

 

http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Sending-push-notification-to-some...

 

 

------------------------------------------------------------------

If I helped you press LIKE 



Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

Hi Crispyoz,

 

Thanks for the suggestion.

 

I have mailed to RIM, regarding above problem. Meanwhile, I have tried to run your sample code.

 

APP_ID = myAppId;

 

      List<String> addresses = new ArrayList<String>();
      addresses.add("XXXXXXXX");
      IdGenerator idGenerator = new IdGeneratorImpl();

      PushMessageControl pushMessageControl=null;
      try {
           System.out.println("before pushMessageControl --------------- ");
           pushMessageControl = new PushMessageControl(true,idGenerator, APP_ID, pins);  //line 1
          // This line is not printling in Console
           System.out.println("got an instance of pushMessageControl .........");
      }catch(Exception e1) {
           System.out.println("exception in object pushMessageControl === " +e1.getMessage());
      }

 

I have checked for idGenerator, APP_ID, pins - all values are fine. I guess its hanging at line 1. Any comments plz.

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 228
Registered: ‎10-01-2011
My Device: Passport

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

[ Edited ]

What JRE are you using ? What PGP URL are you using in this sample code?

 

Developer
Posts: 228
Registered: ‎10-01-2011
My Device: Passport

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

Actually I suspect you have not set any timeout properties, since I can't find thread I posted the full code, here it is below.

 

private static String password = "Your password here";
private static String targetURL = "https://pushapi.eval.blackberry.com/mss/PD_pushRequest";
private static final String APP_ID = "your app id here";


public static void main(String[] args) throws PushSDKException, BadMessageException, UnauthorizedException {
org.apache.commons.codec.binary.Base64 b6;
//net.rim.pushsdk.acknowledgement.NotificationProcessorServiceImpl nsi;
IdGenerator idGenerator = new IdGeneratorImpl();
List<String> addresses = new ArrayList<String>();
String data = "this is a test message - 2";
System.out.println("Data is: " + data);
addresses.add("your PIN here");
PushMessageControl pushMessageControl = new PushMessageControl(idGenerator, APP_ID, addresses);
Content content = new TextContent(data);
PapService papService = new net.rim.pushsdk.pap.PapServiceImpl();
PushSDKProperties properties = getBBProperties();
HttpClientImpl client = new HttpClientImpl();
client.setPushSDKProperties(properties);
papService.setHttpClient(client);
papService.setPushSDKProperties(properties);
PushResponse response = papService.push(APP_ID, password, APP_ID, pushMessageControl, content);
System.out.println(response.getDescription());
}

private static PushSDKProperties getBBProperties() {
PushSDKProperties p = new PushSDKPropertiesImpl();
p.setPpgAddress(targetURL);
p.setHttpIsPersistent(false);
p.setHttpConnectionTimeout(60000);
p.setHttpReadTimeout(120000);
p.setUsingXmlParserDtdValidation(false);
return p;
}

 

Chris

 

-----------------------------------------

If I helped you press LIKE

Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Push (Sample Push Initiator) - Unauthorized to communicate with the PPG at URL

Hi Chris,

 

Sorry for the late reply.. 

 

JRE : 1.6.0.21

And regarding timeout, that factor will effect once my code runs upto //line 2. Clear me if I am wrong.

 

I have a servlet runnig this code at Tomcat Server Version 6.0.32 : 

 

private static String password = "my passwoord";
private static String targetURL = "https://pushapi.eval.blackberry.com/mss/PD_pushRequest";
private static final String APP_ID = "my app-id";

 protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
        
        try {
                //Arraylist that will hold list of all devices to which is Push needs to be send
                List<String> pins = getDevicesList();
                //generate unique ids
                IdGenerator idGenerator = new IdGeneratorImpl();
                //An instance of the Push PAP request message control using uniqueId, appid, and list of PINs
                PushMessageControl pushMessageControl=null;
                try {
                    System.out.println("before pushMessageControl --------------- ");
                    pushMessageControl = new PushMessageControl(true,idGenerator, APP_ID, pins);
                    System.out.println("33333333333333333");
                }catch(Exception e1) {
                }
                //Content to be pushed
                Content content = new TextContent("Hi, This is my first Notification.");
                //PapService instance which is  initialized by PapServiceImpl, required to
                //send PAP 2.1/2.0 XML to a Push Proxy Gateway (PPG) and parse the PAP XML responses.
                PapService papService = new net.rim.pushsdk.pap.PapServiceImpl();
                PushSDKProperties properties = getProperties(); // line 2
                HttpClientImpl client = new HttpClientImpl();
                client.setPushSDKProperties(properties);
                papService.setHttpClient(client);
                papService.setPushSDKProperties(properties);
                
                try{
                       PushResponse _response = papService.push(APP_ID, password, APP_ID, pushMessageControl, content);
                       System.out.println("_response : "+_response.getDescription());
                }catch(NullPointerException ex){
                       System.out.println(" NullPointerException exceptionnnnnnnnnnnnn : " +ex.getMessage());
                       ex.printStackTrace();
                }

            } catch (Exception e) {
                System.out.println(" Exception exceptionnnnnnnnnnnnn 222222222 " +e.getMessage());
                e.printStackTrace();
            }
    }

     private List getDevicesList(){
        List<String> pins = new ArrayList<String>();            
            pins.add("26DCE6FB");//28B9EC2D");
            return pins;
    }
     
      private PushSDKProperties getProperties() {
            PushSDKProperties p = new PushSDKPropertiesImpl();
            p.setPublicPpgAddress(targetURL);
            p.setHttpIsPersistent(false);
            p.setHttpConnectionTimeout(60000);
            p.setHttpReadTimeout(120000);
            p.setUsingXmlParserDtdValidation(false);
        return p;
    }

 

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro