wsgen -cp D:\WorkSpaces\WorkSpace_SSM\jaxws-demo\target\classes 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.wsgen
The 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:\WorkSpaces\WorkSpace_SSM\jaxws-demo\target\classes com.deppon.demo.jaxws.service.impl.UserService -wsdl -s src -d bin -r src
-cp
就是class文件的所在路径,注意一下格式,首先需要指定到class文件夹,然后加上服务的全名(包名+类名)
-wsdl
-s
表示生成的源码放置的位置,生成的代码会有包名,这里放到了src下
-d
上面,我们使用-s生成了源码,这里表示源码的class文件的存放位置
-r
因为前面我们使用了-wsdl,所以需要给WSDL文件设置一个存放的路径,这里放到了src文件夹下
2.wsimport
The 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:
-
Service Endpoint Interface (SEI)
-
Service
-
Exception class mapped from
wsdl:fault
(if any) -
Async Reponse Bean derived from response
wsdl:message
(if any) -
JAXB generated value types (mapped java classes from schema types)
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
-s
当然,在最后需要加上WSDL的访问地址
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。