Hello!
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.
Sorry for the delay...
ad1) I think Spring-Ws doesn't seem to think that response interceptors should produce fault... Look at "org.springframework.ws.server.endpoint.intercepto r.AbstractValidatingInterceptor.handleResponseVali dationErrors(MessageContext, SAXParseException[])" - it doesn't throw an exception - it just returns false.
ad2) Please see https://github.com/grgrzybek/spring-...pring-ws-85762 - I've prepared an example for you. What I did:
- PayloadValidatingInterceptorWithException has ServiceFaultExceptionResolver injected
- PayloadValidatingInterceptorWithException.handleRe sponseValidationErrors() instead of throwing RuntimeException uses it to invoke resolveException(MessageContext, Object, Exception) on injected ServiceFaultExceptionResolver which fetches soapFault from MessageContext and customizes it
the result XML, when response validation occurs is:
Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">Unable to process the request; please contact support using Reference Id: test-id</faultstring>
<detail>
<ns2:my-fault xmlns:ns2="urn:test">
<ns2:fault-info>Unable to process the request; please contact support using Reference Id: test-id</ns2:fault-info>
<ns2:code>1000</ns2:code>
<ns2:date>2013-02-08T13:07:54.596+01:00</ns2:date>
<ns2:faultId>test-id</ns2:faultId>
</ns2:my-fault>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
best regards
Grzegorz Grzybek