Generating WSDL2Java from Maven with CXF

10,871

You can use the <wsdlArtifact> to load the WSDL from maven:

<configuration>
    ...
    <wsdlOptions>
        <wsdlOption>
            <wsdlArtifact>
                <groupId>your.group.id</groupId>
                <artifactId>YourWSDLService</artifactId>
                <version>0.1.2-SNAPSHOT</version>
            </wsdlArtifact>
        </wsdlOption>
    </wsdlOptions>
    ...
</configuration>
Share:
10,871

Related videos on Youtube

Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    For e.g. I have cxf-codegen-plugin like this:

            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-rt-bindings-soap</artifactId>
                        <version>${cxf.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>generate-jaxb</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <additionalJvmArgs>-Dfile.encoding=UTF8</additionalJvmArgs>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>src/main/resources/wsdl/MyWsdl.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-wsdlLocation</extraarg>
                                        <extraarg></extraarg>
                                        <extraarg>-client</extraarg>
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    

    It is working just fine when my WSDl is stored in my local project:

    src/main/resources/wsdl/MyWsdl.wsdl
    

    What I am trying to achieve is to download the WSDL from remote Maven repository and pass it somehow to the <wsdl> element.

    Something like:

    <wsdl>
     <dependency>...</dependency>
    </wsdl>
    

    I can't find any information about how to do this. Does the option like this even exists? Or it should be done somehow differently then trying to pass the WSDL in the <wsdl> element?

    Please advice.