Hi all
Im new to web services and have a (probably very easy) problem when it comes to displaying results. I am able to get results in strings to show, but as soon as I try and get results that come through an array I am struggling to find the correct syntax to show the results. The web service is a dictionary, and I am sending it a predefined word and trying to get a definition back from it.
The schma is as shown:
<-- results:WordDefinition (object)
<-- Definitions:ArrayOfDefinition (array)
<-- [n]: Definition (object)
<-- WordDefinition:String (string)
my current code is:
import mx.services.*;
result_btn.onPress = function() {
var stockservice = new WebService(“http://services.aonaware.com/DictService/DictService.asmx?WSDL”,stockServiceLog);
stockResultObj = stockservice.Define(“fair”);
stockservice.onLoad = trace(“loading”);
stockResultObj.onResult = function(result) {
trace("word: "+result.Definitions.WordDefinition);
};
stockResultObj.onFault = function(fault) {
trace(fault.faultCode+","+fault.faultstring);
};
};
stockServiceLog = new Log(Log.VERBOSE);
stockServiceLog.onLog = function(txt) {
trace(txt);
}
For "trace("word: “+result.Definitions.WordDefinition);” I have tried various variations of Definitions[n].WordDefinition, Definitions[“fair”].WordDefinition, Definitions[fair].WordDefinition
But all produce the result of word: undefined.
Would really like the result to be placed into a variable/array.
Cheers Ash