在 Spring WS 中捕获 EndpointNotFound
Catch EndpointNotFound in Spring WS
如何在 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(...);
}
}
如何在 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(...);
}
}