Maven2 WSDL2Code Plug-in Guide


This plugin takes as input a WSDL and generates client and server stubs for calling or implementing a Web service matching the WSDL.

[Download Plugin Tool]


The WSDl2Code offers a single goal:

  • wsdl2code (default): Reads the WSDL and generates code.

To run the plugin, add the following section to your POM (Project Object Model):

Also please add axis2 jars as a dependency

The plugin will be invoked automatically in the generate-sources phase. You can also invoke it directly from the command line by running the command

mvn axis2-wsdl2code:wsdl2code

The WSDL2Code Goal

By default, the plugin reads the file src/main/axis2/service.wsdl. Sources for the Java programming language and the ADB data binding are generated into target/generated-sources/axis2/wsdl2code. Note the configuration element packageName above, which sets the package name, thus a subdirectory.


The WSDL2Code goal takes the following parameters as input. All parameters can be set from the command line by using properties. For example, the parameter "generateServerSide" may be set using the property "axis2.wsdl2code.generateServerSide". If the parameter isn't set via property or in the POM, then a default value applies.

Parameter Name Command Line Property Description Default Value
databindingName ${axis2.wsdl2code.databindingName} Data binding framework, which is being used by the generated sources. adb
generateAllClasses ${axis2.wsdl2code.generateAllClasses} Whether to generate simply all classes. This is only valid in conjunction with "generateServerSide". false
generateServerSide ${axis2.wsdl2code.generateServerSide} Whether server side sources are being generated. false
generateServerSideInterface ${axis2.wsdl2code.generateServerSideInterface} Whether to generate the server side interface. false
generateServicesXml ${axis2.wsdl2code.generateServicesXml} Whether a "services.xml" file is being generated. false
generateTestcase ${axis2.wsdl2code.generateTestCase} Whether a test case is being generated. false
language ${axis2.wsdl2code.language} Programming language of the generated sources. java
namespaceToPackages ${axis2.wsdl2code.namespaceToPackages} Map of namespace URI to packages in the format uri1=package1,uri2=package2,... Using this parameter is discouraged. In general, you should use the namespaceUris parameter. However, the latter cannot be set on the command line.
namespaceURIs Map of namespace URI to packages. Example: <namespaceURIs> <namespaceURI> <uri>uri1</uri> <packageName>package1</packageName> </namespaceURI> ........ </namespaceURI>
outputDirectory ${} Target directory, where sources are being target/generated-sources/axis2/wsdl2code generated.
packageName ${axis2.wsdl2code.package} Package name of the generated sources.
portName ${axis2.wsdl2code.portName} Port name, for which sources are being generated. By default, sources are generated for a randomly picked port.
allPorts ${axis2.wsdl2code.allPorts} Set this to true to generate code for all ports. false
serviceName ${axis2.wsdl2code.serviceName} Service name, for which sources are being generated. By default, sources are generated for all services.
syncMode ${axis2.wsdl2code.syncMode} Sync mode, for which sources are being generated; either of "sync", "async", or "both" (default). both
unpackClasses ${axis2.wsdl2code.unpackClasses} Whether to unpack classes.
wsdlFile ${axis2.wsdl2code.wsdl} Location of the WSDL file, which is read as input src/main/axis2/service.wsdl
unwrap ${axis2.wsdl2code.unwrap} This will select between wrapped and unwrapped during code generation. Maps to the -uw option of the command line tool. false