jax-ws 学习笔记

本文详细介绍了如何使用JAX-WS2.0规范中的Provider<Source>机制来开发和部署RESTful Web服务。具体探讨了不同格式的数据如何被接收,并总结了Provider类型的合规性要求及其在不同模式下的有效组合。

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

A Provider-based endpoint can receive data in javax.xml.transform.Sourcejavax.activation.DataSource or javax.xml.soap.SOAPMessage formats. It can work in either payload or message mode. JAX-WS specification has a conformance requirement (Provider support required) that defines the combinations of the Provider type, the mode and SOAP/HTTP or XML/HTTP binding. Additionally, the message on the service endpoint may be received as SOAP message (does not matter 1.1 or 1.2) or a mime multipart message. The table below summarizes the requirement with all the possible combinations.

 XML/HTTPSOAP/HTTP

Provider<Source>

PayloadPrimary part or content as SourceSOAP Body from the primary part or SOAP Body as Source
MessagePrimary part or content as SourceSOAP Envelope from the primary part or SOAP Envelope as Source

Provider<DataSource>

PayloadNot Valid [1]Not Valid [1]
MessageDataSource as an objectNot Valid [2]

Provider<SOAPMessage>

PayloadNot Valid [3]Not Valid [3]
MessageNot Valid [4]SOAPMessage as an object

Provider<Source> may receive a mime multipart message or an XML message. If it is a mime multipart message, then the primary part for XML/HTTP and SOAP Envelope for SOAP/HTTP is extracted and converted to the Source for payload mode. The primary part, in the case of mime multipart message, must contain XML data for XML/HTTP binding. If it is an XML message then the content for XML/HTTP (irrespective of mode) is converted to the Source. The XML message is converted to SOAP message and SOAP Body or Envelope for SOAP/HTTP (depending upon the mode) is converted to the Source.

[1] Provider<DataSource> is used for sending attachments and thus payload mode is not valid.

[2] Provider<DataSource> in SOAP/HTTP is not valid since attachments in SOAP are sent using Provider<SOAPMessage>.

[3] Provider<SOAPMessage> in payload mode is not valid because the entire SOAPMessage is received, not just the payload which corresponds to the body of the SOAPMessage.

[4] Provider<SOAPMessage> in message mode using XML/HTTP binding is not valid since the client may have sent an XML message that may not be SOAP.

Provider<Source>-based endpoints using XML/HTTP binding allows you to develop and deploy RESTful Web services with JAX-WS 2.0. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值