Do you need the fault handler on the operation? I typically a single fault handler for all operations. I also use a single handler for all results as well, actually. I don't like using responders.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Todd Sent: Thursday, October 16, 2008 12:37 PM To: [email protected] Subject: [flexcoders] Re: WebService operation faults propigating up to WebService fault handler. I'll bounce this back up as it's hard to find any source code samples using the Actionscript version of WebService, and properly handling all the different errors, etc... Thanks, --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Todd" <[EMAIL PROTECTED]> wrote: > > Hello All, > I have a problem that I can't figure out. With WebService faults, > and operations that return SOAPFaults...read on for the detais. > > 1) I've created my WebService through ActionScript (not the MXML > Component). > var ws:WebService = new WebService(); > > 2) I've attached a fault listener to it. I had to do this because > it seems that SOAPEncoder errors were never being caught otherwise. > ws.addEventListener(FaultEvent.FAULT, onServiceFault) > > 3) I'm using a Cairngorm Command/ServiceDelegate calling scheme. > For example, to call getInvoices, I have a command that calls into the > appropriate method on the ServiceDelegate called getInvoices, which > looks like: > public function getInvoices(params:Object):void{ > Operation(ws.SearchInvoices).encoder.strictNillability = true; > var token:AsyncToken = ws.SearchInvoices(params); > token.addResponder(this.responder); > } > > As you can see, I'm using the AsyncToken, and adding the Commmand as > the responder. The Command has both fault and result handlers as > defined by the IResponder interface. > > 4) The this.responder is set during the contstructor of the > Service Delegate, like so: > public function ServiceDelegate(responder:IResponder) > { > this.responder = responder; > } > > So, now my problem is, that when a SOAPFault is raised in the call to > the SearchInvoices WebService operation, both the FAULT on my Command > (which is the responder), AND the fault (onServiceFault ) for the > WebService definition. > > I'd really rather not have this happen, but can't really figure out > exactly what's going on. ALSO, I had to add the fault handler to the > WebService because we were having all sorts of SOAPEncoder errors that > were never being raised. > > What's someone to do? Is it that since I'm using the AsyncResponder > to handle for the result/fault, that the WebService is never notified > that the Fault has already been handled? What's the proper design > around this? Is there a way to set the status that the Fault's been > handled? It almost seems like the fault is being raised twice. > > Thanks, > Todd >

