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

Native Development

Reply
Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline
Accepted Solution

HTTP communication tutorial don't working

I trying copy/paste of example from:

https://developer.blackberry.com/cascades/documentation/device_platform/networking/tutorial_http_com...

 

but after press refresh button I don't see update and debu console write: 

 

BAXmlDataModel: Error parsing file ../../../data/model.xml on line 1, column 50:
"unexpected character"

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

Re: HTTP communication tutorial don't working

So what's at or near line 1, column 50 in your model.xml file?

The one in model.zip doesn't even have 50 characters on line 1, though it does contain CRLF line endings, plus a TAB character, which shouldn't pose a problem normally but in this case who knows.

Anyway, whenever I get an error like that I try just modifying my input data and see if the line/column or something else changes in the error message, to see if I can verify that it's actually consuming the file I think it is. If I can't affect the error that way, then I'm making a wrong assumption somewhere, generally...

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: 119
Registered: ‎05-27-2010
My Device: 9900
My Carrier: Vodafone NL

Re: HTTP communication tutorial don't working

Trying the same as you and getting the same error.

 

The initializaion goes well, but retrieving the model.xml from the external source gives the error.

 

Note that the url has changed from the example:

in the example this source was listed:

http://developer.blackberry.com/cascades/files/documentation/device_platform/networking/model.xml

 

 

but it has been relocated to:

https://developer.blackberry.com/cascades/files/documentation/device_platform/networking/model.xml

 

Even when changing it and checking the output using the following line:

// Write to the file using the reply data and close the file

        qDebug() << reply->readAll(); // show debug of the data gotten!

        mFile->write(reply->readAll());

        mFile->flush();

        mFile->close();

 

 

->>> now I have to correct myself : the added line qDebug << reply->readAll(); already dumps all the contents, leaving nothing for the mFile later on. By removing the debug line again, the example now works very well.

 

Just don't forget to update the link to the new https URL !! Hope this helps you out.

 

If you want to do some other bits using JSON check the documentation on that here: 

https://github.com/blackberry/Cascades-Samples/tree/master/stampcollector

 

 Now I'm going off to get my App done ;-).

@reumerd-- @BBDevGroupNL -- about me
If you like it, LIKE it ;-) ----- If it's solved, press solved ! --- If you solved it yourself, please let us know! We might have the same problem!
Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: HTTP communication tutorial don't working

Thanks, I will try today
Developer
Posts: 208
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE
My Carrier: Vodafone

Re: HTTP communication tutorial don't working

I try but don't work. I change the "https" and  qDebug() << reply->readAll(); // show debug of the data gotten!

 

but the App return "Context: Failed to find target node with id 0" when I tabbed on the ActionItem and "

XmlDataModel: Error parsing file ../../../data/model.xml on line 14, column 8:

"unexpected character" when touch refresh...

_______________________________________________

If U like my post click on LIKE Smiley Wink
Developer
Posts: 208
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE
My Carrier: Vodafone

Re: HTTP communication tutorial don't working

My Console when run App:

 

### TIMESTAMP pid=19488974 at 19064598 ms -> "handle incoming events begin (2)"

NavigatorPrivate::handleBpsEvent - window state

NavigatorPrivate::handleWindowStateEvent - fullscreen

Context: Failed to find target node with id 0

"<root>

<header title="Contacts">

<contacts title="Wes Barichak"/>

<contacts title="Mike Chepesky"/>

<contacts title="Marcus Meurling"/>

<contacts title="Alex Kinsella"/>

<contacts title="Karla Tetzel"/>

<contacts title="Mark Tiegs"/>

<contacts title="Johan Larsby"/>

<contacts title="Joseph Venditti"/>

<contacts title="Marco Cacciacarro"/>

<contacts title="Julie Palmer"/>

</header>

</root>"

XmlDataModel: Error parsing file ../../../data/model.xml on line 14, column 8:

"unexpected character"

Context: Failed to find target node with id 0

_______________________________________________

If U like my post click on LIKE Smiley Wink
Developer
Posts: 119
Registered: ‎05-27-2010
My Device: 9900
My Carrier: Vodafone NL

Re: HTTP communication tutorial don't working

Take out this line :
qDebug() << reply->readAll(); // show debug of the data gotten!

And it should work fine.

Because you already readAll, nothing is left for the XML file, giving you the error.
@reumerd-- @BBDevGroupNL -- about me
If you like it, LIKE it ;-) ----- If it's solved, press solved ! --- If you solved it yourself, please let us know! We might have the same problem!
Developer
Posts: 208
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE
My Carrier: Vodafone

Re: HTTP communication tutorial don't working

In the sample there isn't this string of code .. qDebug() << reply->readAll(); // show debug of the data gotten!

 

_______________________________________________

If U like my post click on LIKE Smiley Wink
Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: HTTP communication tutorial don't working

I think its bug. Maybe problem at in "\n" or EOF type characters?
Developer
Posts: 208
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE
My Carrier: Vodafone

Re: HTTP communication tutorial don't working

I check all files of the project .. are correct .. Smiley Indifferent

_______________________________________________

If U like my post click on LIKE Smiley Wink