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

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
Accepted Solution

create http client to get data from web service

Hi,

I'm newbie on workingwith webworks. I have to get data from web service. How can I connect on this service and parse it. There is a tutoriel that can help me to start with it.

Can any one advice me how can I start to work with webworks on blackberry 10

Thanks for any help

Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C

Re: create http client to get data from web service

In general you need to use an AJAX call to the server

 

It really depends on what the server returns as to how easy the information is to digest

 

JQuery provides a simple interface and returns easy to use information

 

If you're dealing with XML things can get complicated depending on namespace

 

If you look at the raw XML and it goes something like fred:name you will have issues that require a SAX implementation - JSON is dead easy if you get that though (nothing too confusing there)

 

If using an external data source go for JSON if you have the choice

 

As far as examples go - just look up JQuery Ajax [JSON / XML] and you'll get where you're going rapidly

 

SAX is a LOT harder owing to the namespace - the most common is Dublin and even XML without namespace is not simple to handle so avoid it if you can




Click the like button if you find my posts useful!
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: create http client to get data from web service

I'm accepting peardox's response as a solution as it outlines the components required to make a web service request via AJAX and provides information about samples.

There is also a basic W3C sample here using AJAX and a PHP server that returns database information:
http://www.w3schools.com/php/php_ajax_database.asp

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.