<policies> Element

Contains the policy assertions for the policy file.

<policyDocument> Element

<policies>
  <wsp:Policy wsu:Id="NameOfPolicy">
  </wsp:Policy>
</policies>

Attributes and Elements

Attributes

None

Child Elements

Element Description

<Policy> Element (WSE for Microsoft .NET) (1)

Required element. Specifies a policy assertion.

Parent Elements

Element Description

<policyDocument> Element

The root element for a policy file.

Remarks

The <policies> element can contain zero or more <Policy> Element (WSE for Microsoft .NET) (1) elements, which define a policy assertion. Each policy assertion can then be mapped to zero or more specific endpoints by adding <endpoint> Element elements to the <mappings> Element element.

Example

The following code example defines a policy assertion named signed-body-username that requires the digital signing of the <Body> element, timestamp header, and all addressing headers by a UsernameToken and requires that SOAP messages sent to the http://www.cohowinery.com/usernamesigning.asmx endpoint adhere to the policy assertion.

Note

This code example is designed to demonstrate WSE features and is not intended for production use.

<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="https://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings>
    <endpoint uri="http://www.cohowinery.com/usernamesigning.asmx">
      <defaultOperation>
        <request policy="#signed-body-username" />
        <response policy="" />
        <fault policy="" />
      </defaultOperation>
    </endpoint>
  </mappings>
  <policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            xmlns:wse="https://schemas.microsoft.com/wse/2003/06/Policy"
            xmlns:wsa="https://schemas.xmlsoap.org/ws/2004/03/addressing"
            xmlns:wssp="https://schemas.xmlsoap.org/ws/2002/12/secext"
            xmlns:wsp="https://schemas.xmlsoap.org/ws/2002/12/policy"
            xmlns:wssc="https://schemas.xmlsoap.org/ws/2004/04/sc"
            xmlns:rp="https://schemas.xmlsoap.org/rp">
    <wsp:Policy wsu:Id="signed-body-username">
      <wssp:Integrity wsp:Usage="wsp:Required">
        <wssp:TokenInfo>
          <wssp:SecurityToken>
            <wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</wssp:TokenType>
          </wssp:SecurityToken>
        </wssp:TokenInfo>
        <wssp:MessageParts xmlns:rp="https://schemas.xmlsoap.org/rp" Dialect="https://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body() wse:Timestamp() wse:Addressing()</wssp:MessageParts>
      </wssp:Integrity>
    </wsp:Policy>
  </policies>
</policyDocument>

See Also

Reference

<Policy> Element (WSE for Microsoft .NET) (1)
<mappings> Element

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy