I have web-service created and configured via Spring and CXF. See beans below:
<?xml version="1.0" encoding="UTF-8"?>
<beans <!-- ommited -->>
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="internalActService" class="package.InternalActServiceImpl" />
<jaxws:endpoint implementor="#internalActService" address="/InternalActService">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
<jaxws:outFaultInterceptors>
<bean class="package.InternalActServiceFaultOutInterceptor" />
</jaxws:outFaultInterceptors>
</jaxws:endpoint>
</beans>
As can you see I added schema validation to my web service. But CXF throws SoapFault when request is not corresponding with schema.
I want to send to the client SoapMessage instead of SoapFault, that’s why I added outFaultInterceptors.
My question is how to transform SoapFault to SoapMessage? I’ve made few tries but I don’t know how to implement outFaultInterceptor.
Probably you forgot to setup interceptor phase and its order in the interceptor chain.
Try something like this:
-EDIT-
Here is a unit test that works for me. It’s a little bit tricky to be able to send POJOs to the output. I suppose it can be much more simpler if constructing DOM by yourself.
Interceptor
Request/Response POJO
WebService
Spring Context: CxfInterceptorTest-context.xml
Unit Test