Expand my Community achievements bar.

Error handling in generated stubs

Avatar

Level 1
Hello,



I've been playing around with Flex Builder 3 and WS and I am
puzzled by how one can handle generic SOAP error messages (i.e. not
the service faults, but connection errors, message parsing related
errors, etc.).



Here is what I try:



1 Generate service stubs out of an existing WSDL using Flex
Builder

2 Create a dead simple Flex app that makes a WS call via
stubs

3 Trying to call an unreliable WS, and I get Flash popup
with the stack trace:


quote:





TypeError: Error #1090: XML parser failure: element is
malformed.

at
mx.rpc.soap::SOAPDecoder/decodeResponse()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\soap\SOAPDecoder.as:234]

at com.ws::BaseLookupService/processResult()[C:\Documents
and Settings\ws\My Documents\Flex Builder
3\FlexClient\services\lookup\com\ws\BaseLookupService.as:237]

at
mx.rpc::AsyncResponder/result()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncResponder.as:84]

at
mx.rpc::AsyncRequest/acknowledge()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]

at
DirectHTTPMessageResponder/completeHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:381]

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at flash.net::URLLoader/onComplete()







It looks like neither registering fault handler nor adding
event listener to the AsyncToken catches this error.



Does anyone know if I should I be modifying the generated
stubs to catch this kind of errors or there is a more elegant
approach to fix this? Thanks.
0 Replies