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
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

Correct, during the install of the SDK you didn't enter the correct PPG  URL. To test in the sandbox you needed to enter: https://pushapi.eval.blackberry.com/mss/PD_pushReq uest when the installer prompted you for the PPG URL. The previous poster showed you how you can change it after the fact.

 

Please use plain text.
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

If you just want to use the lower level APIs of the SDK... poking around the JavaDoc for the PAP component I think you can do something like this to send a BIS push:

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

PushMessageControl pushMessageControl = new PushMessageControl(idGenerator,
pushAppId, addresses);
Content papContent = new TextContent("My content");

PapService papService = PapBeanLocator.get PapService ();
PushResponse response = papService.push(pushAppId, password, pushAppId, pushMessageControl, papContent);

 

 

If you want to use the higher level APIs of the SDK that includes using a database:

 

// You need to add the push application first to the persistent store either using the DebugPortal or using the APIs in the push application management component

Content content = new TextContent("My content");
List<String> addresses = new ArrayList<String>();
addresses.add("yourpinhere");

PushParameters pushParameters = new PushParameters(appId, addresses, content);
PushResult pushResult = PushBeanLocator.getPushService().push(pushParameters);

 

 

Hope that helps

Please use plain text.
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

If you don't want to include the Spring JAR in your classpath using the low level APIs, following my example above you can do something like:

 

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

PushMessageControl pushMessageControl = new PushMessageControl(idGenerator,
pushAppId, addresses);
Content papContent = new TextContent("My content");

 

PushSDKPropertiesImpl properties = PushSDKPropertiesImpl();

 

 

HttpClient client = new HttpClientImpl();

client.setPushSDKProperties(properties);

 

PapService papService = new PapServiceImpl();

papService.setHttpClient(client);

papService.setPushSDKProperties(properties);


PushResponse response = papService.push(pushAppId, password, pushAppId, pushMessageControl, papContent);

 

Spring Framework just wires up the beans on your behalf at the low level APIs. At the higher level APIs it also provides database peristence help and transaction management that you'd otherwise have to write yourself so it's nice that it's all taken care of by Spring Framework

 

 

Please use plain text.
New Contributor
janbb
Posts: 5
Registered: ‎06-23-2009
My Device: Not Specified

Re: standalone server-side example based on the new blackberry push service

I followed your example above and got the following errors. Do you know what caused this? Thanks.

 

net.rim.pushsdk.commons.PushSDKException: Received content type is not 'application/xml' at net.rim.pushsdk.pap.unmarshal.PapMessageUnmarshaller.performParseValidation(PapMessageUnmarshaller.java:215)

at net.rim.pushsdk.pap.unmarshal.PapMessageUnmarshaller.unmarshal(PapMessageUnmarshaller.java:175)

at net.rim.pushsdk.pap.PapServiceImpl.push(PapServiceImpl.java:152)

at roadcomm.mobile.HTTPPushDemo.push_example(HTTPPushDemo.java:140)

at org.apache.jsp.mobile.push_jsp._jspService(push_jsp.java:64)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)

at java.lang.Thread.run(Thread.java:619)

Please use plain text.
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

This error means the response you got from the PPG is not PAP XML. I would suspect you are not posting your PAP XML request to the correct PPG URL? What did you set the PPG URL to be in the PushSDK.properties file?

 

Also, you can change the logging level in the log4j.xml file to be DEBUG instead of INFO for the net.rim.pushsdk logger - that will give you a lot more info that might help you too.

Please use plain text.
New Contributor
janbb
Posts: 5
Registered: ‎06-23-2009
My Device: Not Specified

Re: standalone server-side example based on the new blackberry push service

In PushSDK.properties file,

I set "ppg.address=https://pushapi.eval.blackberry.com/mss/PD_pushRequest".

 

This time, I got the error message of

 

net.rim.pushsdk.commons.UnauthorizedException: Unauthorized to push to URL: https://pushapi.eval.blackberry.com/mss/PD_pushRequest with username: my-app-id and password: my-password

Please use plain text.
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

This is expected. Your credentials to push are definitely not username: my-app-id and password: my-password. These values sound like ones you just made up. :-)

 

When you register with RIM/BlackBerry to use the Push Service they will send you an email with the username and password you should use to push. The username will be your push service id.

 

When you installed the SDK it prompted you for your username and password, you might have just entered 'my-app-id' and 'my-password' at the time. You can use the DebugPortal helper application to edit your push application's credentials to be the one that RIM sent you in your registration email.

 

 

Please use plain text.
New Contributor
janbb
Posts: 5
Registered: ‎06-23-2009
My Device: Not Specified

Re: standalone server-side example based on the new blackberry push service

I replaced the real application id and password with 'my-app-id' and 'my-password' here. I did enter my real application id and password when installing push SDK.

Please use plain text.
Regular Contributor
mdicesare
Posts: 78
Registered: ‎04-28-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: Rogers

Re: standalone server-side example based on the new blackberry push service

Oh I see, my mistake. :-) 

 

In that case, I would follow up with RIM to ensure you are using the correct username and password. There have been a lot of posts here from people getting the Unauthorized error. Its hard for the community to solve that issue because the credentials are obviously private but once you get that straightened out you should be good to go.

Please use plain text.
New Contributor
jhnlmn
Posts: 7
Registered: ‎04-29-2010
My Device: Various
My Carrier: Various

Re: standalone server-side example based on the new blackberry push service

 

I have the same problem with the sample debug-portal.

 

So, whom I should contact?

 

The BB push registration E-Mail does not include any support option other than this forum.

 

Also, I found pretty confusing the multiple use or words "ID", "username" and "Password" in the registration E-mail and documentation.

For example, the Push registration E-Mail contains "Username" == my E-mail, also it has "Portal Pwd:" and simply "Pwd:", also it has Application name, CPID (Content Provider ID) and "Application ID".

So, I tried using "Application ID" and both passwords, but still get the same problem:


Unauthorized to push to URL: https://pushapi.eval.blackberry.com/mss/PD_pushRequest with username: application_id and password: any_of_2_passwords
  
   
So, what should I do?
  
Thank you
Please use plain text.