Search code examples
javamavenwsdl

Getting java classes from multiple wsdls


I have a Maven project where i need to generate java classes from multiple wsdl files. I have analysed using maven plugins axistools-maven-plugin and cxf-codegen-plugin but the problem i am facing are is that Java files from different wsdl's should go to different packages.

I have checked this link : http://decimalsolutions.blogspot.in/2011/10/wsdl2java-maven2.html but it doesn't solve my problem.

How to achieve this?


Solution

  • The documentation states you can use the <extraarg> element to pass in parameters to the wdsl to java process. So, you can configure your cxf-codegen-plugin in the following manner

    <configuration>
        <sourceRoot>${project.build.directory}/generated-code/mywebservice</sourceRoot>
        <wsdlOptions>
            <wsdlOption>
                <wsdl>${basedir}/src/main/resources/wsdl/serviceOne.wsdl</wsdl>
                <extraargs>
                    <extraarg>-p</extraarg>
                    <extraarg>first.packagename</extraarg>
                </extraargs>
            </wsdlOption>
            <wsdlOption>
                <wsdl>${basedir}/src/main/resources/wsdl/serviceTwo.wsdl</wsdl>
                    <extraargs>
                    <extraarg>-p</extraarg>
                    <extraarg>another.packagename</extraarg>
                </extraargs>
            </wsdlOption>
        </wsdlOptions>
    </configuration>