I use SpringWS for my soap service and validate it like this;
<sws:interceptors>
<bean id="payloadValidatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schema" value="/schemas/my.xsd"/>
<property name="validateRequest" value="false"/>
<property name="validateResponse" value="true"/>
</bean>
@PayloadRoot(namespace = NAMESPACE, localPart = "ServiceProvider")
@ResponsePayload
public ServiceProviderTxn getAccountDetails(@RequestPayload ServiceProviderrequest)
{ ...}
This works fine but when there is an error it returns a spring generated error response before it reaches to the endpoint, so I never have a chance to process them. But I want to be able to log and save the full error message to database. One way I found out is to do something like this in my other question;
Spring WS How to get all error messages when validation fails
But it does not work as I want.
you can extend
PayloadValidationInterceptor
and redefine the methodIf you look at the standard implementation (available here) you can see how it dumps all the parsing errors; you can also dump the incoming message since you have access to messageContext and its getRequest() method. Your class xould be something like