views:

36

answers:

1

Hi folks,

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

A: 

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).

Sam
Thanks Sam, that's great info. I guess we'll have to change the webservice to send 201 responses with the error XML. Not ideal but it will work.
Dave T