wsdl生成java代码
生成java代码方式一
在官网 http://cxf.apache.org 下载Apache CXF后,cmd 进入目录apache-cxf-3.5.3\bin, 输入命令: wsdl2java http://localhost:8088/ws/test1
即可生成客户端代码。
生成java代码方式二
新建maven项目,在pom.xml里添加CXF cxf-codegen-plugin插件,
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>src/main/resources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:8088/ws/test1?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
执行 maven install
,生成的代码在 resource目录下,把生成的wsdl代码拷贝到自己的项目中,生成的代码如下: