It's just a standard servlet filter that changes the response code from
500 to 200. No XFire-specific code is needed if you just want to see
Java exceptions as SOAP faults on the client.
Once this filter is in place, Flash will process SOAP faults correctly
using its onFault handling mechanism.
Hope this helps,
Andrew
Roman Dolgov wrote:
Andrew,
Thanks for pointer.
Do you use XFire's fault handler or just servlet filter?
What exact exception do you throw? Some application specific or
XFireFault or something else?
(i.e. how exactly map message from exception to Flex's faultString or
whatever field is available on Flex side)
If you have any example it would be a great help.
Thanks again,
Roman
On 2/14/07, *Andrew Kerr* < [EMAIL PROTECTED] <mailto:ake [EMAIL PROTECTED]>>
wrote:
We've run into the same problem with Flash. It won't be your first,
believe me.
We got around this by writing a standard servlet filter that wraps the
servlet response object with its own implementation. The implementation
overrides the sendError and setStatus methods on the response class,
and
change the status code from 500 to 200 as necessary. Works like a
charm, and isn't specific to XFire (we needed this same hack for Axis as
well).
Hope this helps,
Andrew
Roman Dolgov wrote:
> Isn't it SOAP fault would be part of the body? (I am not that
deep into
> web services)
>
> I am trying to tweak status code because Adobe Flex manual have the
> following statement:
>
> "On web browsers, when a service returns any status code other
than 200,
> Adobe Flash Player
> cannot read the body of the response. If the status code is 500
and the
> body contains a
> fault, there is no way to get to the fault. The proxy works
around this
> issue by forcing the
> status code for faults to 200; the player passes the body of the
> response along with the
> fault intact. "
>
> (I cannot use flex proxy - it's requires additional server side
module I
> don't have)
>
> That kind of implies that fault is the part of the body, and body
cannot
> be read by Flash Player for any other code then 200.
>
> I don't expect any other clients use the same web service, so I don't
> really worry if SOAP response is 100% up to spec.
> That's why I try to figure out is there are any way to add some
handler
> or something else to have control over HTTP status code.
>
> Any ideas are very appreciated.
>
> Thank you,
> Roman
>
>
> On 2/14/07, *Tomek Sztelak* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>
> You can't. HTTP status code 500 is required by SOAP spec if
fault is
> returned ( as i remember :). But why you try to use SOAP
body? Some
> additional info can be added to SOAP faults.
>
> On 2/14/07, Roman Dolgov <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> <mailto: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> > wrote:
> > How to change HTTP response code from 500 to 200 in fault
handler?
> >
> > I'm trying to use fault mechanism to pass exception
details from
> XFire to
> > Adobe Flex WS client but cannot get access to SOAP body if
HTTP
> code more
> > then 200. So I want to add fault handle that would process my
> exception,
> > setup fault parameters and change HTTP status code to 200.
> >
> > It there any way I can do it? If yes, any code samples I can
> refer to?
> >
> > public class MyFaultHandler extends AbstractHandler {
> >
> > public void invoke(MessageContext context) throws
Exception {
> >
> > // context.getResponse.setStatus(200) ?????????
> >
> > }
> > }
> >
> > Thanks
> > Roman
> >
>
>
> --
> -----
> When one of our products stops working, we'll blame another
vendor
> within 24 hours.
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email