Search code examples
web-servicesmaven-2wsdlcode-generation

generate wsdl file and webservice client based on wsdl file in maven


I am working on a project where I have a webservice module, and a webmodule. I want a client to be generated based on the wsdl file of the webservice, and I want the wsdl file to be generated when I build the webservice module.

I have found the maven plugins to do this(axis2-java2wsdl-maven-plugin and axis2-wsdl2code-maven-plugin), but the axis2-java2wsdl-maven-plugin keeps generating invalid xsd for the wsdl file(I think its invalid at least).

The webservice returns some enums from its methods, or returns objects that contain enums. When generating the wsdl file, I get a reference to "xs:Enum" which does not exist in the given namespace for two of the enum types. I have several, but only two of them gets this base="xs:Enum".

<xs:complexType name="LoginType">
    <xs:complexContent>
        <xs:extension base="xs:Enum">
            <xs:sequence/>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

So when building the client module with the axis2-wsdl2code-maven-plugin, I get the following error:

error: src-resolve: type 'Enum@http://www.w3.org/2001/XMLSchema' not found.

I don't understand why it keeps generating invalid XSD!


Solution

  • This has been a known issue for a very long time. It's one of the (many) reasons I started using Apache CXF instead of Axis. It even has a similar Maven Plugin.