Вопрос

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.

Это было полезно?

Решение 2

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"); 
  }
} 

Другие советы

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top