我想先创建一个合同-- Spring 。所以我有WSDL文件,但是我找不到从WSDL生成Spring any服务的任何例子。
使用这个Maven插件,我可以生成它,但它将是一个J2EE WebService,而不是Spring WebService,对吗?:
<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>这将生成一个具有@WebService注释的接口。但是这个是J2EE应用程序的,而不是Spring,对吗?
那么,中是否有从已经编写的WebServices文件中生成Spring的工具?
因为我找不到,只有jaxws-Maven-plugin。
发布于 2016-03-22 20:30:54
你当然可以使用:
http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
或basic.html
甚至是https://java.net/projects/maven-jaxb2-plugin/pages/Home
然后,您只需在spring:http://cxf.apache.org/docs/jax-ws-configuration.html中创建jaxws:client
或者仅仅是骆驼中的cxf组件:http://camel.apache.org/cxf.html
J2EE不过是一个堆栈,一个构成集合的框架集合。您可以在另一个框架(如OSGi)中使用CXF/Spring,只需导入您感兴趣的内容(例如camel-cxf、spring、.)。例如,我正在开发一个OSGi环境,但是我们使用codegen插件来生成类,然后将它们与camel-cxf集成。
https://stackoverflow.com/questions/36163838
复制相似问题