This plugin takes as input a WSDL and generates client and server stubs for calling or implementing a Web service matching the WSDL.
The WSDl2Code offers a single goal:
To run the plugin, add the following section to your POM (Project Object Model):
<build> <plugins> <plugin> <groupId>org.apache.axis2.maven2</groupId> <artifactId>axis2-wsdl2code-maven-plugin</artifactId> <executions> <execution> <goals> <goal>wsdl2code</goal> </goals> </execution> </executions> <configuration> <packageName>com.foo.myservice</packageName> </configuration> </plugin> </plugins> </build>
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 wsdl2code:wsdl2code
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> <package>package1</package> </namespaceURI> ........ </namespaceURI> | ||
outputDirectory | ${axis2.wsdl2code.target} | 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 all ports. | |
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 |