How to use namespace mapping using no.nils.wsdl2java plugin for gradle


(Ahmar Khan) #1

I am using no.nils.wsdl2java to generate java code from my wsdl/xsds using xjb binding. The issue with me is I am getting the all java classes generated except the those xsds which associated with namespace in wsdl.


//Array of wsdls

def createWsdlToGenerateArray(wsdlPath) {
println("createWsdlToGenerateArray for : " + wsdlPath)
//xjb Binding location
def xjbBindingPath = “src/main/resources/binding1.xjb”
return [’-p’, ‘com.echostar.axis2’, ‘-mark-generated’, ‘-b’, “$xjbBindingPath”, ‘-autoNameResolution’, “$wsdlPath”]
}

def wsdlsToGenerateMethod(def wsdlDirPath, def wsdlNames) {
def wsdls = []
wsdlNames.each { wsdlName ->
wsdls.add(createWsdlToGenerateArray("$wsdlDirPath/$wsdlName"))
}
return wsdls
}

wsdl2java {
/wsdlsToGenerate = [
createWsdlToGenerateArray("$wsdlDirPath"+"/TechstoreDataService.wsdl")
]
/

wsdlsToGenerate = wsdlsToGenerateMethod("$wsdlDirPath", wsdlNames);
generatedWsdlDir = file("$projectDir/src/main/generated-sources")
wsdlDir = file("$projectDir/src/main/resources/wsdl")
locale = Locale.ENGLISH

}

defaultTasks ‘clean’, ‘build’, ‘wsdl2Java’