【发布时间】:2020-10-07 20:13:56
【问题描述】:
我有一个 spring 集成流程,我在其中监听通道并调用 SOAP WS 并将来自 WS 的响应放回传出通道
return IntegrationFlows.from(CHANNEL)
.<byte[], String>transform(String::new)
.handle(
Ws.simpleOutboundGateway(template)
.uri(webServiceUrl )
)
.<String, byte[]>transform(String::getBytes)
. // send out the output topic
.get();
@Bean
public WebServiceTemplate webServiceTemplate() {
WebServiceTemplate template = new WebServiceTemplate();
return template;
}
我将此流程用作集成测试的一部分,效果很好。
问题: 如果我在 SOAP WS 不可用的情况下运行测试,我会得到以下结果
原因:org.springframework.ws.client.WebServiceIOException:I/O错误:连接被拒绝:连接;嵌套异常是 java.net.ConnectException: Connection denied: connect 在 org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:561) ~[spring-ws-core-3.0.10.RELEASE.jar:na] 在 org.springframework.integration.ws.SimpleWebServiceOutboundGateway.doHandle(SimpleWebServiceOutboundGateway.java:120) ~[spring-integration-ws-5.3.2.RELEASE.jar:5.3.2.RELEASE] 在 org.springframework.integration.ws.AbstractWebServiceOutboundGateway.handleRequestMessage(AbstractWebServiceOutboundGateway.java:224) ~[spring-integration-ws-5.3.2.RELEASE.jar:5.3.2.RELEASE] 在 org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal
我如何在这个流程中捕获这些错误/错误,以及在soap base WS 响应中处理错误的最佳实践是什么 EX:服务不可用 SOAP 请求/响应错误 分机
【问题讨论】:
标签: spring-integration-dsl spring-integration-ws