<MessageAge> Element

Specifies the maximum active period for a SOAP message.

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

<wsse:MessageAge wsp:Usage="required" Age="600" />

Attributes and Elements

Attributes

Attribute Description

wsp:Usage

Required attribute. Specifies how to process the message expiration requirement. Setting the attribute to wsp:Required specifies that the SOAP message must meet the message expiration assertion.

Age

Required attribute. Specifies the maximum expiration time for a SOAP message, in seconds. This value must be greater than zero.

Child Elements

None.

Parent Elements

Element Description

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

Specifies a SOAP message requirement.

Remarks

To satisfy a policy assertion that contains a <MessageAge> element, the SOAP message must contain a WS-Timestamp SOAP header with an expiration period of less than or equal to that specified in the Age attribute. The expiration period is the difference between the <Expires> and <Created> elements in the WS-Timestamp SOAP header.

The following table lists the possible values for the wsp:Usage attribute, as defined by the WS-Policy specification. WSE only supports the wsp:Required value for the wsp:Usage attribute. That is, only "required" assertions will get their policy enforcers invoked during enforcement.

Value Description

wsp:Required

Indicates that SOAP messages must expire within the time specified in the assertion.

wsp:Rejected

Indicates that SOAP messages that expire within the time specified in the assertion are explicitly not supported.

wsp:Optional

Indicates that SOAP messages can optionally expire within the time specified in the assertion.

wsp:Observed

Indicates that SOAP messages must expire within the time specified in the assertion.

wsp:Ignored

Indicates that SOAP messages are not processed to determine if they meet this message expiration requirement.

Example

The following code example defines a default policy assertion named message-age-20s that requires all SOAP messages to expire within 20 seconds.

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>
    <defaultEndpoint>
      <defaultOperation>
        <request policy="#message-age-20s" />
        <response policy="" />
        <fault policy="" />
      </defaultOperation>
    </defaultEndpoint>
  </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">
    <!--This policy ensures that messages are 20 seconds old or newer.-->
    <wsp:Policy wsu:Id="message-age-20s">
      <wssp:MessageAge wsp:Usage="wsp:Required" Age="20" />
    </wsp:Policy>
  </policies>
</policyDocument>

See Also

Reference

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

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy