SOAP学习笔记(1)

一 SOAP Roles and SOAP Nodes

** SOAP node

**

The embodiment of the processing logic necessary to transmit, receive, process and/or relay a SOAP message, according to the set of conventions defined by this recommendation. A SOAP node is responsible for enforcing the rules that govern the exchange of SOAP messages (see ** 2. SOAP Processing Model ** ). It accesses the services provided by the underlying protocols through one or more SOAP bindings.

** SOAP role

**

A SOAP receiver's expected function in processing a message. A SOAP receiver can act in multiple roles.

【理解】

SOAP node 是一个实际存在的节点,该节点可以处理 SOAP 消息, SOAP node 是一种物理上的概念; SOAP role 是处理 SOAP 消息时, SOAP node 所扮演的角色,是一个逻辑上的概念。一个 SOAP node 可以扮演多个 SOAP role ,一个 SOAP role 也可以由多个 SOAP node 所扮演。

二 预定义的 SOAP role

** Short-name

**

|

** Name

**

|

** Description

**

---|---|---

next

|

"http://www.w3.org/2003/05/soap-envelope/role/next"

|

Each SOAP intermediary and the ultimate SOAP receiver MUST act in this role.

none

|

"http://www.w3.org/2003/05/soap-envelope/role/none"

|

SOAP nodes MUST NOT act in this role.

ultimateReceiver

|

"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"

|

The ultimate receiver MUST act in this role.

三 处理 SOAP 消息的过程

1. Determine the set of roles in which the node is to act. The contents of the SOAP envelope, including any SOAP header blocks and the SOAP body, MAY be inspected in making such determination.

2. Identify all header blocks targeted at the node that are mandatory.

3. If one or more of the SOAP header blocks identified in the preceding step are not understood by the node then generate a single SOAP fault with the Value of Code set to "env:MustUnderstand" (see 5.4.8 SOAP mustUnderstand Faults ). If such a fault is generated, any further processing MUST NOT be done. Faults relating to the contents of the SOAP body MUST NOT be generated in this step.

4. Process all mandatory SOAP header blocks targeted at the node and, in the case of an ultimate SOAP receiver, the SOAP body. A SOAP node MAY also choose to process non-mandatory SOAP header blocks targeted at it.

5. In the case of a SOAP intermediary, and where the SOAP message exchange pattern and results of processing (e.g. no fault generated) require that the SOAP message be sent further along the SOAP message path, relay the message as described in section 2.7 Relaying SOAP Messages .

四 Relaying SOAP Messages (relayable SOAP header blocks)

** Role

**

|

** Header block

**

---|---

** Short-name

**

|

** Assumed

**

|

** Understood & Processed

**

|

** Forwarded

**

next

|

Yes

|

Yes

|

No, unless reinserted

No

|

No, unless relay ="true"

user-defined

|

Yes

|

Yes

|

No, unless reinserted

No

|

No, unless relay ="true"

No

|

n/a

|

Yes

ultimateReceiver

|

Yes

|

Yes

|

n/a

No

|

n/a

none

|

No

|

n/a

|

Yes

【理解】

所谓 Relaying SOAP Message ( SOAP 消息重放)仅是在 SOAP node 处理一个 Header Block ,但却因为不能理解该 Header block ( can’t understand )而忽略该 Header block 时才有意义,(这个 Header block 没有设置 mustUnderstand 为 true ,否则无法理解时应返回一个 SOAP Fault ,而不是继续向前传递 SOAP 消息,这时也没有 relay 的意义)。这时若 Header block 的 relay 属性为 true ,则 SOAP node 必须将该 Header block 保留在 SOAP 消息中,并向前转发给下一个 SOAP node 。

总结来说, SOAP 消息重放仅对 SOAP 中间节点( SOAP intermediary )有意义,并且仅当该中间节点无法处理一个需由它处理但又未设置 mustUnderstand 属性为 true 的 Header block 时有意义,该 Header block 将被保留在 SOAP 消息中,并向前转发给下一个 SOAP node 。

五 SOAP 中间节点生成的 SOAP 消息

SOAP 中间节点必须按照第三部分所描述的方式处理其收到的 SOAP 消息,并按以下方式生成一个新的 SOAP 消息,并将其向前传递给下一个 SOAP node 。

  1. Remove all processed SOAP header blocks.

  2. Remove all non-relayable SOAP header blocks that were targeted at the forwarding node but ignored during processing.

  3. Retain all relayable SOAP header blocks that were targeted at the forwarding node but ignored during processing.

  4. Insert or reinsert some header blocks if the soap intermediary determined to do that. The header blocks that were inserted or reinserted might be indistinguishable from one or more of the header blocks removed by the intermediary. Processing is defined here in terms of re-inserting header blocks (rather than leaving them in place) to emphasize the need to process them at each SOAP node along the SOAP message path.

Published At
Categories with Web编程
Tagged with
comments powered by Disqus