java - 当我尝试从 wsdl 生成客户端时出错

标签 java wsdl

我想从 wsdl 生成一个 java 客户端。

所以我创建了一个新项目,将 wsdl 导入到项目中,然后右键单击 -> Web 服务 -> 生成客户端。

所以这是我使用的选项:

enter image description here

然后点击鱼,我有这个错误:

IWAB0399E Error in generating Java from WSDL:  WSDLException (at /definitions/types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'https://edottotest.sanita.regione.rsr.rupar.puglia.it/nsisr/PianoAssistenzialeResidenzialeService?xsd=1', relative to 'file:/D:/Dropbox/workspace/Edotto/src/PianoAssistenzialeResidenzialeService.wsdl'.: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target: 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(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker.process_record(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.URLConnection.getContent(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContent(Unknown Source)
    at java.net.URL.getContent(Unknown Source)
    at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:516)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
    at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
    at java.lang.Thread.run(Unknown Source)
Caused by: 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.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Sour

最佳答案

您的 WSDL 导入一个带有 URL 的模式,该 URL 具有 https 地址方案。此错误表明您的 Java 安装不“信任”托管正在导入的此模式的服务器提供的证书。

你有几个选择:

  1. 将服务器的 CA 证书或服务器的实际证书导入您的信任库
  2. 将架构下载到本地位置并更改 WSDL 中的导入 url

我会推荐第二个选项,因为只要将 WSDL 和上述模式打包在一起,它的可移植性会稍微好一些。

关于java - 当我尝试从 wsdl 生成客户端时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30916265/

相关文章:

java - 集群中分布式事务和/或数据共享的Java解决方案

java - 可以返回什么类型而不是 null?

java - 无法处理安全风险模态弹出框

Android WSDL/SOAP 服务客户端

java - 通过 https 使用 Axis1

javascript - AngularJS 和 SpringMVC 在同一个项目中

java - java中图形对象居中

ios - Objective-C - SOAP 请求返回 WSDL 作为响应而不是正确的响应

javascript - 向 SOAP WSDL 发送请求

java - 向特定服务发送 SOAP 请求