简体   繁体   中英

How to generate jax ws artifacts from wsdl over ssl

I need generate jax ws artifacts from wsdl for my jaxws client My code as follows:

String keystore = "D:\\mycert/mr.jks";
String storepass = "changeit";
String storetype = "JKS";

String[][] props = {
    {"javax.net.ssl.trustStore", keystore},
    {"javax.net.ssl.keyStore", keystore},
    {"javax.net.ssl.keyStorePassword", storepass},
    {"javax.net.ssl.keyStoreType", storetype}
};
for (String[] prop : props) {
    System.getProperties().setProperty(prop[0], prop[1]);
}
ProcessBuilder builder = new ProcessBuilder(
    "cmd.exe", "/c", "wsimport -keep -verbose https://some.sw.somewhere.az:5555/?wsdl");
builder.redirectErrorStream(true);
Process p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while (true) {
    line = r.readLine();
    if (line == null) {
        break;
    }
    System.out.println(line);
}

parsing WSDL...

[ERROR] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Failed to read the WSDL document: https://some.sw.somwhere.com:5555/?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): 

At least one WSDL with at least one service definition needs to be provided. Failed to parse the WSDL.

我用SOAPUI解决了这个问题, 来源

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM