04-29-2010 08:33 AM
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.
04-29-2010 08:37 AM
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(pushParamete
Hope that helps
04-29-2010 09:51 AM
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
04-30-2010 02:27 PM
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.PapMessageUnmarshall
at net.rim.pushsdk.pap.unmarshal.PapMessageUnmarshall
at net.rim.pushsdk.pap.PapServiceImpl.push(PapService
at roadcomm.mobile.HTTPPushDemo.push_example(HTTPPush
at org.apache.jsp.mobile.push_jsp._jspService(push_js
at org.apache.jasper.runtime.HttpJspBase.service(Http
at javax.servlet.http.HttpServlet.service(HttpServlet
at org.apache.jasper.servlet.JspServletWrapper.servic
at org.apache.jasper.servlet.JspServlet.serviceJspFil
at org.apache.jasper.servlet.JspServlet.service(JspSe
at javax.servlet.http.HttpServlet.service(HttpServlet
at org.apache.catalina.core.ApplicationFilterChain.in
at org.apache.catalina.core.ApplicationFilterChain.do
at org.apache.catalina.core.StandardWrapperValve.invo
at org.apache.catalina.core.StandardContextValve.invo
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke
at org.apache.catalina.valves.AccessLogValve.invoke(A
at org.apache.catalina.core.StandardEngineValve.invok
at org.apache.catalina.connector.CoyoteAdapter.servic
at org.apache.coyote.http11.Http11Processor.process(H
at org.apache.coyote.http11.Http11Protocol$Http11Conn
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(
at java.lang.Thread.run(Thread.java:619)
04-30-2010 03:46 PM
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.
04-30-2010 04:18 PM
In PushSDK.properties file,
I set "ppg.address=https://pushapi.eval.blackberry.com/mss/PD_pushReq
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_pushReq
05-03-2010 09:26 AM
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.
05-03-2010 10:53 AM
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.
05-03-2010 11:51 AM
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.
05-05-2010 05:38 PM
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: