2009 Oct 23 9:54 AM
Hi all,
is there a way to catch the error code returned by a BSP page?
For example, I have a Flex HTTPService that points to a BSP page somedata.xml, which is populated after retrieving data in onInitialization handler.
In this handler, if something goes wrong, I set up the response error code like this:
try.
"Data Handler Class
catch zcx_some_exc into lx_some_exc.
error_string = lx_some_exc->get_text( ).
response->set_status( code = 500 reason = error_string ).
endtry.
In my faultHandler function in Flex, I need to display error_string in an Alert box:
private function HTTPFaultEventHandler(event:FaultEvent):void{
Alert.show(event.fault.faultString);
}
But in this way, it always display "HTTP Request error".
Anyone can help me?
Thanks a lot,
R.
2009 Oct 26 5:39 AM
This is a known issue with flex HTTPService.
what you could do is
set the status to 200 for BSP response
and pass the error message in xml format.
on the flex side, in your result handler, check the xml to see whether its error xml or your normal result xml.
if its error xml, you can provide an alert and then stop processing.
Ref: http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application
Regards
Raja
2009 Oct 26 5:39 AM
This is a known issue with flex HTTPService.
what you could do is
set the status to 200 for BSP response
and pass the error message in xml format.
on the flex side, in your result handler, check the xml to see whether its error xml or your normal result xml.
if its error xml, you can provide an alert and then stop processing.
Ref: http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application
Regards
Raja
2009 Oct 26 4:29 PM
Hi Durairaj,
thanks for the hint.
This is how I'm doing already, I'd not have the time to investigate why it did not work and I have used this workaround.
So, if I've understood well, currently there's no other way to catch http error codes.
I've read about this project: http://code.google.com/p/as3httpclientlib/
Did you ever tried it?
Thanks a lot,
R.
2009 Oct 27 4:43 AM
So, if I've understood well, currently there's no other way to catch http error codes.
With HTTPService - yes. but you could use URLLoader class if handling HTTP status code is important
i have seen http://code.google.com/p/as3httpclientlib/ but yet to try it.
Regards
Raja