I'm trying to generate Java code from WSDLs using the Apache CXF Maven plugin cxf-codegen-plugin where the WSDLs are contained in a Maven artifact of type zip.
At the moment, I fetch and unwrap the WSDLs using the maven-dependency-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>some.company.service</groupId>
<artifactId>service-package</artifactId>
<version>${service-package.version}</version>
<type>zip</type>
<classifier>wsdl</classifier>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/deps</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
However, the Apache CXF codegen plugin allows to provide the artifact directly using wsdlArtifact and making the dependency plugin redundant:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdlArtifact>
<groupId>some.company.service</groupId>
<artifactId>service-package</artifactId>
<version>${service-package.version}</version>
</wsdlArtifact>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
In this case this won't work and I get the error:
Failed to resolve WSDL artifact some.company.service:service-package:0.0.1
If I change the artifact definition to:
<wsdlArtifact>
<groupId>some.company.service</groupId>
<artifactId>service-package</artifactId>
<version>${service-package.version}</version>
<type>zip</type>
<classifier>wsdl</classifier>
</wsdlArtifact>
The plugin throws an exception during processing:
[...]
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x56 (at char #12, byte #-1)
[...]
Caused by: java.io.CharConversionException: Invalid UTF-8 middle byte 0x56 (at char #12, byte #-1)
To me it seems that the plugin is not able to parse an artifact of type zip. Correct? Is there any solution to achieve this using the codegen plugin only or do I need the dependency plugin?
If I could parse the WSDL artifact somehow, is it possible to include / exclude certain WSDL for code generation?