You could implement a JAX-WS handler and add it to your client web service reference. This will be given opportunity to handle the request message and response message OR notified of a fault.
Create a SOAPHandler<SOAPMessageContext>
and your handleFault()
method will be passed the SOAPMessageContext
. From that you can getMessage().getSOAPBody().getFault()
to get the SOAPFault
, which contains getFaultCode()
and getDetail()
.
Assign your new fault handler to your web service ref. One way is via @HandlerChain
. It will be invoked prior to your catch
clause.