WS-Policy Tutorial
Web service contracts can be extended with policies that express additional constraints, requirements, and qualities that typically relate to the behaviors of services. You can create human-readable policies that become part of a supplemental service-level agreement, or you can define machine-readable polices that are processed at runtime.
Name Spaces and prefix
* xmlns:wsp="http://www.w3.org/2006/07/ws-policy" – This represents the actual namespace used for elements from the WS-Policy language.
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" –
We will show some policy examples related to the WS-Addressing
language, which is why this namespace comes up here. How the referenced
WS-Addressing features actually work is covered in Chapter 18 and this particular policy assertion is further revisited at the end of Chapter 19.
* xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702" –
This namespace corresponds to the WS-ReliableMessaging policy
assertion. Although WS-ReliableMessaging is not a technology covered in
this book, there are a few references to one of its policy assertions
in the examples.
* xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" –
There is a special type of schema that is referred to as a "utility
schema" in which generic and commonly used attributes are established.
One such attribute is wsu:Id, a
simple ID used to associate an identifier with an element. This and
other chapters make occasional reference to this attribute.
There are two ways of attaching policies to WSDL documents:
The policy expression code can be embedded within the WSDL definition and then utilized via native references that can be attached directly to WSDL elements as child extensibility elements.
Policy expressions can reside externally in a separate WS-Policy definition document, which is then referenced within the WSDL document via an external attachment mechanism.
Policy Attachment Points and Policy Subjects
Whatever part of a WSDL definition we attach a policy to is referred to as a policy attachment point. For example, we could have a policy attached to an operation element and then another to one of that operation's message elements.
Within WSDL 1.1, the following elements represent common policy attachment points:
service element
port element
binding element
portType element
operation element
message element
The policy attachment specification organizes these policy attachment points into the following four distinct policy subjects:
Service (maps to service element in wsdl)
Endpoint (maps to port, binding, portType)
Operation (maps to Operation element in wsdl)
Message
Note: This is work in progress more updates to follow
source:Thomas Erl- Web service Contract Design and versioning for SOA
