3.3 XML Element Attachment

It is often desirable to associate policies with Web services policy subjects represented as XML elements (i.e., WSDL 1.1 elements - Section 4. Attaching Policies Using WSDL 1.1 for the specific details of WSDL attachment).

Since policy assertions are strongly typed by the authors, the precise semantics of how element policy is to be processed once discovered is domain-specific; however, implementations are likely to follow the precedent specified in the section below on WSDL [WSDL 1.1] and Policy.

This specification defines a global attribute that allows policy expressions to be attached to an arbitrary XML element. The following is the schema definition for the wsp:PolicyURIs attribute:

(01) <xs:schema>
(02)   <xs:attribute name="PolicyURIs">
(03)     <xs:simpleType>
(04) 	<xs:list itemType="xs:anyURI" />
(05)     </xs:simpleType>
(06)   </xs:attribute>
(07) </xs:schema>

The namespace URI [XML Namespaces] for this attribute is http://www.w3.org/@@@@/@@/ws-policy.

The wsp:PolicyURIs attribute contains a white space-separated list of one or more IRIs [IETF RFC 3987]. When this attribute is used, each of the values identifies a policy expression as defined by [Web Services Policy Framework]. If more than one IRI is specified, the individual referenced policies need to be merged together to form a single element policy expression. The resultant policy is then associated with the element information item's element policy property. [Definition: The element policy is the policy attached to the policy subjects associated with the element information item that contains it.]

Note that the policy scope of the attachment is specific to the policy attachment Mechanism using it; accordingly, any policy attachment mechanism using this attribute MUST define the policy scope of the attachment.

An example of element policy through the use of this global attribute is given below using the sample policies stated in Section 2.4 Example.

If the policies referenced by the following XML element

(01) <MyElement wsp:PolicyURIs="
(02)    http://www.example.com/policies#RmPolicy
(03)    http://www.example.com/policies#X509EndpointPolicy" />

have been processed and merged, it would result in an element policy whose XML 1.0 representation is listed in Example 3-1:

Example 3-1. Example Merged Policy Expression.

(01) <wsp:Policy
        xmlns:rmp="http://docs.oasis-open.org/ws-rx/wsrmp/200602"
        xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
        xmlns:wsp="http://www.w3.org/@@@@/@@/ws-policy" >
(02)   <rmp:RMAssertion>
(03)     <rmp:InactivityTimeout Milliseconds="600000" />
(04)       <rmp:BaseRetransmissionInterval Milliseconds="3000" />
(05)       <rmp:ExponentialBackoff />
(06)       <rmp:AcknowledgementInterval Milliseconds="200" />
(07)     </rmp:RMAssertion>
(08)   <sp:AsymmetricBinding>
(09)     <wsp:Policy>
(10)       <!-- Details omitted for readability -->
(11)       <sp:IncludeTimestamp />
(12)       <sp:OnlySignEntireHeadersAndBody />
(13)     </wsp:Policy>
(14)   </sp:AsymmetricBinding>
(15) </wsp:Policy>

Note that this element policy has no meaningful IRI.

The presence of the wsp:PolicyURIs attribute does not prohibit implementations from using additional mechanisms for associating policy expressions with XML-based constructs.

Alternatively, rather than using the global attribute, XML elements may MAY use the wsp:Policy or wsp:PolicyReference elements directly as children, in order to support element policy (Per Section 4.3.4 Policy References of Web Services Policy 1.5 - Framework [Web Services Policy Framework]), and the semantics for this are the same as for the use of the global attribute. For example, an alternative way of attaching the policies in the above example, using child elements, would be as follows: 

(01) <MyElement>
(02)   <wsp:PolicyReference
(03)      URI="http://www.example.com/policies#RmPolicy" />
(04)   <wsp:PolicyReference
(05)      URI="http://www.example.com/policies#X509EndpointPolicy" />
(06) <MyElement/>