Hi all,

First of all , I'm new to flex. Already bought a few books but none
describes this issue in detail.

I'm having huge trouble accessing object arrays from SOAP.  I'm using
Flex Builder 3, Version: 3.0.190133, the last beta version.
I used the Import Web Services wizard to import
http://ws.marcocova.com/SOAP/af4.php?wsdl . My partner who writes the
SOAP code, has tried several approaches. In the approaches before the
current one, I couldn't even get a simple var, it would always come in
as null. Now I can get simple vars like strings or numbers, but I'm
unable to get Arrays.

Below is the code I'm using. At this moment when I debug I'm getting
the error:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
   at WSDL8_AF4/processResults()[F:\Para_Novo_CD\BACKUPS\My
Documents\Flex Builder 3\WSDL8_AF4\src\WSDL8_AF4.mxml:32]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at
com.marcocova::ExampleService/_getPeopleByFirstLastName_populate_results()[F:\Para_Novo_CD\BACKUPS\My
Documents\Flex Builder
3\WSDL8_AF4\src\com\marcocova\ExampleService.as:147]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at
com.marcocova::BaseExampleService/processResult()[F:\Para_Novo_CD\BACKUPS\My
Documents\Flex Builder
3\WSDL8_AF4\src\com\marcocova\BaseExampleService.as:207]
   at
mx.rpc::AsyncResponder/result()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AsyncResponder.as:73]
   at
mx.rpc::AsyncRequest/acknowledge()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:81]
   at
DirectHTTPMessageResponder/completeHandler()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:387]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at flash.net::URLLoader/onComplete()


Can someone who understands this, please help me? I've been around
this issue for one week without results... Already checked the posts
on the list, since 14/11/2007.

Thanks in advance.

Telmo Dias



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" initialize="getResults()">
   <mx:Script>
       <![CDATA[
           import com.marcocova.*; //classes resultant from the wizard
           import mx.collections.ArrayCollection;
           import mx.utils.ArrayUtil;
                     public function getResults():void{
               var myService:ExampleService = new ExampleService();
                 //* Step 2: for the desired operation add a result
handler (a function that you have already defined previously)        
        
myService.addgetPeopleByFirstLastNameEventListener(processResults);
                 //* Step 3: Call the operation as a method on the
service. Pass the right values as arguments:
                 myService.getPeopleByFirstLastName('*','*');
                           }
                     public function
processResults(res:GetPeopleByFirstLastNameResultEvent):void{
               trace(typeof res.result); //this outputs object
               for (var x in res.result){
                   trace(typeof x);//doesn't even trace once
               }
               var arrRes:ArrayCollection = res.result;
               var arrPerson:Array = arrRes.toArray();
               var pers:Person = Person(arrPerson[0]);
               trace(pers.firstName); //nothing either
           }
       ]]>
   </mx:Script>
</mx:Application> 

Reply via email to