This tutorial may be useful when you want to generate stubs from multiple WSDL files using maven or gradle plugin.

Use below maven based plugin to generate stubs


							<wsdlOption>                                                                                                                                <wsdl>${basedir}/src/main/resources/wsdl/<wsdl1>.wsdl</wsdl>
								<!-- if you want to use URL -->
								<!-- <wsdl>http://<host>:<port>/<name1>.wsdl</wsdl> -->
							<wsdlOption>                                                                                                                                <wsdl>${basedir}/src/main/resources/wsdl/<wsdl2>.wsdl</wsdl>
								<!-- if you want to use URL -->
								<!-- <wsdl>http://<host>:<port>/<name2>.wsdl</wsdl> -->

Use below gradle based plugin to generate stubs

buildscript {
    repositories {

    dependencies {
		classpath 'no.nils:wsdl2java:0.10'

apply plugin: 'java'
apply plugin: 'no.nils.wsdl2java'

wsdl2javaExt {
	cxfVersion = "3.1.10"

	generatedWsdlDir = file("${projectDir}/src/main/service") //java source classes will be generated
	wsdlDir=file("${projectDir}/src/main/resources/wsdl/") //wsdl directory
	wsdlsToGenerate = [
		[file("${projectDir}/src/main/resources/wsdl/wsdl1.wsdl")], //wsdl1
		[file("${projectDir}/src/main/resources/wsdl/wsdl2.wsdl")], //wsdl2
		[file("${projectDir}/src/main/resources/wsdl/wsdl3.wsdl")]  //wsdl3

compileJava.dependsOn wsdl2java


Thanks for reading.


I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Roy Tutorials | TwitterFacebook Google PlusLinkedin | Reddit

Leave a Reply

Your email address will not be published. Required fields are marked *