ACTIONSCRIPT 3 - Does Actionscript expose the XML in a web service faultEvent? How can it be accessed?
العربية
български
català
中文
čeština
dansk
Nederlands
eesti
suomi
français
Deutsch
Ελληνικά
עברית
हिंदी
magyar
Bahasa Indonesia
italiano
日本語
한국어
latviešu
lietuvių
norsk
polski
Português
română
русский
slovenčina
slovenski
español
svenska
ไทย
Türkçe
українська
Tiếng Việt
I have a Flex 3 client interfacing to an RoR webservice for a POST request. When the webservice returns code 201 Created, Flex fires a resultEvent and everything is cool as I'm able to parse the XML response as you would expect.
However, when there is a problem with the data sent in a POST request, the webservice returns 422 and Flex thus fires a faultEvent. Along with the 422 code, the webservice also supplies a list of errors to be corrected by the user before resubmission. I can see these in Charles. An example is the following:
<errors>
<error>Username and password invalid</error>
</errors>
I need to be able to access this XML within Actionscript. For a resultEvent this is easily done using event.result. However, for a faultEvent I can't see any way of accessing the XML returned.
Does anyone know if this is possible? Or am I missing something patently obvious?
Thanks in advance,
Dave
Answer |
Basically Flash can only expose data provided to it by the browser. Browsers have this data but don't forward it to plugins (or at least didn't, see below).
This is covered in the following Flex bug:
https://bugs.adobe.com/jira/browse/SDK-11841
This is fixed in Firefox 3.1 with FP10. I'm not sure exactly which Flex SDK version includes the fix. For it to work in other browsers, they each have to address the issue on their side (it affects all plugins, not just Flash).