We are using axis2 to generate web-service clients, (I regret this now!). With axis2 command-line tool you can pass switch -Euwc to wrap int into Integer, boolean into Boolean and so on in generated soruces. This is the one way to tell axis2 that its OK for certain int or boolean values to be nillable in schema.
My question is how do you set this parameter via POM or other means with Maven to achieve same behaviour with genrated sources? My stackoverflow and google searches aren't revealing much. There's a Jira issue, which seems to be closed by developers without pointing in right direction.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.futile.bizzareservice</groupId>
<artifactId>BizzareService</artifactId>
<version>2.0</version>
<name>BizzareService</name>
<properties>
<wsdl.location>unfortunate-wsdls</wsdl.location>
<axis2.version>1.5.4</axis2.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>${axis2.version}</version>
<configuration>
<packageName>com.futile.bizzareservice.client</packageName>
<wsdlFile>${wsdl.location}/bizzareservice.wsdl</wsdlFile>
<language>java</language>
<databindingName>adb</databindingName>
<unpackClasses>true</unpackClasses>
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb-codegen</artifactId>
<version>${axis2.version}</version>
</dependency>
</dependencies>
</project>
Setting unwrap to true in configuration doesn't help, as it's a different option all together. I will look to avoid axis2 in the future but for time being we're stuck with it.
After long meditation with sources I found solution: insert
<options>
<uwc>true</uwc>
</options>
in configuration section.
Use
<options>
<osv>true</osv>
<iu>true</iu>
</options>
This only works with 1.7.2 version of Axis
来源:https://stackoverflow.com/questions/6189001/how-to-set-euwc-param-with-axis2-wsdl2code-maven-plugin