PDA

View Full Version : WSDL, problem parsing through returned object


IBFreddy
12-05-2004, 09:41 AM
Hi all, I thought that I was past this problem, but obviously I'm not.

I'm accessing a web service to get the temperature from an airport and I get an object returned to me.

I was informed that the best way to access an object is to use a for loop like the one below:


for(i in data) trace(i+":"+data[i])
trace(data["nameoftargettag"); //gives actual value


For a different web serivce, it worked just fine because there were no other children in the object. However, now a much more complex object is being returned and I'm not able to get down to the lower children.

I tried to dig down lower into the object, but the code below didn't do it.


for(i in data) {
trace(i+":"+data[i])
for(j in data[i]) {
trace(j+":"+data[i][j])
}
}


My main question is what is the snytax to access lower levels in an Object? I always thought it was 'Parent.child.child.child' but that didn't work. I then tried 'Parent["childname"]["childname"]..." but that was a flop as well.

The webservice I'm looking at is:
http://live.capescience.com/wsdl/GlobalWeather.wsdl

I know I need to go to 'root > return > temperature > ambient' but I keep hitting brick walls.

I hate to post again about such a similar problem, but believe me, I've exhausted all my ideas. Thanks for the help ahead of time. :)