cxf-codegen-plugin不生成所有字段

时间:2016-11-16 14:46:03

标签: web-services maven xsd cxf cxf-codegen-plugin

我试图在我的Spring MVC应用程序中集成SOAP服务。我有一个WSDL& XSD文件。要使用Apache CXF Maven插件(cxf-codegen-plugin)生成java类。
Maven Config:

  <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;
...

}

你可以看到&#34; paramfour&#34;不是在Java文件中生成的。

0 个答案:

没有答案