Reputation: 4361
spring web services (spring-ws) has a default SimpleSoapExceptionResolver which will return any unhandled exceptions to the client as a SOAP fault. This is good.
However, i would also like it to log the exception on the server so we have visibility to support the service.
SimpleSoapExceptionResolver via AbstractEndpointExceptionResolver has a property that can be set to enable logging (setWarnLogCategory).
How can i get a handle on the instance of SimpleSoapExceptionResolver that the framework creates in order to set the warnLogCategory property?
Thanks, Dan.
Upvotes: 1
Views: 5249
Reputation: 4361
Here is one possibility, to use container injection to get a handle on it in a single use bean
There must be a way to do it without having to create java classes whole sole purpose is to configure a spring bean.
@Named public class ConfigurationBean {
@Inject SoapFaultAnnotationExceptionResolver resolver;
@PostConstruct public void initialise() {
resolver.setWarnLogCategory("Dingbats");
}
}
Upvotes: 1
Reputation: 4048
The reference documentation says:
Endpoint exception resolvers are automatically picked up by the MessageDispatcher, so no explicit configuration is necessary.
So just instantiate the class and set the property:
<bean id="exceptionResolver" class="org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver">
<property name="warnLogCategory" value="com.mycompany.category"/>
</bean>
Upvotes: 2