I am using WsImport
to generate some Java sources from a remote WSDL file. Note that this is being from inside a regular Scala project i.e. it is not being done
I am at the same deadlock as the author of the thread trying to tweak gradle's Java source code generation from wsdl.
And the reason for that is jaxb2-basics
implements com.sun.tools.xjc.Plugin
and @Optional in his answer refers to com.sun.tools.ws.WsImport
. At the same time wsimport
utility of "modern" Jdk8 rather implements com.sun.tools.internal.ws.WsImport
and use
com.sun.tools.internal.xjc.Plugin
. So jaxb2-basics
become kind of obsolete for using with wsimport
of Jdk8.
The solution would be to use alternative library to provide WsImport in "old" namespace. E.g. com.sun.xml.ws:jaxws-tools:2.3.0
. In Gradle it looks like:
configurations {
jaxws
}
dependencies {
jaxws 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.1'
jaxws 'com.sun.xml.ws:jaxws-tools:2.3.0'
compile 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.11.1'
}
wsdlServices.each { u ->
task "ws${u.service}" (type: JavaExec) {
classpath = configurations.jaxws
workingDir = generatedDir
main = 'com.sun.tools.ws.WsImport'
args = ['-keep', '-Xnocompile', '-B-XtoString', '-B-Xequals', '-B-XhashCode', u.url]
compileJava.dependsOn path // depends on current task
}
}
and in command line this will be:
java -cp "lib/*" com.sun.tools.ws.WsImport -extension -keep -Xnocompile -B-XtoString 'http://www.webservicex.com/globalweather.asmx?WSDL'
where lib contains
commons-beanutils-1.9.2.jar
commons-collections-3.2.1.jar
commons-lang3-3.2.1.jar
FastInfoset-1.2.13.jar
gmbal-api-only-3.1.0-b001.jar
ha-api-3.1.9.jar
javaparser-1.0.11.jar
javax.annotation-api-1.3.jar
javax.xml.soap-api-1.4.0.jar
jaxb2-basics-0.11.1.jar
jaxb2-basics-runtime-0.11.1.jar
jaxb2-basics-tools-0.11.1.jar
jaxb-api-2.3.0.jar
jaxb-core-2.3.0.jar
jaxb-impl-2.3.0.jar
jaxb-jxc-2.3.0.jar
jaxb-xjc-2.3.0.jar
jaxws-api-2.3.0.jar
jaxws-rt-2.3.0.jar
jaxws-tools-2.3.0.jar
jcl-over-slf4j-1.7.7.jar
jsr181-api-1.0-MR1.jar
management-api-3.0.0-b012.jar
mimepull-1.9.7.jar
policy-2.7.2.jar
resolver-20050927.jar
saaj-impl-1.4.0.jar
slf4j-api-1.7.7.jar
stax-ex-1.7.8.jar
streambuffer-1.5.4.jar
i.e. org.jvnet.jaxb2_commons:jaxb2-basics:0.11.1
and com.sun.xml.ws:jaxws-tools:2.3.0
with dependencies