如何在Spring WS中捕获NoEndpointFoundException

默认情况下,如果缺少适当的端点,MessageDispatcher.dispath()会引发NoEndpointFoundException,但是WebServiceMessageReceiverObjectSupport.handleConnection()只会隐藏异常。就我而言,我应该自己抓住它。

通过MessageDispatcher.getEndpointMappings().add()添加自定义EndpointMapping并引发异常是个好主意吗?

最佳答案

我发现以下解决方案:

@Component
@Order(Ordered.LOWEST_PRECEDENCE)
public class NoEndpointFoundEndpointMapping implements EndpointMapping {

    @Override
    public EndpointInvocationChain getEndpoint(MessageContext messageContext) throws Exception {

        throw new MyCustomException(...);
    }
}

关于java - 在Spring WS中捕获EndpointNotFound,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42203090/

10-12 22:21