Share via


<defaultOperation> Element

Defines the default policy to apply for SOAP messages that match the criteria in the enclosing <endpoint> Element element.

<policyDocument> Element
  <mappings> Element
    <endpoint> Element
      <policyDocument> Element
        <mappings> Element
          <defaultEndpoint> Element

<defaultOperation>
  <request policy="policy name" />
  <response policy="policy name" />
  <fault policy="policy name" />
</defaultOperation>

Attributes and Elements

Attributes

None.

Child Elements

Element Description

<request> Element (WSE for Microsoft .NET)

Optional element. The policy to apply to SOAP requests received by this endpoint.

<response> Element (WSE for Microsoft .NET)

Optional element. The policy to apply to SOAP responses sent by this endpoint.

<fault> Element

Optional element. The policy to apply to SOAP faults thrown by this endpoint

Parent Elements

Element Description

<endpoint> Element

Defines the policy to use for SOAP messages that are sent to or received by a Web service.

<defaultEndpoint> Element

Defines the default policy for all SOAP messages that are sent to or received by Web services affected by the policy file.

Remarks

The enclosing <endpoint> Element element can contain zero or one <defaultOperation> element.

In order for a SOAP message to have the policy applied to it, the WS-Addressing <to> element must match the uri attribute of the <endpoint> Element element.

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. The policy file then specifies that all SOAP messages adhere to the policy assertion if they are sent to the http://www.cohowinery.com/Service1.asmx endpoint.

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/Service1.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">
    <!--This policy requires that the body be digitally signed by an X509 security token.-->
    <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

<endpoint> Element
<defaultEndpoint> Element
<operation> Element

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy