I want to create a contract first Spring webservice. So I have the WSDL file, but I can't find any example of generating the Spring webservices from the WSDL.
With this Maven plugin, I can generate it, but it will be a J2EE WebService, and not a Spring WebService, am I Right?:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<configuration>
<xdebug>true</xdebug>
<verbose>true</verbose>
<target>2.0</target>
</configuration>
<executions>
<execution>
<id>generate-service</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlDirectory>src/main/resources/wsdls</wsdlDirectory>
<wsdlFiles>
<wsdlFile>service.wsdl</wsdlFile>
</wsdlFiles>
<sourceDestDir>target/generated-code/src</sourceDestDir>
</configuration>
</execution>
</executions>
</plugin>
This will generate an interface, which has the @WebService annotation. But this is for the J2EE application, and not Spring, right?
So, is there any tool in maven for generate Spring WebServices from an already written WSDL file?
Because I cannot find any, only the jaxws-Maven-plugin.
You can surely use :
http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
or http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/example_xjc_basic.html
or even https://java.net/projects/maven-jaxb2-plugin/pages/Home
Then you'll just have to create a jaxws:client in spring : http://cxf.apache.org/docs/jax-ws-configuration.html
Or just the cxf component in camel : http://camel.apache.org/cxf.html
J2EE is nothing more than a stack, a collection of framework that forms a collection. You can use CXF/Spring with another Framework (such as OSGi) and just import what interests you (for example, camel-cxf, spring-core, ...). For example, I'm working on an OSGi environment, but we are using codegen plugin to generate the class and then integrate them with camel-cxf.