Wrapper vs Bare (Non-wrapper)
2012-01-27 22:57
363 查看
Wrapper和Bare不是WSDL定义的某种标准,而是JAX-WS和JAX-RPC定义的两种代码组织方式。只有document/literal才有Wrapper和Bare的形式,RPC不存在这种分别。
document/literal/wrapper
document/literal/bare
RPC/literal - 这种方式是WS-I BP支持的,但是在实际使用中已经不推荐了。
同样一个WSDL定义文件可以同时生成Wrapper和Bare方式的两套代码。它们的差别只在代码的格式上。参见JAX-WS 2.0 specification 2.3.1.3 Example 或如下代码。对于Wrapper方式,JAX-WS通过SOAP消息中root element的名字来查找方法(它们的名字必须是一致的),而Bare方式则是通过方法参数的类型来匹配的。通过Bare方式匹配的方法的参数必须和SOAP消息里的XML binding的数据类型是一致的。所以Wrapper方式不支持在SEI (Service
Endpoint Interface) 中有Overloaded的方法(同名不同参数),而Bare方式同样不支持SEI中有同参数不同名的方法。
<!-- WSDL extract -->
<types>
<xsd:element name="setLastTradePrice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tickerSymbol" type="xsd:string"/>
<xsd:element name="lastTradePrice" type="xsd:float"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="setLastTradePriceResponse">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
</types>
<message name="setLastTradePrice">
<part name="setLastTradePrice" element="tns:setLastTradePrice"/>
</message>
<message name="setLastTradePriceResponse">
<part name="setLastTradePriceResponse" element="tns:setLastTradePriceResponse"/>
</message>
<portType name="StockQuoteUpdater">
<operation name="setLastTradePrice">
<input message="tns:setLastTradePrice"/>
<output message="tns:setLastTradePriceResponse"/>
</operation>
</portType>
// non-wrapper style mapping
SetLastTradePriceResponse setLastTradePrice(
SetLastTradePrice setLastTradePrice);
// wrapper style mapping
void setLastTradePrice(String tickerSymbol, float lastTradePrice);
http://myarch.com/wrappernon-wrapper-web-service-styles-things-you-need-to-know
document/literal/wrapper
document/literal/bare
RPC/literal - 这种方式是WS-I BP支持的,但是在实际使用中已经不推荐了。
同样一个WSDL定义文件可以同时生成Wrapper和Bare方式的两套代码。它们的差别只在代码的格式上。参见JAX-WS 2.0 specification 2.3.1.3 Example 或如下代码。对于Wrapper方式,JAX-WS通过SOAP消息中root element的名字来查找方法(它们的名字必须是一致的),而Bare方式则是通过方法参数的类型来匹配的。通过Bare方式匹配的方法的参数必须和SOAP消息里的XML binding的数据类型是一致的。所以Wrapper方式不支持在SEI (Service
Endpoint Interface) 中有Overloaded的方法(同名不同参数),而Bare方式同样不支持SEI中有同参数不同名的方法。
<!-- WSDL extract -->
<types>
<xsd:element name="setLastTradePrice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tickerSymbol" type="xsd:string"/>
<xsd:element name="lastTradePrice" type="xsd:float"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="setLastTradePriceResponse">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
</types>
<message name="setLastTradePrice">
<part name="setLastTradePrice" element="tns:setLastTradePrice"/>
</message>
<message name="setLastTradePriceResponse">
<part name="setLastTradePriceResponse" element="tns:setLastTradePriceResponse"/>
</message>
<portType name="StockQuoteUpdater">
<operation name="setLastTradePrice">
<input message="tns:setLastTradePrice"/>
<output message="tns:setLastTradePriceResponse"/>
</operation>
</portType>
// non-wrapper style mapping
SetLastTradePriceResponse setLastTradePrice(
SetLastTradePrice setLastTradePrice);
// wrapper style mapping
void setLastTradePrice(String tickerSymbol, float lastTradePrice);
http://myarch.com/wrappernon-wrapper-web-service-styles-things-you-need-to-know
相关文章推荐
- Node.js[译] Overview of Blocking vs Non-Blocking
- Atomic vs nonatomic properties
- 【VS开发】VS2013多字节工程问题uilding an MFC project for a non-Unicode character set is deprecated
- java direct buffer VS non-direct buffer
- Cacheable VS Non-Cacheable
- arm-none-linux-gnueabi vs arm-linux – EABI vs Non-EABI
- asynchronous vs non-blocking
- java direct buffer VS non-direct buffer
- const vs non-const
- mongodb导入csv报错 Failed: line 1, column 1428: bare " in non-quoted-field
- zigbee中的CSMA-CA载波检测多路访问-碰撞避免和信标(Beacon)VS非信标(Nonbeacon)网络
- nonblocking vs blocking funny example
- VS2013error MSB8031: Building an MFC project for a non-Unicode character set is deprecated. You must
- const vs non-const
- Blocking vs. non-blocking sockets
- python3 nonlocal vs global
- Direct vs non-direct ByteBuffer
- python global vs nonlocal (2)
- Gotcha: Wokflow designer not working when openning workflow in non-workflow VS 2005 project
- NON Empty vs NONEMPTY()