View Full Version : Tracing webservice results

11-13-2003, 10:58 AM

I am trying to display the results of a webservice using the WebserviceConnector. It loads successfully but returns values of "undefined" for data.

The problem is the object is an array. I can display string objects when they are variable results of the service, but how do I target the array and display its results?

---SelectAll() - Retrieves all data from Database
-----results : .Net DataSet (Array) [optional]
----------- [n] : data
----------- name : string

import mx.services.*;

// the service is called when the button is pressed.

result_btn.onPress = function() {

// Create a new instance of web service called - myWebservice.

myWebservice = new WebService("http://localhost:8100/webService.asmx?wsdl");

// Call the method and assign it to the pending call object to handle results.

serviceResultObj = myWebservice.SelectAll();

myWebservice.onLoad = trace("loading");

// the onResult function is called if the service is successful

serviceResultObj.onResult = function(result) {

// example result values. The result is a decoded actionscript object
trace("Name: "+result.name);//This works fine
trace("All results: "+result.???);//How do I display all info from the array?



Thank you,
Eternally grateful

11-14-2003, 02:31 AM
tried something like this?
for (var tmp in results) {
trace (tmp + ": " + results[tmp]);

11-15-2003, 11:34 AM

Looks interesting, I'll give it a shot!