Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 01:44, 5 September 2008.

How to access WebServices using WebServiceConnector component

From Forum Nokia Wiki

In this tutorial, we'll show how to access a web service easily using the WebServiceConnector component. This post was originally published at FlashLite Effort

First of all, you've to had a web service started. We'll use a public web service to get current weather and weather conditions for major cities around the world. More details about this WebService can be view in [1]

Now, let's code the client.

  • You've to create a instance of WebServiceConnector into the Stage. Give it a instance name and set the WSDLURL field in Parameters panel.
  • Set the following fields in the parameters panel of WebServiceConnector instance:
    • WSDLURL: The url of the WSDL file location (local or remote).
    • operation: The name of the operation to be called.
  • You also have to create a UIComponent to show the recovered data from the WebService. In our example, we,ll use four labels. Like showed in the Figure.

Image:Weather_example.PNG

In the first frame of the timeline you have to add the following code:

fscommand2("Fullscreen",true);
//Here is created a 'wslistener' object that will be a event listener of the
//WebServiceConnector object. The event name is 'result'
 
var wslistener:Object = new Object();
 
wslistener.result = function(evt:Object){
	
	location_txt.text 	= "Processing...";
	time_txt.text 		= "Processing...";
	sky_txt.text		= "Processing...";
	temperature_txt.text    = "Processing...";
	
	var	result_xml = new XML();
	result_xml.ignoreWhite = true;
	
	result_xml.parseXML(evt.target.results);
	location_txt.text 	= result_xml.childNodes[0].childNodes[0].firstChild.nodeValue;
	time_txt.text 		= result_xml.childNodes[0].childNodes[1].firstChild.nodeValue;
	sky_txt.text		= result_xml.childNodes[0].childNodes[4].firstChild.nodeValue;
	temperature_txt.text= result_xml.childNodes[0].childNodes[5].firstChild.nodeValue;
}
 
//We've to add the 'wslistener' object as a listener to 'weather_ws' object.
//When the operaion is finished, the 'wslistener.result' method will be invoked.
weather_ws.addEventListener("result",wslistener);
 
//When the button is pressed, the Web Service must be invoked.
get_btn.onPress = function(){
	//The 'params' attribute receives an Array in the same order of the schema 
        //defined in WebServiceConnector compoent.
	//Window -> Component Inspector -> Schema
	weather_ws.params = [city_txt.text,country_txt.text]
	weather_ws.trigger();
}
  • Start the emulator or put the swf in the mobile phone.


Remember to put the SWF file in the \Others\Trusted folder if you want to use Flash Lite 3.0. See more at FlashLite Effort

Related Discussions
Thread Thread Starter Forum Replies Last Post
RSocket.SetOpt() UDP stenlik Symbian Networking & Messaging 3 2005-09-21 08:53
Loosing colors displaying 8-bit picture stopin General Symbian C++ 1 2002-12-16 17:46
Where can i find the detail of Series40 theme 1073X Themes/Carbide.ui 4 2008-06-25 19:15
Support M2M and C# carapeto Nokia M2M 19 2005-06-15 17:27
listboxes Ikhtys General Symbian C++ 5 2007-08-22 17:14
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZflashE5fliteQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX