> Interesting. Is that a legit use of SAAJ - to add a Fault to a message,
> and then throw away the message, and just use the fault to construct a
> SOAPFaultException - which ends up getting serialized to a different
> SOAP message?
I hope so. :) Actually, in the RI code where the handlers are called, if
a handler throws a ProtocolException then this is exactly what I do -- I
throw away the header and any body contents, then use the body and add
fault elements to it. No use creating a whole new message object when
the old one can just be changed.
>
> This approach works inside a handler where the MessageContext can be
> cast so SOAPMessageContext, but inside the endpoint, that produces a
> class cast exception.
I'm not sure what happens at the endpoint, but in the handlers at least
you should always get a SAAJ SOAPMessage so this is ok. Maybe Jitu can
comment again about the endpoint case.
Cheers,
Bobby