all groups > flash actionscript > february 2007 >
You're in the

flash actionscript

group:

Array of objects returned by a .NET web service


Array of objects returned by a .NET web service sivanand
2/1/2007 8:44:42 PM
flash actionscript:
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
Re: Array of objects returned by a .NET web service anonymous thing
2/1/2007 9:27:25 PM
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??

Re: Array of objects returned by a .NET web service sivanand
2/1/2007 9:54:32 PM
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]
<---[n]: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.....
Re: Array of objects returned by a .NET web service anonymous thing
2/2/2007 8:58:11 PM
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[x]);
}

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!!
Re: Array of objects returned by a .NET web service sivanand
2/2/2007 9:58:40 PM
thanks Anonymous....

this is what i got...when i tried your way

prop:arrayType value:[object Object]
prop:sCall value:[object Object]
prop:xmlNodes
value:<Property><propId>G</propId><corpId>GS</corpId><propertyDesc>Gennady
Soliterman</propertyDesc><signageIP>10.11.6.65</signageIP><signagePort>11001</si
gnagePort><disabled>FALSE</disabled></Property>,<Property><propId>1</propId><cor
pId>NORTH</corpId><propertyDesc>Harrah&apos;s East
Property</propertyDesc><signageIP>10.11.6.62</signageIP><signagePort>8221</signa
gePort><disabled>FALSE</disabled></Property>,<Property><propId>5</propId><corpId
[quoted text, click to view]
NE</propertyDesc><signageIP>10.11.6.62</signageIP><signagePort>11001</signagePor
t><disabled>FALSE</disabled></Property>

i guess i have to play with the xmlNodes by serializing it to xml object and
read its child nodes...

thanks a lot...

regards
Siva

Re: Array of objects returned by a .NET web service foozebox
2/2/2007 10:33:44 PM
AddThis Social Bookmark Button