JAXWS学习(三)- wsgen和wsimport命令讲解
在上一篇博客中,我们使用了两个命令: wsgen -cp D:WorkSpacesWorkSpace_SSMjaxws-demotargetclasses com.deppon.demo.jaxws.service.impl.UserService -wsdl -s src -d bin -r src wsimport -keep -d bin -s src http://localhost:8080/jaxws-demo/userService?wsdl 在这里,我们讲一下他的用法(官方文档上都有,可以直接看官方的) 1.wsgenThe wsgen tool generates JAX-WS portable artifacts used in JAX-WS web services. The tool reads a web service endpoint class and generates all the required artifacts for web service deployment,and invocation. 大体上就是:我们可以使用这个命令,根据Class文件,生成WSDL等相关文件 输入命令: wsgen -help 可以显示出该命令的帮助, 当然,如果你没有配置环境变量的话,可能为提示找不到命令: 这是官方的语法讲解: 最后,简单的说一下咱们用到的几个: (ps:执行命令时,已经进入到客户端项目的根路径下) wsgen -cp D:WorkSpacesWorkSpace_SSMjaxws-demotargetclasses com.deppon.demo.jaxws.service.impl.UserService -wsdl -s src -d bin -r src -cp就是class文件的所在路径,注意一下格式,首先需要指定到class文件夹,然后加上服务的全名(包名+类名) -wsdl表示需要生成WSDL文件,因为默认是不生成的 -s表示生成的源码放置的位置,生成的代码会有包名,这里放到了src下 -d上面,我们使用-s生成了源码,这里表示源码的class文件的存放位置 -r因为前面我们使用了-wsdl,所以需要给WSDL文件设置一个存放的路径,这里放到了src文件夹下 2.wsimportThe wsimport tool generates JAX-WS portable artifacts used in JAX-WS clients and services. The tool reads a WSDL and generates all the required artifacts for web service development,deployment,and invocation. 大体上是说,我们可以使用这个命令,根据服务,生成客户端代码 The wsimport tool generates JAX-WS portable artifacts,such as:
These artifacts can be packaged in a WAR file with the WSDL and schema documents along with the endpoint implementation to be deployed.? 我们简单说一下,使用到的 wsimport -keep -d bin -s src http://localhost:8080/jaxws-demo/userService?wsdl -keep表示生成源代码 -d表示源代码的class文件存放的位置 -s表示生成的源代码存放的位置 当然,在最后需要加上WSDL的访问地址 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |