Jan 23rd, 2013, 10:59 AM
FaultResolver not get called if Response schema validation fails in spring-ws-2.1.0
Recently We have migrated our spring web service libraries from 2.0 to 2.1. After migratation, Our application unable to generate soap fault if response schema validation fails. Here is how we have implemented this:
1. We have PayloadValidatingInterceptorWithException class which extends PayloadValidatingInterceptor. Here we have overriden handleRequestValidationErrors and handleResponseValidationErrors methods and we are throwing our own runtime exception from both methods - Always.
2. We have ServiceFaultExceptionResolver class which extends SimpleSoapExceptionResolver and have overriden customizeFault where we create fault through marshaller object
Now in 2.0 Version, dispatch method of MessageDispatcher class has one single try block for all the code - i.e. both interceptor.handleRequst and interceptor.handleResponse are in same try and if any exception thrown from these methods then processEndpointException method will get called from catch block and this processEndpointException method is resposible for calling all the SimpleSoapExceptionResolver and generate the fault. - So all is well and our application is used to generate fault for both request and response schema validation.
But in 2.1 Version, dispatch method of MessageDispatcher class has two try block - one for interceptor.handleRequst and another for interceptor.handleResponse. Now the catch block for request one calls processEndpointException but catch block for response one does not call - it only calls triggerAfterCompletion which is meant for resource cleanup. Now that is why presently our application generates soap fault if request schema fails but it does not generate soap fault if response schema validation fails - I mean control does not go to customizeFault method of ServiceFaultExceptionResolver.
So I have following questions:
1. May I know why do we have different try in v 2.1 for request and response or why the second catch does not call processEndpointException ?
2. How can I resolve my problem with 2.1 ? That is I need to invoke customizeFault method of ServiceFaultExceptionResolver for response schema validation failure scenario also.
Last edited by Subhajit Raha; Jan 25th, 2013 at 02:44 PM.
Tags for this Thread