Skip to main content
Participant
February 1, 2007
Question

Array of objects returned by a .NET web service

  • February 1, 2007
  • 2 replies
  • 1324 views
Hi all

I'm not able to read array of objects returned by a web method...whereas if the web method returns a single object its no problem...

can anyone please help

regards
Siva
This topic has been closed for replies.

2 replies

Participating Frequently
February 2, 2007
Try using the XPath API, it can really help you out here.
February 1, 2007
What kind of array do you try to return: Hashtable, Array, ArrayList.....?
What's your webService language(C#, VB.net...)?
Are you using Flash Remothing with SOAP or you call your method with REST??
sivanandAuthor
Participant
February 1, 2007
thanks for responding anonymous...

I'm returning array of my class from the webmethod...
This is how it looks in the webservice window of Flash 2004
<--results : ArrayOfProperty(Array)[Optional]
<---:Property (object)
<---progId:string(string)[Optional]
<---propId....
Property is my class and the web method returns array of this class...
The webservice is written in C# and i'm using webservice class in actionscript.
Here is what i'm doing..

import mx.services.WebService;
var sWSDL_ProgressiveManager:String =" http://10.11.6.62/PPE_WebServices/ProgressiveManager.asmx?wsdl";
var wsProgressiveManager:WebService = new WebService(sWSDL_ProgressiveManager);

function GetAllProperties()
{
var oResponse:Object;
oResponse = wsProgressiveManager.getAllProperties();
oResponse.onResult = function(result):Void
{
trace(result.length);
}
oResponse.onFault = function(fault):Void
{
trace(fault.faultstring);
}
}


thanks anonymous.....
February 2, 2007
Flash Remothing need serialization of data to properly transmit value to the Flash player. ICollection, object[] works for an indexed array and HashTable, IDictionnary works for an associative array. To create a flash object use FlashGateway.IO.ASObject. Sometimes you may experience problems with custom type or complex class but you said that everything work for a single object ... so your problem is not that.

Sometime serialization doesn't do the job perfectly and can return object instead of an array. This can append when you pass a milting pot of data type:
// original array
[someValue, someValue]

// return object(property are the indexes)
{0 : someValue
1: someValue}


try to do a for .. in loop to check out all property return by your web method, something like that in a recursive method :

for(var x in yourObj){
trace("prop:"+x+" value:"+yourObj);
}

your actionscript is probably correct but it's only on the serialization of data in your webService... look from this point. Try to write in a file your return array(in C#)

in hope this may help you!!