我是Web服务的新手,执行以下命令行时出错:
java -mx1024m -Djava.ext.dirs=workspace/extdirs/remap:/home/amira/workspace/extdirs/axis2 org.apache.axis2.wsdl.WSDL2Java -o . -p fr.srd.impressions.pologne.XXXX -S . -s -d xmlbeans --noBuildXML -ep org,org.w3,org.xmlsoap -uri schema/XXXXXPackageXmlServices.wsdl -xsdconfig schema/XXXXXPackageXmlServices.xsdconfig
以下是我收到的错误消息:
Retrieving document at 'schema/XXXXPackageXmlServices.wsdl'.
Retrieving schema at 'https://XXXXservicesdemo.XXXX.com.pl/XXXXPackageXmlServicesService/XXXXPackageXmlServices?xsd=1', relative to 'file:/home/amira/workspace/srd/impressions/etiquettes/pologne/XXXX/schema/XXXXPackageXmlServices.wsdl'.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:178)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.wsdl.WSDLException: WSDLException (at /definitions/types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'https://XXXXservicesdemo.XXXX.com.pl/XXXXPackageXmlServicesService/XXXXPackageXmlServices?xsd=1', relative to 'file:/home/amira/workspace/srd/impressions/etiquettes/pologne/XXXX/schema/XXXXPackageXmlServices.wsdl'.: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching dpdservicesdemo.XXXX.com.pl found
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 com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:320)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:133)
... 2 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching dpdservicesdemo.XXXX.com.pl found
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1836)
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:1337)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:154)
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:966)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1262)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1289)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1273)
at 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(HttpURLConnection.java:1296)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1035)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
... 13 more
Caused by: java.security.cert.CertificateException: No name matching dpdservicesdemo.XXXX.com.pl found
at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:208)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:93)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:347)
amira@amira:~/workspace/srd/impressions/etiquettes/pologne/XXXX$ java -mx1024m -Djava.ext.dirs=/home/amira/workspace/extdirs/common:/home/amira/workspace/extdirs/vaadin:/home/amira/workspace/extdirs/remap:/home/amira/workspace/extdirs/axis2 org.apache.axis2.wsdl.WSDL2Java -o . -p fr.srd.impressions.pologne.XXXX -S . -s -d xmlbeans --noBuildXML -ep org,org.w3,org.xmlsoap -uri schema/XXXXXPackageXmlServices.wsdl -xsdconfig schema/XXXXXPackageXmlServices.xsdcon
答案 0 :(得分:1)
使用以下代码绕过证书检查
TrustManager [] trustAllCerts = {new X509TrustManager(){
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
} };
SSLContext sc = SSLContext.getInstance("SSL");
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
};
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);