关于disableCNCheck选项的wsdl2java CXF命令行错误

发布于 2024-11-26 18:07:03 字数 521 浏览 2 评论 0原文

我正在使用 CXF wsdl2java 命令行工具在 https 连接下从 WSDL 生成 Java 类。 在生成过程中一切都很顺利,但是当我调用 WSDL 提供的服务之一时,我得到了这个异常:

java.io.IOException: The https URL hostname does not match the Common Name (CN) on the server certificate. To disable this check (NOT recommended for production) set the CXF client TLS configuration property "disableCNCheck" to true.

Is this disableCNCheck I can set during java Classs Generation?似乎不是,或者至少它不是 wsdl2java 的有效选项。

我是否必须在 wsdl 或我的(grails)应用程序中指定使用生成的 java 类的内容?

I'm using CXF wsdl2java command line tool to generate Java classes from a WSDL under https connection.
Everything goes fine during generation, but when i call one of the services offered by the WSDL I get this exception:

java.io.IOException: The https URL hostname does not match the Common Name (CN) on the server certificate. To disable this check (NOT recommended for production) set the CXF client TLS configuration property "disableCNCheck" to true.

Is this disableCNCheck something I can set during java classes generation? It seems not, or at least it's not a valid option for wsdl2java.

Is it something I have to specify in the wsdl or in my (grails) application, which uses the generated java classes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我入戏太深 2024-12-03 18:07:04

事实证明,这与生成时间无关,而是与运行时有关。

为了设置disableCNCheck标志,我这样做了:

protected void disableCNCheck(Object port) {
    Client client = ClientProxy.getClient(port)

    TLSClientParameters params = new TLSClientParameters()
    params.setDisableCNCheck(true)
    HTTPConduit httpConduit = (HTTPConduit) client?.getConduit()
    httpConduit?.setTlsClientParameters(params)
}

其中port是用于与SSL保护的API服务通信的对象。

It turns out that is not something about generation time, but runtime stuff.

To set the disableCNCheck flag, I did it this way:

protected void disableCNCheck(Object port) {
    Client client = ClientProxy.getClient(port)

    TLSClientParameters params = new TLSClientParameters()
    params.setDisableCNCheck(true)
    HTTPConduit httpConduit = (HTTPConduit) client?.getConduit()
    httpConduit?.setTlsClientParameters(params)
}

where port is the object used to talk with the SSL-protected API service.

┾廆蒐ゝ 2024-12-03 18:07:04

我通过将以下 xml 配置添加到 grails-app/conf/spring/resources.xml [ Grails 2.2.3 , cxf-client 插件 1.6.1] 来实现disableCNCheck

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:http="http://cxf.apache.org/transports/http/configuration" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
            http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
      "> 

  <http:conduit name="*.http-conduit"> 
    <http:tlsClientParameters disableCNCheck="true" /> 
  </http:conduit> 

</beans> 

I got the disableCNCheck achieved by adding the below xml config to grails-app/conf/spring/resources.xml [ Grails 2.2.3 , cxf-client plugin 1.6.1]

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:http="http://cxf.apache.org/transports/http/configuration" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
            http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
      "> 

  <http:conduit name="*.http-conduit"> 
    <http:tlsClientParameters disableCNCheck="true" /> 
  </http:conduit> 

</beans> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文