1

In a WCF message, is maxDepth calculated beginning with the soap envelope element?

For example, is the following message considered 5 levels deep?

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <ExecuteResponse xmlns="http://tempuri.org/">
            <ExecuteResult>
                <res>0</res>
            </ExecuteResult>
        </ExecuteResponse>
    </soap:Body>
</soap:Envelope>
gravidThoughts
  • 613
  • 5
  • 18
  • Since [MSDN](http://msdn.microsoft.com/en-us/library/ms731325.aspx) says "A positive integer that specifies the maximum **nested node** depth per read. The default is 32.", I would think that the calculation would start after the Envelope node. – Tim Jul 04 '13 at 03:53
  • I thought the same, but it appears that the calculation includes the envelope node. – gravidThoughts Jul 05 '13 at 14:41

1 Answers1

2

Went ahead and tested it. The calculation starts with the envelope node being level 1.

The following message throws an exception if maxDepth is set to 7. It succeeds if maxDepth is set to 8.

  <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
      <a:Action s:mustUnderstand="1">http://ws.lhotka.net/WcfDataPortal/IWcfPortal/Update</a:Action>
      <a:MessageID>urn:uuid:423cf7a3-18b7-47e8-a9f3-399e51db6b34</a:MessageID>
      <ActivityId CorrelationId="3716b91d-7552-4cba-8cfd-649ef7e1a1c3" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">c26b4ac3-3327-48ad-ac84-7dc56a241b57</ActivityId>
      <a:ReplyTo>
        <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
      </a:ReplyTo>
      <a:To s:mustUnderstand="1">http://localhost/Callisto/WcfAppServer.svc</a:To>
    </s:Header>
    <s:Body>
      <Update xmlns="http://ws.lhotka.net/WcfDataPortal">
        <request z:Id="1" z:Type="Csla.Server.Hosts.WcfChannel.UpdateRequest" z:Assembly="Csla, Version=3.8.3.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30" xmlns:b="http://schemas.datacontract.org/2004/07/Csla.Server.Hosts.WcfChannel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
          <b:_context z:Id="2" xmlns:c="http://schemas.datacontract.org/2004/07/Csla.Server">
            <c:_clientContext i:nil="true" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays"></c:_clientContext>
            <c:_clientCulture z:Id="3">en-US</c:_clientCulture>
            <c:_clientUICulture z:Ref="3" i:nil="true"></c:_clientUICulture>
            <c:_globalContext i:nil="true" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays"></c:_globalContext>
            <c:_principal z:Id="4" z:Type="System.Security.Principal.GenericPrincipal" z:Assembly="0">
              <m_identity z:Id="5" z:Type="System.Security.Principal.GenericIdentity" z:Assembly="0" xmlns="http://schemas.datacontract.org/2004/07/System.Security.Principal">
                <m_name z:Id="6"></m_name>
                <m_type z:Ref="6" i:nil="true"></m_type>
              </m_identity>
              <m_roles z:Id="7" z:Size="1" xmlns="http://schemas.datacontract.org/2004/07/System.Security.Principal" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                <d:string z:Ref="6" i:nil="true"></d:string>
              </m_roles>
            </c:_principal>
            <c:_remotePortal>true</c:_remotePortal>
          </b:_context>
          <b:_object z:Id="8" z:Type="Callisto.Business.Commands.InitializeServerSystemSettings" z:Assembly="Callisto.Business, Version=0.0.28.0, Culture=neutral, PublicKeyToken=null">
            <_fieldManager i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Csla.Core" xmlns:c="http://schemas.datacontract.org/2004/07/Csla.Core.FieldManager"></_fieldManager>
            <mbResult xmlns="http://schemas.datacontract.org/2004/07/Callisto.Business.Commands">false</mbResult>
          </b:_object>
        </request>
      </Update>
    </s:Body>
  </s:Envelope>
gravidThoughts
  • 613
  • 5
  • 18