I try to generate Java classes using wsdl2java.
Wsdl is located in remote server which is secured using X509 certificate, in such a way, that when I try to access it in the browser without having certificate in trust store, it is returning an error (of course when I have certificate imported into certmgr.msc
, wsdl is showing just fine).
Unfortunatelly, when I try to run wsdl2java, I get:
> org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition file:/resources/wsdl/my.xml: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=PARSER_ERROR: Problem parsing 'https://SERVER_HOST/my?xsd=../xsd/XX.xsd'.: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
I have my certificate imported in JKS store.
How can I advise wsdl2java to use that certificate from JKS in order to connect to the serwer?
I would like suggest you skip this problem by below steps:
Download that wsdl manually to your local machine.
Dlownload that xsd files which referenced in that wsdl file manaully to your local machine.
Modify that wsdl to change xsd location to your local one.
You are fine to generate java code now.
If you really want to make it. Please refer to here:
"%JAVA_HOME%\bin\java" -Djavax.net.ssl.trustStore="{keystorefile}" -Djavax.net.ssl.trustStorePassword="{password}" -Djavax.net.ssl.keyStoreType="jks" -Dorg.jboss.security.ignoreHttpsHost="true" -Xmx128M -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" -cp "%CXF_JAR%;%TOOLS_JAR%;%CLASSPATH%" -Djava.util.logging.config.file="%CXF_HOME%\etc\logging.properties" org.apache.cxf.tools.wadlto.WADLToJava %*
coming from : How to generate client code using wsdl2java through https?