webservice生成客户端的两种简单方式
2016-09-20 22:41
351 查看
转:http://blog.csdn.net/zshake/article/details/9120403
1、1.6之后jdk自带了wsimport
wsimport -d D:\JavaEE\webservice -verbose -p cn.com.sparknet.blsp.service.client -keep
http://192.168.1.177:5555/blsp-service/services/BLSPService?wsdl
-keep是生成java源代码
-d 生成的目录位置
-verbose 生成过程的详细信息展示
2、cxf的bin目录下有wsdl2java
wsdl2java -d D:\JavaEE\webservice -verbose -p cn.com.sparknet.blsp.service.client -keep
http://192.168.1.177:5555/blsp-service/services/BLSPService?wsdl
-keep是生成java源代码
-d 生成的目录位置
-verbose 生成过程的详细信息展示
感觉两种方式类似,第二种可以再maven中使用 在客户端的pom.xml中添加
[html]
view plain
copy
print?
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>d://webservice//cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:9000/helloWorld?wsdl</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
[html]
view plain
copy
print?
<extraarg>-keep</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
右键单击pom.xml run as maven build 输入 clean compile 会在d://webservice//cxf目录下生成所需的java代码
更多的wsdl2java操作请参见http://cxf.apache.org/docs/wsdl-to-java.html
1、1.6之后jdk自带了wsimport
wsimport -d D:\JavaEE\webservice -verbose -p cn.com.sparknet.blsp.service.client -keep
http://192.168.1.177:5555/blsp-service/services/BLSPService?wsdl
-keep是生成java源代码
-d 生成的目录位置
-verbose 生成过程的详细信息展示
2、cxf的bin目录下有wsdl2java
wsdl2java -d D:\JavaEE\webservice -verbose -p cn.com.sparknet.blsp.service.client -keep
http://192.168.1.177:5555/blsp-service/services/BLSPService?wsdl
-keep是生成java源代码
-d 生成的目录位置
-verbose 生成过程的详细信息展示
感觉两种方式类似,第二种可以再maven中使用 在客户端的pom.xml中添加
[html]
view plain
copy
print?
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>d://webservice//cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:9000/helloWorld?wsdl</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
<build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>2.5.0</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>d://webservice//cxf</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>http://localhost:9000/helloWorld?wsdl</wsdl> <extraargs> <extraarg>-verbose</extraarg>
[html]
view plain
copy
print?
<extraarg>-keep</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<extraarg>-keep</extraarg> </extraargs> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
右键单击pom.xml run as maven build 输入 clean compile 会在d://webservice//cxf目录下生成所需的java代码
更多的wsdl2java操作请参见http://cxf.apache.org/docs/wsdl-to-java.html
相关文章推荐
- webservice生成客户端的两种简单方式
- webservice生成客户端两种方式
- XFire与Spring集成时WebService客户端的两种开发方式
- Java 调用C# webservice接口 生成java客户端 实现方式
- WebService的两种客户端调用方式
- webservice客户端生成方式
- 客户端调用webservice的两种方式
- webService-axis2方式生成客户端
- 3种方式生成webservice客户端
- 根据wsdl生成客户端Bean的两种方式
- 360doc-----简单CXF方式的webService客户端调用范例
- 生成Webservice的两种方式(Axis2,CXf2.x)
- 【转】【WCF】WCF中客户端生成代理的两种方式
- WCF中客户端生成代理的两种方式
- webservice用wsdl2java来生成客户端(操作简单方便)
- webservice客户端的生成方式
- java代码webservice客户端的两种调用方式
- webservice生成客户端方式总结
- webService-cxf方式生成客户端
- 简单CXF方式的webService客户端调用范例