10-09-2009 07:00 PM
10-17-2009 07:02 AM
Web Services can be handled many different ways in a Widget. Basically the same types of options you would have from a web page.
1) You can go directly to the webservice passing down envelopes using the SOAP protocol by using a variety of JavaScript AJAX commands
2) You can create a RESTful web service that basically wraps the SOAP web service and return just the XML you want back to the device and then manipulate the response in JavaScript
3) You can create a web page via ASP, JSP, PHP etc to call the SOAP web service and return the resulting HTML back to the widget for display
It all depends on the what you are looking to accomplish. For me, if I am calling a SOAP web service, I would typically choose either (2) or (3) so that I have the following advantages:
10-17-2009 01:22 PM
Can you be more specific about what ajax objects we can use?
I've just begun BB development so I'm not familiar with the envrionment. I get an uncaught exception if I try to use the standard:
var http = XMLHttpRequest();
Any help is appreciated. Thanks.
10-17-2009 03:13 PM
AndrewPoirier wrote:
Can you be more specific about what ajax objects we can use?
I've just begun BB development so I'm not familiar with the envrionment. I get an uncaught exception if I try to use the standard:
var http = XMLHttpRequest();
Any help is appreciated. Thanks.
It appears that you have a syntax error in your code.. it should be:
var http = new XMLHttpRequest();
10-19-2009 08:36 AM
Tim
When you mention your preference to returning data in HTML as apposed to XML, would that still be the case if you were returning lots of records and fields intended for a SQLite table? I recognise the size advantages of using HTML over XML, but would imagine one would have to get into delimiting fields, records etc. in order to strip the data out of the HTML.
I'm currently experimenting with migrating my MDS Runtime apps over to Widgets and in order to preserve the back office logic in the webservices have developed a 'wrapper' as you suggest in 3. It returns the XML and then I use a JS framework from Prototypejs.org to parse the results which I then insert into a SQLite table. It seems to work ok from the Browser and going to try as a Widget soon. Are you aware of this product? Do you think there are any potential pitfalls with this approach?
Look forward to hearing your feedback.
Dave
10-19-2009 08:50 AM
Hi Dave,
If you are hitting a web service to then populate local data, then yes, bringing back XML is much better than HTML. I'm not that familiar with the XML parser that you are using. But the data that comes back from a AJAX request has already been parsed into a DOM for you. The returned result is a Document in the responseXML property.
So you should just have to traverse the DOM of responseXML to pull out the values that you need.
11-03-2009 12:00 PM
I am just getting started with BB widget development..., so forgive the elementary question.
How do you get around the cross domain xhr issue? Is that accomplished by whitelisting the domain in the config? This is what i am getting from reading some of the posts.
Also, when you mention AJAX libraries, I am guessing that JQuery would be fine. Yes?
11-03-2009 12:21 PM
Yes, whitelisting the domain in the config will allow for cross domain xhr...
There are many parts of JQuery that will work. Just note that the JQuery library is a "heavy" library so you may only want to strip out the pieces that you want.
Also note, that the Beta of the widget technology doesn't do any caching of pages or JavaScript so the JQuery library will be parsed each time it is loaded.
11-03-2009 01:18 PM
Thanks for the quick reply and the insight.
Before I go off create my own light weight lib, can anyone recommend any lighter library that would support passing in multiple parameters (JSON data) to a WCF service?
Thanks in advance.
08-15-2010 05:00 AM
Hi ..
Sir Tim ,
if I choose this way "
3) You can create a web page via ASP, JSP, PHP etc to call the SOAP web service and return the resulting HTML back to the widget for display" to be implemented in php do you have Guid how that accomplish ?