【问题标题】:Spring Integration WS outbound gateway SSLSpring Integration WS 出站网关 SSL
【发布时间】:2019-01-18 13:45:47
【问题描述】:

我们有一个外部的肥皂服务和以下工作

<bean id="WSACallbackKlen" class="nbr.ei.util.LctionCallback">
        <constructor-arg index="0" value="http://serviations.bnst.n/toezicht/ka/km/KkService/tnRequest"></constructor-arg>
        <constructor-arg index="1" value="http://servtions.bnst.n.tst.st3/toet/ka/km/Kervice"></constructor-arg>
    </bean> 
    <int:chain input-channel="kkChannel" output-channel="dest-channel">
        <ws:header-enricher>       
            <ws:soap-action value="http://servicons.belt.n/toet/ka/kk/KKserice/tnRequest"/>
        </ws:header-enricher>           
        <ws:outbound-gateway uri="http://bb-k1.ts.nst.n/wsb/router" request-callback="WSACallbackKlen" message-sender="kkMsageSender"/>
    </int:chain> 

它已变得安全,因此更新了出站网关中的 uri uri="https://bb-k1.ts.nst.n/wsb/router"

使用 spring 上下文进行集成测试时出错 -

org.springframework.ws.client.WebServiceIOException: I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:561)
at org.springframework.integration.ws.SimpleWebServiceOutboundGateway.doHandle(SimpleWebServiceOutboundGateway.java:98)
..

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1964)

如何为 https 类型创建 ws:outbound-gateway 工作?如果需要,我不知道如何指定证书

【问题讨论】:

  • &gt;I tried message-factory, but getting error. - 编辑问题以显示配置和您看到的实际异常。

标签: spring-integration


【解决方案1】:

要在客户端处理 SSL,您需要使用 HttpsUrlConnectionMessageSenderHttpComponentsMessageSender 并且在 cacerts 存储中确实有适当的客户端证书。

请参阅https://www.baeldung.com/java-ssl 了解更多信息。

您还可以从 Spring WS 文档中借用一些信息:https://docs.spring.io/spring-ws/docs/3.0.4.RELEASE/reference/#security

从 Spring 集成的角度来看,没有什么特别的事情要做。

【讨论】:

  • 谢谢。使用 cmd 作为管理员向 cacert [of jre] 添加了证书。必须看看如何为 HttpComponentsMessageSender 指定抢占式身份验证
猜你喜欢
  • 1970-01-01
  • 2016-05-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多