wsgen
wsgen 是在JDK的bin目录下的一个exe文件(Windows版),该命 令的主要功能是用来生成合适的JAX-WS。它读取Web Service的终端类文件,同时生成所有用于发布Web Service所依赖的源代码文件和经过编译过的二进制类文件。这里要特别说明的是,通常在Web Service Bean中用到的异常类会另外生成一个描述Bean,如果Web Service Bean中的方法有申明抛出异常,这一步是必需的,否则服务器无法绑定该对像。此外,wsgen 还能辅助生成WSDL和相关的xsd文件。wsgen 从资源文件生成一个完整的操作列表并验证web service是否合法,可以完整发布。
命令参数说明:
- -cp 定义classpath
- -r 生成 bean的wsdl文件的存放目录
- -s 生成发布Web Service的源代码文件的存放目录(如果方法有抛出异常,则会生成该异常的描述类源文件)
- -d 生成发布Web Service的编译过的二进制类文件的存放目录(该异常的描述类的class文件)
命令范例: wsgen -cp ./bin -r ./wsdl -s ./src -d ./bin -wsdl org.jsoso.jws.server.Example
wsimport
wsimport也是在JDK的bin目录下的一个exe文件(Windows版),主要功能是根据服务端发布的wsdl文件生成客户端存根及框架,负责 与Web Service 服务器通信,并在将其封装成实例,客户端可以直接使用,就像使用本地实例一样。对Java而言,wsimport帮助程序员生存调用web service所需要的客户端类文件.java和.class。要提醒指出的是,wsimport可以用于非Java的服务器端,如:服务器端也许是C# 编写的web service,通过wsimport则生成Java的客户端实现。
命令参数说明:
命令范例: wsimport -d ./bin -s ./src -p org.jsoso.jws.client.ref http://localhost:8080/hello?wsdl
The
wsgen
tool generates JAX-WS portable artifacts used in JAX-WS web services. The tool reads a web service endpoint implementation class (SEI) and generates all the required artifacts for web service deployment,and invocation
Contents
Overview
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. JAXWS 2.1.1 RI also provides a wsgen ant task,see Wsgen ant task for details.
Launching wsgen
-
Solaris/Linux
export JAXWS_HOME=/pathto/jaxws-ri
$JAXWS_HOME/bin/wsgen.sh -help
-
Windows
set JAXWS_HOME=c:\pathto\jaxws-ri
%JAXWS_HOME%\bin\wsgen.bat -help
Syntax
wsgen [options] <SEI>
The following table lists the wsgen
options.
Option |
Description |
---|---|
|
Specify where to find input class files |
|
Same as |
|
Specify where to place generated output files |
|
allow vendor extensions (functionality not specified by the specification). Use of extensions may result in applications that are not portable or may not interoperate with other implementations |
|
display help |
|
Keep generated files |
|
Used only in conjunction with the -wsdl option. Specify where to place generated resource files such as WSDLs |
|
Specify where to place generated source files |
|
Output messages about what the compiler is doing |
|
Print version @R_543_4045@ion. Use of this option will ONLY print version @R_543_4045@ion. normal processing will not occur. |
|
By default |
|
Used only in conjunction with the |
|
Used only in conjunction with the |
Example
wsgen -d stock -cp myclasspath stock.StockService
This will generate the wrapper classes needed for StockService annotated with @WebService annotation inside stockdirectory.
wsgen -wsdl -d stock -cp myclasspath stock.StockService
This will generate a SOAP 1.1 WSDL and schema for your Java class stock.StockService annotated with @WebService annotation.
wsgen -wsdl:Xsoap1.2 -d stock -cp myclasspath stock.StockService
Will generate a SOAP 1.2 WSDL.
Note that you do not have to generate WSDL at the development time as JAXWS runtime will automatically generate a WSDL for you when you deploy your service.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。