springspring-bootjaxws-maven-plugin

jaxws-maven-plugin and spring boot


In my spring boot application, i have to create client code for two webservices [A A and B webservices] . I am using jaxws-maven-plugin and it is generating code.

The challenge in front of me is, in my web project, i've one generated folder and all the generated code goes in that folder. Now, if i execute jaxws-maven-plugin for A service , it creates the code and wsdl location points to correct location from the generated code i.e A.wsdl. After that, if i execute jaxws-maven-plugin for B service, it also creates the proper generated code but in this case the wsdl location of first webservices generated client code get modified and points to B.wsdl

Due to this approach my client code for A.wsdl stops working as it points to incorrect implementation

Please suggest.


Solution

  • You can generate Java code for multiple WSDL files in one jaxws-maven-plugin execution and specify a path prefix.

    <build>
        ...
        <plugins>
            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <keep>true</keep>
                            <wsdlLocation>http://mywebservices/*</wsdlLocation>
                            <wsdlDirectory>src/mywsdls</wsdlDirectory>
                            <wsdlFiles>
                                <wsdlFile>A.wsdl</wsdlFile>
                                <!-- produces wsdlLocation = http://mywebservices/A.wsdl -->
                                <wsdlFile>B.wsdl</wsdlFile>
                                <!-- produces wsdlLocation = http://mywebservices/B.wsdl -->
                            </wsdlFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            ...
        </plugins>
        ...
    <build>
    

    See this example from JAX-WS Commons site.