jax-ws wsimport 命令详解

通过 -b  参数可以指定多个 JAX-WS 和 JAXB 的绑定文件 ,这可以用来定制各种选项: 包名, 类名, 等. 

更多的使用细节可以查看:http://jax-ws.java.net/nonav/2.2.7/docs/ch04.html#tools-wsimport

 

Option Description
-d <directory>指定输出目录
-b <path>指定JAXWS或者JAXB的绑定文件,可以多个
-B <jaxbOption>指定JAXB的参数,透传给JAXB命令
-catalog绑定外部WSDL或XSD,解决外部WSDL或者XSD引用
-extensionAllow 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.
-help显示帮助
-httpproxy:<host>:<port>指定一个HTTP代理
-keep保留源文件
-p <pkg>指定包名
-s <directory>指定源代码存放目录
-encoding <encoding>指定编码格式,例如UTF-8
-verbose指定输出命令执行的详细信息
-version显示版本
-fullversion显示详细的版本信息
-clientjar <jarfile>Creates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service.
-wsdllocation <location> @WebServiceClient.wsdlLocation value.
-target <version>指定JAX-WS的版本,默认是 2.2.
-quiet静默执行该命令,不在屏幕输出信息
-XadditionalHeadersMap the headers not bound to request or response message to Java method parameters.
-XauthfileFile to carry authorization information in the format http://username:password@example.org/stock?wsdl. Default value is $HOME/.metro/auth
-Xdebug显示DEBUG信息
-XdisableAuthenticatorDisables Authenticator used by JAX-WS RI, -Xauthfile option will be ignored if -XdisableAuthenticatoris set.
-Xno-addressing-databinding不使用JDK的Addressing,生成自己的EndpointReferenceType
-Xnocompile不编译生成的源码
-XdisableSSLHostnameVerificationDisbales the SSL Hostname verification while fetching the wsdls.

 

wsimport不区分cient端和server端,发布出来就是一套代码

【举例】

wsimport -b jaxws_binding.xml -catalog jaxws_catalog.xml -Xno-addressing-databinding -extension -keep -d server\bin -s server\src example.wsdl


【说明】

Ø  如果需要指定引用本地wsdl或者xsd文件,需要加上-catalog参数:

wsimport –catalog catalogfile.xml -keep -d bin -s src wsdl/HelloService.wsdl

 

Ø  如果需要加入数据绑定,加上 –b参数:

wsimport –b bindingfile.xml –catalog catalogfile.xml -keep -d bin -s src wsdl/HelloService.wsdl

 

Ø  如果需要避免发布的时候还需要去找 http://www.w3.org/2005/08/addressing/ws-addr.xsd 及相关的xsd,加上参数-Xno-addressing-databinding –extension

其中:如果不指定 -Xno-addressing-databinding参数,将使用JDK自带的 addressing,

 

wsimport –b bindingfile.xml –catalog catalogfile.xml -Xno-addressing-databinding –extension -keep -d bin -s src wsdl/HelloService.wsdl

 

Ø  -b 绑定文件的配置例子:

<jaxws:bindings wsdlLocation="JVTTroubleTicketSession.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
<jxb:globalBindings
fixedAttributeAsConstantProperty="true" typesafeEnumBase="xs:string"
choiceContentProperty="false" typesafeEnumMaxMembers="50"
enableFailFastCheck="false" generateIsSetMethod="false"
underscoreBinding="asCharInWord" generateElementProperty="false">
<jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"/>

</jxb:globalBindings>
</jaxws:bindings>
</jaxws:bindings>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值