add an interceptor to the CXF fault chain

<jaxws:endpoint address="/my/endpoint">
  <jaxws:implementor>
    <bean class="ca.intelliware.sample.webservice.QueryFulfiller" />
  </jaxws:implementor>
  <jaxws:outFaultInterceptors>
    <bean class="ca.intelliware.sample.webservice.CustomSoap11FaultOutInterceptor" />
  </jaxws:outFaultInterceptors>
</jaxws:endpoint>



public class CustomSoap11FaultOutInterceptor extends AbstractSoapInterceptor {

    public CustomSoap11FaultOutInterceptor() {
        super(Phase.MARSHAL);
    }

    public void handleMessage(SoapMessage message) throws Fault {
        Fault fault = (Fault) message.getContent(Exception.class);
        fault.setDetail(createDetailSomehow());
    }

    [...]
}

猜你喜欢

转载自xiatianyu-22.iteye.com/blog/2386378
CXF
Add