Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
WSE 2.0
Reference
Policy File Schema
 <MessageParts> Element for <Confide...
Collapse All/Expand All Collapse All
Web Services Enhancements 2.0 Service Pack 2
<MessageParts> Element for <Confidentiality> Element

Specifies the parts of the SOAP message that must be encrypted.

<policyDocument> Element
  <policies> Element
    <Policy> Element (WSE for Microsoft .NET) (1)
      <Confidentiality> Element
<MessageParts Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part" >
  wsp:Body() wse:UsernameToken()
</MessageParts>

Attributes

Attribute Description

Dialect

Required attribute. Specifies the expression dialect to use to express the parts of a SOAP message.

Child Elements

None.

Parent Elements

Element Description

<Confidentiality> Element

Specifies the encryption requirements for a SOAP message.

WSE supports only the "http://schemas.xmlsoap.org/2002/12/wsse#part" dialect, as specified in the WS-PolicyAssertions specification.

To specify the parts of the message, add values separated by spaces to the value of the <MessageParts> element. Each value represents an XML element, which is known as a message part.

The following table lists the valid values for the <MessageParts> element.

Value Description

wsp:Body()

Specifies the encryption requirements for the <Body> element of the SOAP envelope.

wse:UsernameToken()

Specifies all Username tokens in the message. This assumes that the wse namespace prefix is mapped to the http://schemas.microsoft.com/wse/2003/06/Policy namespace.

The following code example defines a policy assertion named encrypted-body-x509 that requires the encryption of the <Body> element by an X509SecurityToken and requires that SOAP messages sent to the http://www.cohowinery.com/Service1.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="http://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings>
    <endpoint uri="http://www.cohowinery.com/Service1.asmx">
      <defaultOperation>
        <request policy="#encrypted-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="http://schemas.microsoft.com/wse/2003/06/Policy"
            xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
            xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
            xmlns:wssc="http://schemas.xmlsoap.org/ws/2004/04/sc"
            xmlns:rp="http://schemas.xmlsoap.org/rp">
    <!--This policy requires that the body be encrypted by an X509
        security token.-->
    <wsp:Policy wsu:Id="encrypted-body-x509">
      <wssp:Confidentiality wsp:Usage="wsp:Required">
        <wssp:KeyInfo>
          <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:KeyInfo>
        <wssp:MessageParts xmlns:rp="http://schemas.xmlsoap.org/rp" Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()</wssp:MessageParts>
      </wssp:Confidentiality>
    </wsp:Policy>
  </policies>
</policyDocument>
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker