Hi Telmo,
The client code looks ok. I understand you generated ExampleService
with Flex Builder import WSDL feature. I've reproduced your case and
got the same error.
I also created a simple client ant got a different error:
[SWF] Users:mykola:Documents:Flex Builder
3:SampleClient2:bin-debug:SampleClient2.swf - 973,882 bytes after
decompression
Error: Unrecognized binding style ''. Only 'document' and 'rpc' styles
are supported., details: null, trace: [RPC Fault
faultString="Unrecognized binding style ''. Only 'document' and 'rpc'
styles are supported." faultCode="EncodingError" faultDetail="null"]
at
mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()[E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as:713]
I would check the web service. Flex complains about SOAP binding
style. It should be JAX-RPC Encoded or Document Literal.
Here is my client
<pre>
import mx.rpc.events.FaultEvent;
import mx.rpc.soap.WebService;
import mx.rpc.events.ResultEvent;
import com.marcocova.ExampleService;
import com.marcocova.GetPeopleByFirstLastNameResultEvent;
public function getResults():void{
var ws:WebService = new WebService();
var wsdl:String = "http://ws.marcocova.com/SOAP/af4.php?wsdl";
ws.addEventListener(FaultEvent.FAULT, faultHandler);
ws.getPeopleByFirstLastName.addEventListener(ResultEvent.RESULT,
processResults);
ws.loadWSDL(wsdl);
ws.getPeopleByFirstLastName("*", "*");
// var ws:ExampleService = new ExampleService();
// ws.addExampleServiceFaultEventListener(faultHandler);
// ws.addgetPeopleByFirstLastNameEventListener(processResults);
// ws.getPeopleByFirstLastName("*", "*");
}
public function
processResults(res:GetPeopleByFirstLastNameResultEvent):void {
trace("Res: " + res.result);
}
public function processResults2(res:ResultEvent):void {
trace("Res: " + res.result);
}
public function faultHandler(event:FaultEvent):void {
trace("Error: " + event.fault.faultString + ", details: " +
event.fault.faultDetail + ", trace: " +
event.fault.getStackTrace());
}
<pre>
- Mykola
--- In [email protected], "Telmo Dias" <[EMAIL PROTECTED]> wrote:
>
> 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>
>