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

**URL:** <https://discuss.gradle.org/t/how-to-use-namespace-mapping-using-no-nils-wsdl2java-plugin-for-gradle/27340>\
**Category:** Help/Discuss\
**Created:** [June 13, 2018, 7:12am UTC](https://discuss.gradle.org/t/how-to-use-namespace-mapping-using-no-nils-wsdl2java-plugin-for-gradle/27340 "2018-06-13T07:12:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmars2000](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ahmars2000/32/7000_2.png) [@ahmars2000](https://discuss.gradle.org/u/ahmars2000)\
**Post date:** [June 13, 2018, 7:12am UTC](https://discuss.gradle.org/t/how-to-use-namespace-mapping-using-no-nils-wsdl2java-plugin-for-gradle/27340/1 "2018-06-13T07:12:18Z")

</div>

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’
