Hi,

Flash apparently fails to correctly parse a webservice function that
returns a class/Object/Struct (Using Csharp to create the webservice).

The following is returned from the service when hitting it in IE and is
perfectly fine.

<?xml version="1.0" encoding="utf-8" ?> 
<WsReply xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://XXX/";>
        
        <type>ArrayOfString</type> 
        <ArrayOfString>
                <string>feild1</string> 
                <string>feild2</string> 
        </ArrayOfString>
         
</WsReply>

The reply is equal to a class/Object with the name "WsReply" with two
public fields one called "type" which is of type string and the second
"ArrayOfString" which is an array of strings.

But when the reply is parsed by Flash (mx.services.WebService) it looses
the values inside the array even though the array is correctly populated
with two fields (And it is a real array).

When I do a for...in trace on the onResult object I get the following

ArrayOfString: undefined,undefined
type: ArrayOfString

Anyone know why this is happening? When I read the Webservice
documentation it seems like flash should support classes/Objects as a
webservice return type???

Thanks a lot in advance
Martin Baltzer

Heres my very simple code for reference:)

/****************************************
import mx.services.Log;
import mx.services.WebService;

class dk.xxx.test.TestWS {


   public function TestWS() {
                
                
        var wsLog:Log = new Log(Log.NONE);
        wsLog.onLog = function(txt) {
                trace("wsLog:" + txt);
                        
        };
                
        var myService:WebService = new
WebService("http://XXXX.com/Service.asmx?WSDL";, wsLog);

                
        myService.onFault = function(fault)
        {
            // Your code here.
                var s: String = "";
                for (var x:String in fault){
                        s += "\n" + x +": " + fault[x];
                }
                trace("fault:" + s);
        };
                
                
        var serviceCall = myService.getTest();
        serviceCall.onResult = function(result:Object) {
                var s: String = "";
                for (var x:String in result){
                        s += "\n" + x +  ": " + result[x];
                }
                trace(s);
                        
                        
        };
                
   }    
}

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to