axis2-wsdl2code-maven-plugin
Posted by Bruce Tsai
透過 maven 的 axis2 plugin 自動產生 web service 的 client code。配置設定檔如下,設定值參考參數說明。目前使用上 axis2 plugin 需配置 client code 的 package name,無法直接由 wsdl 產出對應的 package 是個小缺點。
maven 配置
- pom.xml
<plugin>
<!-- mvn install 時才會 generate code -->
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.2</version>
<executions>
<execution>
<id>HelloWorldService</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<!-- 不封裝輸入,輸出參數 -->
<unwrap>true</unwrap>
<overWrite>true</overWrite>
<wsdlFile>${basedir}/src/main/resources/HelloWorldService.wsdl</wsdlFile>
<databindingName>adb</databindingName>
<packageName>com.foo.sample.web.client.axis2</packageName>
<outputDirectory>src/main/java</outputDirectory>
<flattenFiles>true</flattenFiles>
</configuration>
</execution>
<execution>
<id>HelloCXFService</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unwrap>true</unwrap>
<overWrite>true</overWrite>
<wsdlFile>${basedir}/src/main/resources/HelloCXFService.wsdl</wsdlFile>
<databindingName>adb</databindingName>
<packageName>com.foo.sample.web.client.cxf</packageName>
<outputDirectory>src/main/java</outputDirectory>
<flattenFiles>true</flattenFiles>
</configuration>
</execution>
</executions>
</plugin>