How to generate web service Stub from WSDL file with Apache Axis2 Maven Plugin
This wiki describes how to generate web service Stub from a WSDL file with
Apache Axis2 MAven Plugin and
XmlBeans.
This documentation is the result of the discussion on the
Sensor Web mailing list/forum because of problems with wsimport/JAXB/JAX-WS.
Pom.xml file
Here is an example pom.xml file that uses the
Apache Axis2 MAven Plugin and
XmlBeans to generate a service Stub from the local SOS 4.0.0 instance.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.n52.sensorweb.sos</groupId>
<artifactId>wsdl</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.2</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<packageName>org.n52.sos</packageName>
<wsdlFile>http://127.0.0.1:8080/52n-sos-webapp/wsdl?wsdl
</wsdlFile>
<databindingName>xmlbeans</databindingName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Execute
Here are the steps to generate the Stubs.
- Open a command line
- Go to the folder where the above pom.xml file is located
- Execute
mvn package