5 Replies Latest reply on Feb 2, 2007 2:33 PM by foozebox

    Array of objects returned by a .NET web service

      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

        • 1. Re: Array of objects returned by a .NET web service
          anonymous thing Level 1
          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??
          • 2. Re: Array of objects returned by a .NET web service
            sivanand Level 1
            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)
            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 ="";
            var wsProgressiveManager:WebService = new WebService(sWSDL_ProgressiveManager);

            function GetAllProperties()
            var oResponse:Object;
            oResponse = wsProgressiveManager.getAllProperties();
            oResponse.onResult = function(result):Void
            oResponse.onFault = function(fault):Void

            thanks anonymous.....
            • 3. Re: Array of objects returned by a .NET web service
              anonymous thing Level 1
              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!!
              • 4. Re: Array of objects returned by a .NET web service
                sivanand Level 1
                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></signageIP><signagePort>11001</signagePort ><disabled>FALSE</disabled></Property>,<Property><propId>1</propId><corpId>NORTH</corpId>< propertyDesc>Harrah&apos;s East Property</propertyDesc><signageIP></signageIP><signagePort>8221</signagePort><d isabled>FALSE</disabled></Property>,<Property><propId>5</propId><corpId>NE</corpId><proper tyDesc>HARD ROCK NE</propertyDesc><signageIP></signageIP><signagePort>11001</signagePort><disabl ed>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...

                • 5. Re: Array of objects returned by a .NET web service
                  Try using the XPath API, it can really help you out here.