apache cxf-codegen-plugin wsdl2java relative wsdlLocation
Asked Answered
F

2

8

I'm able to use generate classes with a relative wsdlLocation when I specify each file, such as <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/resources/sample.wsdl</wsdl> <wsdlLocation>classpath:wsdl/sample.wsdl</wsdlLocation> </wsdlOption> </wsdlOptions>

Instead, I would like to use <wsdlRoot> so I dont need to specify each wsdl for which to generate classes.

E.g.

<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot> <includes> <include>*.wsdl</include> </includes>

This works to generate classes for each wsdl in the directory, however, the wsdlLocation in the generated class is an absolute path to where the wsdl is located on my machine. I would like a relative path, so the code is more portable. Is it possible to specify a relative wsdlLocation when using wsdlRoot?

Thank you

Fleabane answered 4/10, 2016 at 23:0 Comment(1)
Have you found a solution for this? I just had this problem. I do not want to specify each .wsdl file and still need to set the wsdlLocation to the relative classpath-path.Staple
S
0

You can specify an extra option -wsdlLocation with an empty value. In the generated XXX_Service code, it says WSDL_LOCATION = null;.

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.2.4</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${basedir}/src/main/java</sourceRoot>
                <wsdlRoot>${basedir}/src/main/webapp/WEB-INF/wsdl/</wsdlRoot>
                <defaultOptions>
                    <defaultExcludesNamespace>true</defaultExcludesNamespace>
                    <extraargs>
                        <extraarg>-wsdlLocation</extraarg>
                        <extraarg> </extraarg>
                    </extraargs>
                </defaultOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

You can find similar excerpt in pom.xml of my previous CXF project here: https://github.com/htr3n/loan-approval-portal/blob/master/pom.xml.

Shumway answered 7/12, 2018 at 12:6 Comment(0)
A
0

The following worked for me:

                        <includes>
                        <include>*/*.wsdl</include>
                        </includes>
                        <wsdlRoot>${project.basedir}/src/main/wsdl</wsdlRoot>
Azores answered 27/5 at 12:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.