我正在尝试使用在URL中使用HTTPS的WSDL(https://dpdmsdmmk1.fmr.com:12210/cmis/services/RepositoryService?wsdl)生成(SOAP)Web服务客户端类。
Paste_WSDL_Below:https://dpdmsdmmk1.fmr.com:12210/cmis/services/RepositoryService?wsdl
路径1:从命令提示符wsimport -d C:\ Users \ A550857 \ Desktop \ Jay -extension -keep -p com.gatewayedi.ws -XadditionalHeaders Paste_WSDL_Below
命令提示符响应:
解析WSDL ...
[错误] sun.security.validator.ValidatorException:PKIX路径构建失败:su n.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效身份验证路径
无法读取WSDL文档:Paste_WSDL_Below,因为1)找不到文档; / 2)文件无法阅读; 3)文档的根元素不是。
[ERROR] failed.noservice =在提供的WSDL中找不到wsdl:service:
至少需要提供一个至少具有一个服务定义的WSDL。
无法解析WSDL。
Trail 2:从命令提示符
{C:\ Users \ A550857 \ Desktop \ Jay \ Softs \ axis2-1.6.2 \ bin> wsdl2java.bat -uri Paste_WSDL_Below
命令提示符响应:
使用AXIS2_HOME:C:\ Users \ A550857 \ Desktop \ Jay \ Softs \ axis2-1.6.2使用JAVA_HOME:C:\ Program Files(x86)\ Java \ jdk1.7.0_03 log4j:WARN无法找到appender for logger(org.apache.axis2.i18n.Project ResourceBundle)。 log4j:WARN请正确初始化log4j系统。线程" main"中的例外情况org.apache.axis2.wsdl.codegen.CodeGenerationException:解析WSDL时出错 在org.apache.axis2.wsdl.codegen.CodeGenerationEngine。(CodeGenerat ionEngine.java:181) 在org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) 在org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)引起:javax.net.ssl.SSLHandshakeException:sun.security.validator.Validator异常:PKIX路径构建失败:sun.security.provider。 certpath.SunCertPath BuilderException:无法找到所请求目标的有效证书路径 at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) 在sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868) 在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) 在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1337) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav a:154) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) 在sun.security.ssl.Handshaker.process_record(Handshaker.java:804) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305) 在sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:523) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1296) 在java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Htt psURLConnectionImpl.java:338) 在org.apache.axis2.wsdl.codegen.CodeGenerationEngine。(CodeGenerat ionEngine.java:99) ... 2更多引起:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的vali d证书路径 在sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.jav a:292) at sun.security.validator.Validator.validate(Validator.java:260) at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.j ava:326) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerIm pl.java:231) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustMan agerImpl.java:126) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1319) ... 15更多引起:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径 at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCert PathBuilder.java:196) 在java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) ... 21更多}
我正在使用的环境:Axis2-1.6.2,Java7,WSDL:Paste_WSDL_Below
Pl建议这个。我能够在浏览器中查看具有适当内容的WSDL。
答案 0 :(得分:2)
您有两种选择:
1)将服务器证书导入jdk的信任库 (样本:http://www.coderanch.com/t/134619/Security/JDK-trust-Certificate)。您正在获得异常,因为您的JDK不信任服务器证书。
2)将wsdl下载到本地驱动器,包括引用的xsd文件(如果存在),然后向本地wsdl运行wsimport,而不是从https-page运行wsdl。
我做第二种方法,因为它更简单。