我正在尝试在https webservice上运行wsdl2java命令,但是我得到了这个例外:
C:\axis2-1.6.2\bin>wsdl2java.bat -uri https://myserver.ad:8443/PAS/services/WSCentralService?wsdl
Using AXIS2_HOME: C:\axis2-1.6.2
Using JAVA_HOME: C:\Program Files\Java\jdk1.7.0_21
log4j:WARN No appenders could be found for logger (org.apache.axis2.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:181)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1886)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:515)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:99)
... 2 more
Caused by: java.security.cert.CertificateException: No subject alternative names present
at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:142)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:91)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:347)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:203)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1323)
... 15 more
我运行了keytool命令来导入/导出myserver url的证书,但是,我仍然收到此错误!
请帮助!
感谢。
答案 0 :(得分:0)
我不熟悉wsdl2java,但是如果您对其他选项持开放态度,请考虑尝试Apache's XMLBeans。 使用scomp (Schema Compiler),您可以从Web服务WSDL URL生成Java类。
例如,你可以运行:scomp -dl schema -src [generated source folder name] -out [generated jar name].jar [WSDL URL] -compiler C:\Java\jdk1.7.0_13\bin\javac.exe
该命令将采用您提供的[WSDL URL]
,生成包含java源文件和.jar的文件夹。
当然,你必须将它指向你的java安装路径。
答案 1 :(得分:0)
我再次运行keytool之后使用了Axis 1.4,但这一次我指向了HAVA_HOME \ jre \ lib \ security \ cacerts
上存在的密钥库cacerts我将web服务保存到asix 1.4主文件夹\ lib
中的WSCentralService.wsdl然后我运行Axis命令:
java -classpath activation.jar;mailapi.jar;axis.jar;jaxrpc.jar;saaj.jar;commons-logging-1.0.4.jar;commons-discovery-0.2.jar;wsdl4j-1.5.1.jar;log4j-1.2.8.jar org.apache.axis.wsdl.WSDL2Java -s WSCentralService.wsdl