<policyDocument> Element

The root element for a policy file.

<policyDocument xmlns="https://microsoft.com/wse/2003/06/Policy">
  <mappings>
  </mappings>
  <policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns:wsp="https://schemas.xmlsoap.org/ws/2002/12/policy"
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  </policies>
</policyDocument>

Attributes and Elements

Attributes

None.

Child Elements

Element Description

<mappings> Element

Required element. Contains zero or more mappings between a policy and an endpoint.

<policies> Element

Required element. Contains zero or more policy assertions.

Parent Elements

None.

Remarks

To implement send-side or receive-side policy for an application, you must create, and then configure, a policy file in the application's configuration file. To create a policy file, create an XML document with a root XML element of <policyDocument>. To the <policyDocument> element, add policy assertions that specify a given requirement and mappings that map a requirement to a specific endpoint. After you create the policy file, configure it for an application by using the <policy> Element (WSE for Microsoft .NET) (2). For details about policy, see Configuring a Web Service's Policy.

Example

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

<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="https://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings>
    <endpoint uri="http://www.cohowinery.com/x509signing.asmx">
      <defaultOperation>
        <request policy="#signed-body-x509" />
        <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-x509">
      <wssp:Integrity wsp:Usage="wsp:Required">
        <wssp:TokenInfo>
          <wssp:SecurityToken>
            <wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3</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) (2)
<mappings> Element
<policies> Element

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy