Spring MVC アプリケーションに SOAP サービスを統合しようとしています。WSDL と XSD ファイルがあります。Java クラスを生成するために、Apache CXF Maven プラグイン (cxf-codegen-plugin) を使用しています。
Maven 構成:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.basedir}/src/main/resources/wsdl/xxxx.wsdl</wsdl>
<wsdlLocation>classpath:wsdl/xxxx.wsdl</wsdlLocation>
<extraargs>
<extraarg>-impl</extraarg>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
XSD ファイル:
<xs:sequence>
<xs:element name="paramone" nillable="true" type="xs:string"/>
<xs:element name="paramdate" type="xs:dateTime"/>
<xs:element name="paramtwo" nillable="true" type="xs:string"/>
<xs:element name="paramthree" nillable="true" type="xs:string"/>
<xs:element name="paramfour" nillable="true" type="xs:long"/>
</xs:sequence>
生成された Java ファイル
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "data", propOrder = {
"paramone",
"paramdate",
"paramtwo",
"paramthree"
})
public class Data{
@XmlElement(required = true, nillable = true)
protected String paramone;
@XmlElement(required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar paramdate;
@XmlElement(required = true, nillable = true)
protected String paramtwo;
@XmlElement(required = true, nillable = true)
protected String paramthree;
...
}
Java ファイルに「paramfour」が生成されていないことがわかります。