-
-
Save sffej/d9000370e978b728c6b96082f566dce8 to your computer and use it in GitHub Desktop.
WsdlToJava for simple projects. Time consuming if you have many wsdls, but good enough.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project.ext{ | |
cxfVersion = '2.5.1' | |
generatedWsdlDir = file("build/generated-sources") | |
wsdlDir = file("wsdl") | |
wsdlsToGenerate =[ | |
['-xjc', '-b', "$wsdlDir/serializable_binding.xml", "$wsdlDir/mywsdl1.wsdl.xml"], | |
['-xjc', '-b', "$wsdlDir/some_binding.xml", "$wsdlDir/mywsdl2.xml"], | |
['-xjc', '-b', "$wsdlDir/joda_binding.xml", "$wsdlDir/mywsdl3.wsdl.xml"], | |
// 55 more wsdls | |
] | |
} | |
dependencies { | |
compile "joda-time:joda-time:$jodatimeVersion" | |
compile "org.apache.cxf:cxf-tools:$cxfVersion", | |
"org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:$cxfVersion", | |
"org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:$cxfVersion", | |
"log4j:log4j:$log4jVersion" | |
} | |
task wsdl2Java() { | |
inputs.files wsdlDir.listFiles() | |
outputs.files generatedWsdlDir | |
doLast { | |
wsdlsToGenerate.each { wsdlFile -> | |
createJavaFromWsdl(wsdlFile, generatedWsdlDir) | |
} | |
} | |
} | |
def createJavaFromWsdl(arguments, destinationDir) { | |
arguments.add(arguments.size - 1, '-d') | |
arguments.add(arguments.size - 1, generatedWsdlDir) | |
println "Processing " + arguments[arguments.size - 1] | |
javaexec { | |
main = 'org.apache.cxf.tools.wsdlto.WSDLToJava' | |
classpath = configurations.runtime | |
args arguments | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment