04-08-2014 09:23 AM
I need to send notification messages to bb10 devices using PHP script from my server. I've used the BlackBerry Push Service Evaluation form to register, choosing BlackBerry Internet Service as Transport for Pushes and Blackberry Push Essentials as Push Service type.
I have checked posts, including this one that seems to have been solved (http://supportforums.blackberry.com/t5/BlackBerry-
An XML parser error has occured
Invalid document end
The data sent now has the form:
$data = '--' . $boundary .
'<?xml version="1.0" charset="UTF-8"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1
<push-message push-id="' . $messageid . '" source-reference="' . $appid . '" deliver-before-timestamp="' . $deliverbefore . '"><address address-value="push_all"></address>
'--' . $boundary . "\r\n" .
'Content-Type: text/plain' . "\r\n" .
'Push-Message-ID: ' . $messageid . "\r\n\r\n" .
stripslashes($message) . "\r\n" .
'--' . $boundary . '--';
And curl transfer options are set like:
curl_setopt($ch, CURLOPT_URL, "https://cpXXXX.pushapi.eval.blackberry.com/mss/PD_
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "SAA push application");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $appid . ':' . $password); (replaced appid and password with values from registration email)
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/related; boundary=" . $boundary . "; type=application/xml"));
XMLHttpRequest cannot load https://cpxxxx.pushapi.eval.blackberry.com/mss/PD_
3. I used the same XMLHttpRequest code in a webworks app launched from z10 device(the code can be found here - https://github.com/blackberry/BB10-WebWorks-Sample
here is the result:
<response-resultcode="1001"desc="The request has been accepted for processing."></response-result>
...and the Capture application seems to catch the notification, as it launches on new push (doesn't show the message, but that's another thing ).
The only thing that comes now to my mind is that the push server does not accept push messages from my server. But how to solve this?
Any kind of guidance is highly appreciated.