Ssl WSClient可以';无法在https上连接exchange wsdl

Ssl WSClient可以';无法在https上连接exchange wsdl,ssl,groovy,wsdl,webservice-client,exchange-server,Ssl,Groovy,Wsdl,Webservice Client,Exchange Server,我试图与groovy WSClient连接到Exchange服务器wsdl,但无法连接,因为我收到一个空文件(当我想要解析wsdl时)。 我使用的是以下几行: Map mapClient=[ "https.truststore":"/path/jssecacerts", "https.truststore.pass":"changeit", "https.keystore":"

我试图与groovy WSClient连接到Exchange服务器wsdl,但无法连接,因为我收到一个空文件(当我想要解析wsdl时)。 我使用的是以下几行:

Map mapClient=[
                    "https.truststore":"/path/jssecacerts",
                    "https.truststore.pass":"changeit",
                    "https.keystore":"/path/cacerts",
                    "https.keystore.pass":"changeit"
    ]

    def proxy=new WSClient("https://mail.exchangeserver:443/ews/services.wsdl", this.class.classLoader)
    proxy.setSSLProperties(mapClient)
    proxy.setBasicAuthentication("user","password")
    proxy.initialize()
它在proxy.initialize()上基本上失败,因为空文件上存在xml解析错误。 但是,当我使用浏览器时,我拥有完整的wsdl文件

这不是SSL握手,因为我已经为它工作了几个小时。这是我犯的第一个错误

我认为这是出于某种原因错误的基本验证。我这样说的原因是:我可以注释掉身份验证行,我得到了相同的结果


有什么提示吗?

好的,我从另一个论坛得到了答案。 这是ApacheCXF(groovy WSClient的后端)的已知限制,它仅在使用webservice时使用凭据,而在获取wsdl时不使用凭据! 解决方法是在本地加载wsdl,并使用以下方法构建WSClient:

new WSClient(this.class.classLoader.getResource("services.wsdl").toExternalForm(), 
             this.class.classLoader)
对于那些使用ExchangeWebService的用户来说,它还没有完成!您还需要修复一些错误:

  • 将messages.xsd和types.xsd与services.wsdl一起下载
  • 修复types.xsd并替换该行

    <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
    
    
    


最后修复services.wsdl,添加wsdl:service标记

  <wsdl:service name="ExchangeWebService">
     <wsdl:port name="ExchangeWebPort" binding="tns:ExchangeServiceBinding">
         <soap:address location="https://myserver/EWS/exchange.asmx" />
     </wsdl:port>
  </wsdl:service>


就这样,它现在应该正确初始化了

您使用的是什么版本的WSClient和Groovy?
  <wsdl:service name="ExchangeWebService">
     <wsdl:port name="ExchangeWebPort" binding="tns:ExchangeServiceBinding">
         <soap:address location="https://myserver/EWS/exchange.asmx" />
     </wsdl:port>
  </wsdl:service>