0

I am using below wsdl2java plugin configured to generate java classes using WSDL.

<plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <sourceRoot>${basedir}/src/main/java</sourceRoot>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>src/main/resources/XXXXService.wsdl</wsdl>
                                <validate>none</validate>
                                <extraargs>
                                    <extraarg>-server</extraarg>
                                    <extraarg>-impl</extraarg>
                                    <extraarg>-verbose</extraarg>
                                    <extraarg>-p</extraarg>
                                    <extraarg>http://XXX/YY=XXX</extraarg>
                                    <extraarg>-autoNameResolution</extraarg>
                                </extraargs>

                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Now, I have below schema included in my WSDL.

<xsd:include schemaLocation="myschema.xsd" xmlns="tns"></xsd:include>

When my element definition is within my WSDL like below, it generates a class for myElement , which is fine:

<xsd:element name="myElement">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="a" type="xsd:string"
                    minOccurs="1">
                </xsd:element>
                <xsd:element name="b" type="xsd:string"
                    minOccurs="1">
                </xsd:element>                  
            </xsd:sequence>
        </xsd:complexType>

But when my element definition in WSDL refers to a ComplexType definition in schema. Then the element class aaa doesn't get generated only aaaType class gets generated.

<xsd:element name="aaa"
        type="tns:aaaType">
</xsd:element>

Is there a way I can specify wsdl2java to generate both classes aaa and aaaType and reference aaaType inside aaa ?

user620339
  • 851
  • 3
  • 20
  • 42

1 Answers1

0

You can check xmlns:tns and targetNamespace on both WSDL and the schema.

<xsd:element name="aaa"... - it can be defined in schema itself.

You can try to browse the WSDL and check if it is proper, as issue seems to be related to schema include.

Dreamwalker
  • 3,032
  • 4
  • 30
  • 60