java WSDL接口webService实现方式
一、使用JDK生成WSDL的对象类
1、cmd进入JDK的bin文件中
执行命令 wsimport -keep -p com.demo.client http://localhost:8080/Demo/services/MyService?wsdl
比较常用的[options]有:
1). -d <directory>
在指定的目录生成class文件
2). -clientjar <jarfile>
在当前目录生成jar文件,结合-d <directory>可以在指定的目录生成jar文件
3). -s <directory>
在指定的目录生成java源文件
4). -p <pkg>
指定生成文件的包结构
5). -keep
在生成class文件,或者jar包时,同时保留java源文件
2、eclipse生成WSDL文件
在Eclipse中生成webservice客户端代码,New---->Other---->Webservice---->Webservice Client,选择之前拷贝到eclipse中的wsdl路径点击finish,这样eclipse就帮我们自动生成了webservice的客户端,接下来只需在程序中调用即可,在程序中调用 eclipse自动生成的webservice客户端;
3、MyEclipse 生成 WSDL 文件
在项目上右键,选择New->Other->WebService->WebServiceClient->Next,会看到以下界面:
4、WSDL Maven支持的jar包
<dependencies> <!-- ==================== WSDL 依赖文件 start=================== --> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-discovery</groupId> <artifactId>commons-discovery</artifactId> <version>0.5</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId> <version>1.3.5</version> </dependency> <dependency> <groupId>wsdl4j</groupId> <artifactId>wsdl4j</artifactId> <version>1.6.3</version> </dependency> <!-- ==================== WSDL 依赖文件 end====================== --> </dependencies>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
spring boot activiti工作流的搭建与简单使用
这篇文章主要给大家介绍了关于spring boot activiti工作流的搭建与简单使用的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2018-08-08详解Java ScheduledThreadPoolExecutor的踩坑与解决方法
最近项目上反馈某个重要的定时任务突然不执行了,很头疼,开发环境和测试环境都没有出现过这个问题。定时任务采用的是ScheduledThreadPoolExecutor,后来一看代码发现踩了一个大坑。本文就来和大家聊聊这次的踩坑记录与解决方法,需要的可以参考一下2022-10-10关于Spring Bean实例过程中使用反射和递归处理的Bean属性填充问题
本文带领大家一起学习下在Spring Bean实例过程中如何使用反射和递归处理的Bean属性填充,需要在类 AbstractAutowireCapableBeanFactory 的 createBean 方法中添加补全属性方法,具体操作方法跟随小编一起学习下吧2021-06-06
最新评论