2011-07-29 10 views
0

私は、CXF wsdl2javaコマンドラインツールを使用して、https接続下のWSDLからJavaクラスを生成しています。私はこの例外を取得するWSDLが提供するサービスのいずれかを呼び出すとき すべては生成時に罰金行く、しかし:wsdl2java disableCNCheckオプションに関するCXFコマンドラインエラー

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. 

このdisableCNCheckは、私は、Javaクラスの生成時に設定することができるものですか?少なくとも、wsdl2javaの有効なオプションではないようです。

wsdlまたは生成されたJavaクラスを使用するmy(grails)アプリケーションで指定する必要がありますか?

答えて

3

これは世代時間ではなく実行時のものであることが判明しました。

がdisableCNCheckフラグを設定するには、私はそれをこのように行った:ポートはSSLで保護されたAPIサービスと話をするために使用するオブジェクトです

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) 
} 

0

私はdisableCNCheckはGrailsのアプリ/ confに/春/ resources.xmlのに以下のXML設定を追加することによって達成だ[Grailsの2.2.3、CXFクライアントプラグイン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> 
+0

どうやらそこにあります私はプラグイン注入ポート豆を使用していなかったので、私はテストできなかったプラグインの新しいバージョンで追加された設定パラメータ。 https://github.com/Grails-Plugin-Consortium/grails-cxf-client#setting-secure-socket-protocol –

関連する問題