0

我正在尝试将 Spring 安全性中的级联异常作为 Spring Web 服务中的肥皂故障的解决方案。

我们使用 Spring Web 服务并使用SimplePlainTextPasswordValidationCallbackHandler. 但是,spring security 中的所有自定义异常都会在soap响应中作为“Invalid Soap Header”输出。这是相信是默认行为。

有什么方法可以覆盖此行为以将我们自定义的异常级联到 Spring WS?

谢谢。

4

1 回答 1

0

为此,您需要实现 EndpointExceptionResolver,因为 XwsSecurityInterceptor 的 handleValidationException 方法将异常委托给此解析器,如此此处所述。或者您可以像这样简单地将 SoapFaultMappingExceptionResolver 添加到您的 applicationContext.xml 中:

<beans>
<bean id="exceptionResolver" class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
    <property name="defaultFault" value="SERVER"/>
    <property name="exceptionMappings">
        <value>
            org.springframework.oxm.ValidationFailureException=CLIENT,Oops!Something went wrong
        </value>
    </property>
</bean>
</beans>

更多信息在这里

于 2012-04-21T22:33:18.817 回答