WebService 学习笔记

本文深入探讨了JAX-WS2.0作为JAX-RPC1.1的后续版本,在SOAP互操作性、WSDL支持以及HTTP绑定方面的特性。特别关注了SOAPBinding风格与使用的兼容性问题,提供了部署webservice时的关键参数设置指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Java API for XML Web Services (JAX-WS) 2.0 (JSR 224) Standard Implementation (SI)
JAX-WS2.0是JAX-RPC 1.1 (JSR 101)的后续版本。

1. JAX-WS 仍然支持 SOAP 1.1 over HTTP 1.1,因此互操作性将不会受到影响,仍然可以在网上传递相同的消息。
2. JAX-WS 仍然支持 WSDL 1.1,因此您所学到的有关该规范的知识仍然有用。WSDL 2.0 规范已经接近完成,但在 JAX-WS 2.0 相关工作结束时其工作仍在进行中。
3. JAX-RPC 和 JAX-WS 都支持 SOAP 1.1。JAX-WS 还支持 SOAP 1.2。
4. WSDL 1.1 规范在 HTTP 绑定中定义,这意味着利用此规范可以在不使用 SOAP 的情况下通过 HTTP 发送 XML 消息。
5. JAX-RPC 忽略了 HTTP 绑定。而 JAX-WS 添加了对其的支持。
6. JAX-RPC 支持 WS-I Basic Profile (BP) V1.0。JAX-WS 支持 BP 1.1。(WS-I 即 Web 服务互操作性组织。)

在JAX-WS时代,wscompile已经被wsimport与wsgen代替。wsimport用于导入wsdl并生成可移植性组件(artifact)wsgen生成编译后的SEI并生成可移植性组件(artifact). 当前wsgen并不产生wsdl.WSDL在部署的时候产生。但通过配置项可让wsgen产生wsdl。
wscompile主于用于早期的RPC,使用wscompile需要编写一个config.xml文件,作为wscompile的输入。


昨天在GF3上部署webservice,在webserivce上添加了SOAPBinding(style=Style.RPC),[这个annotation最好写在类层次上,写在方面层次上容易与出现与类出现冲突],结果部署失败。后来发现写成SOAPBinding(style=Style.RPC,use=literal)才可以。从Google上找到一点证据:RPC/encoded is not a supported style/use mode with JAX-WS 2.0. JAX-WS2.0 is fully compliant with the WS-I Basic Profile 1.1 which mandates literal mode. The supported style/use modes are: rpc/literal and document/literal.

JAX-WS 中的SoapBinding目前支持3种方式:

1)Document Wrapped:
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,use=SOAPBinding.Use.LITERAL,parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
2)Document Bare:
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,use=SOAPBinding.Use.LITERAL,parameterStyle=SOAPBinding.ParameterStyle.BARE)
3)RPC:
@SOAPBinding(style=SOAPBinding.Style.RPC,use=SOAPBinding.Use.LITERAL,parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)


另外 The java.util.Collection classes cannot be used with rpc/literal or document/literal BARE style     due to a limitation in JAXB. However, they do work in the default document/literal WRAPPED style

看来JWS的革命性变化还是挺大的。还能不能玩呀。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值