Search code examples
javaspringjaxbwsdljaxb2-maven-plugin

jaxb2-maven-plugin: Can't generate sources from WSDL


I am trying to generate java classes from a wsdl using jaxb2-maven-plugin:

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageName>es.sescam.sofos.registrounico</packageName>
                <sourceType>wsdl</sourceType>
                <sources>
                    <source>src/main/resources/registrounico.wsdl</source>
                </sources>
                <outputDirectory>target/generated-sources</outputDirectory>
                <clearOutputDir>false</clearOutputDir>
            </configuration>
        </plugin>   

You can find the WSDL that I am using on this link

When I compile in Eclipse using the goals -U clean jaxb2:xjc everything seems to be OK with no errors, but the source java code is not generated in the target folder or anywhere...

What am I doing wrong?


Solution

  • The WSDL you are trying to use is RPC style and not document style; in RPC you have no XSD. In your case it seems all the SOAP messages (both requests and responses) are strings. Maybe they are XML formatted but this is something related on how the implementation side handles these messages.

    In this case you can't use JAXB for SOAP; maybe you can use it for creating XML strings to sends