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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

PAP PUSH Error ++badmessage-response bad-message-fragment=

Hi folks!

 

I hope you can help me.

 

I am trying to PUSH a PAP message, but i am receiving a message error from our BES.

 

I sent this info to BES

--mPsbVQo0a68eIL3OAxm Content-Type:application/xml
<?xml version="1.0"?><!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.0//EN" "http://www.wapforum.org/DTD/pap_2.0.dtd"><pap><push-message push-id="1342543539246" source-reference="AAAAAAAAAAAA" deliver-before-timestamp="2013-08-05T18:00:00Z" ppg-notify-requested-to="http://URL"><address address-value="user%40company.com"/><quality-of-service delivery-method="confirmed"/></push-message></pap>
--mPsbVQo0a68eIL3OAxm
Content-Encoding:binary
Content-Type:text/plain
Plain Text Message
--

getMDSConn().setDoInput(true);
getMDSConn().setRequestMethod("POST");
getMDSConn().setDoOutput(true);
getMDSConn().setRequestProperty("Content-Type", "multipart/related; type=\"application/xml\"; boundary=mPsbVQo0a68eIL3OAxm");
getMDSConn().setRequestProperty("X-Wap-Application-Id", "/");
getMDSConn().setRequestProperty("X-Rim-Push-Dest-Port", 100); getMDSConn().setAllowUserInteraction(false);

But I got the error message from BES. Do you have any idea what could be the error?, have you been experienced the same problem?

I would appreciate your time and any help.

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.0//EN" "http://www.wapforum.org/DTD/pap_2.0.dtd" [<?wap-pap-ver supported-versions="2.0"?>]>
<pap product-name="Research In Motion Ltd. MDSCS"><badmessage-response bad-message-fragment="--mPsbVQo0a68eIL3OAxm Content-Type:application/xml
&lt;?xml version=&quot;1.0&quot;?&gt;&lt;!DOCTYPE pap PUBLIC &quot;-//WAP" code="2000"/></pap>
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

You need a blank line following the headers, so insert a line above your "Plain Text Message" and it might work. It's unclear if that's your issue though.. given that your boundary is on the same line as the first Content-Type, maybe your actual data is correct and you're just messing up the formatting when posting it here.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

Hi peter9477,

 

Thank for your response, I have tried your tip, but still not work. That's my code:

 

content.append("--").append(pushData.getBoundary()).append("\r\n")
.append("Content-Type: application/xml; charset=UTF-8").append("\r\n\r\n")
.append("<?xml version=\"1.0\"?>").append("\r\n")
.append("<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.0//EN\" ")
.append("\"http://www.wapforum.org/DTD/pap_2.0.dtd\" ")
.append("[<?wap-pap-ver supported-versions=\"2.0\"?>]>").append("\r\n")
.append("<pap>").append("\r\n")
.append("<push-message push-id=").append("\"1342543539246\"").append(" ")
.append("source-reference=").append("\"/\"").append(" ")
.append("deliver-before-timestamp=").append("\"2013-08-08T18:18:00Z\"")
.append(">").append("\r\n")
.append("<address address-value=").append("\"").append("user@dominio.com")
.append("\"/>").append("\r\n")
.append("<quality-of-service delivery-method=").append("\"unconfirmed\"").append("/>").append("\r\n")
.append("</push-message>").append("\r\n")
.append("</pap>").append("\r\n")
.append("--").append(pushData.getBoundary()).append("\r\n")
.append("Content-Type: text/plain").append("\r\n\r\n")
.append("TESTING").append("\r\n")
.append("--").append(pushData.getBoundary()).append("--");

 An the result is:

 

--mPsbVQo0a68eIL3OAxm
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.0//EN" "http://www.wapforum.org/DTD/pap_2.0.dtd" [<?wap-pap-ver supported-versions="2.0"?>]>
<pap>
<push-message push-id="1342543539246" source-reference="/" deliver-before-timestamp="2013-08-08T18:18:00Z">
<address address-value="icastillo@comimsa.com"/>
<quality-of-service delivery-method="unconfirmed"/>
</push-message>
</pap>
--mPsbVQo0a68eIL3OAxm
Content-Type: text/plain

TESTING
--mPsbVQo0a68eIL3OAxm--

And the response:

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.0//EN" "http://www.wapforum.org/DTD/pap_2.0.dtd" [<?wap-pap-ver supported-versions="2.0"?>]>
<pap product-name="Research In Motion Ltd. MDSCS"><badmessage-response bad-message-fragment="--mPsbVQo0a68eIL3OAxm
Content-Type: application/xml; charset=UTF-8

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCT" code="2000"/></pap>

Really I have tried several things, but the response is always the same.

Peter, do you have  another valuable comment?, I will appreciate it.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

You don't show the code where you actually send the data.

My guess is that you aren't properly specifying the Content-Type header for the overall POST request. It probably needs to be something like "Content-Type: multipart/related; boundary=mPsbVQo0a68eIL3OAxm; type=application/xml" for the above to be parsed properly.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

Also, do you really specify a source-reference of just "/"? Is that because you're on BES10/MDS and not BIS, or could that be another issue? I have to use my App Id for that attribute.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

Ok. My code to send the data looks as following:

.
.
.
pushURL = new URL("http", getMDSHost(), getMDSPort(), "/pap");
.
.
.
getMDSConn().setRequestMethod("POST");
getMDSConn().setDoInput(true);
getMDSConn().setDoOutput(true);
//Headers
getMDSConn().setRequestProperty("Content-Type",	"multipart/related; boundary=" + pushData.getBoundary() + " type=application/xml");
getMDSConn().setRequestProperty("X-Wap-Application-Id", "2013");

 

New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

Yes I am developing an enterprise app, and pushing data through BES10/MDS, on my mobile app I created the push service as following:

PushService("2013", INVOKE_TARGET_KEY_PUSH, this)

 

 

New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

Peter,

It almost works!!, I can't believe it, but the Content-Type header value must be without spaces, my code were:

getMDSConn().setRequestProperty("Content-Type", "multipart/related; boundary="+ pushData.getBoundary() + " type=application/xml");

 And I changed it as:

getMDSConn().setRequestProperty("Content-Type",				"multipart/related;boundary="+ pushData.getBoundary() + ";type=application/xml");

 And now the server response was:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.0//EN" "http://www.wapforum.org/DTD/pap_2.0.dtd" [<?wap-pap-ver supported-versions="2.0"?>]>
<pap product-name="Research In Motion Ltd. Mobile Data Server Connection Service"><push-response reply-time="2013-08-09T05:05:12Z" sender-name="BES5_MDS-CS_3" sender-address="http://MDSHost:Port/pap" push-id="1342543539246"><response-result code="2002"/></push-response></pap>

 

I think to know the reason, thats because we have two BES Servers, maybe the PIN where I am trying to send the push message, is not present in the BES where I am sending the post.

 

Peter, I will keep you informed about the new error message, thank you very much for your help.

 

Wau!, It was good and enough by today!.

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

It's not the spaces that were the issue, it's that you didn't include a semicolon in your first version, ahead of the " type=application/xml" portion, to separate it from the boundary.

A space is actually a valid character inside a boundary string, so with your older version the boundary was actually defined as "mPsbVQo0a68eIL3OAxm type=application/xml".

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: PAP PUSH Error ++badmessage-response bad-message-fragment=

[ Edited ]

icastillo, any update on your side of things?

I happen to have reached the same place today, with everything that was working on BIS now converted as best I can figure out how to work on BES10, but I'm getting the 2002 error as well.

I note that you're using an address-value of just the email address, whereas the docs here seem to claim it must be "WAPPUSH=<email>/TYPE=USER@blackberry.com": http://docs.blackberry.com/en/admin/deliverables/50897/elements_of_a_push_message_control_entity_905... (Edited to add the missing URL.)

I've tried that, and just a PIN (haven't actually gotten to emails quite yet) and numerous other combinations, but I'm getting 2002 for everything so far. I'm curious if you've succeeded and, if so, what you ultimately used for that (and what solved it for you).


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!