Quantcast
Channel: Wael Hamze » Dynamics CRM
Viewing all articles
Browse latest Browse all 20

Dynamics CRM 2011 Organization Service Tracing

$
0
0

In Dynamics CRM 4.0 you used to be able to run Fiddler to look at the contents of the HTTP requests being made to the CRM Service. When playing with the Dynamics CRM 2011 SDK i was curious to have a look at the messages that are being send across the wire between my development PC and the Dynamics CRM Organization service. This can be useful to look sometimes at what is happening behind the scenes when you work with the early bound model/LINQ and also when debugging various scenarios. When trying to run Fiddler on an on-premise deployment i noticed that the messages were encrypted. So i figured another way to achieve this using WCF standard mechanism since the CRM Service and SDK libraries are build around the WCF stack. All you need to do is put the sample cconfiguration below to your application configuration file. This will log any messages that are send and received on the client side. All you have to do now is open the trace log file with the Service Trace Viewer (SvcTraceViewer.exe). A similar mechanism can also be adoped on the server side.

  <system.diagnostics>
    <sources>
      <source name ="System.ServiceModel.MessageLogging"
              switchValue="Verbose, ActivityTracing">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
           traceOutputOptions="LogicalOperationStack"
           initializeData="C:\log\CRMTrace.svclog" />
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
  <system.serviceModel>
    <diagnostics>
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="false"
           logMessagesAtServiceLevel="true"
           logMessagesAtTransportLevel="false"/>
    </diagnostics>
  </system.serviceModel>

I will show samples messages captured using the Fiddler and WCF traces for the code below.

            using (OrganizationServiceProxy proxy = CreateProxy())
            {
                WhoAmIRequest req = new WhoAmIRequest();
                WhoAmIResponse res = proxy.Execute(req) as WhoAmIResponse;
                Console.WriteLine("WhoAmIUserId: " + res.UserId);
                return res.UserId;
            }
Below is the Fiddler trace the request. As you can see nothing very useful.
 
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute</a:Action>
    <a:MessageID u:Id="_5">urn:uuid:e5c9ff4c-0752-4c24-9dbb-8ac49e6f4c46</a:MessageID>
    <a:ReplyTo u:Id="_6">
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPoxO2jGq+wmJNtFyl0vt7JzoAAAAA4Whc+xgnSU6m/mUlFbvDxSBygozH25xJqktDA+Roo0AACQAA</VsDebuggerCausalityData>
    <a:To s:mustUnderstand="1" u:Id="_7">http://[Server]/[Org]/XRMServices/2011/Organization.svc</a:To>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="uuid-4e6e29af-ab82-458e-9dbc-e8a0aac0342a-4">
        <u:Created>2011-04-09T22:02:06.117Z</u:Created>
        <u:Expires>2011-04-09T22:07:06.117Z</u:Expires>
      </u:Timestamp>
      <c:SecurityContextToken u:Id="uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4477" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <c:Identifier>urn:uuid:247def00-8dd1-47ee-b396-538ae9bcbc44</c:Identifier>
      </c:SecurityContextToken>
      <c:DerivedKeyToken u:Id="_0" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4477"/>
        </o:SecurityTokenReference>
        <c:Offset>0</c:Offset>
        <c:Length>24</c:Length>
        <c:Nonce>X/8UYVFOuWcc6UTL/OqAvQ==</c:Nonce>
      </c:DerivedKeyToken>
      <c:DerivedKeyToken u:Id="_1" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4477"/>
        </o:SecurityTokenReference>
        <c:Nonce>sdrDI626w2V+kUT5XKE3Mg==</c:Nonce>
      </c:DerivedKeyToken>
      <e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:DataReference URI="#_3"/>
        <e:DataReference URI="#_8"/>
      </e:ReferenceList>
      <e:EncryptedData Id="_8" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
          <o:SecurityTokenReference>
            <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#_1"/>
          </o:SecurityTokenReference>
        </KeyInfo>
        <e:CipherData>
          <e:CipherValue>MkIW8r9bYxpZnDE5UhgsxgHS2Y28jm9sY0KKZVS+sPIKpxek/rVJeyWsnplje8pxaJV6/+VrTsdmK25WXbKQ3P+A7XPkutdeIXFIrKCFeYBD7L6hNOPtaf+I7i2yoDEEYM9FGhdgpOS1hrmmux38ekXMwj069Xz+hflhmabFSJHooMZHGmVHOhZJQxkk9+++IYH3s5XV++1oq2JC1O3AmyLSK8rn/gRmZau8ZqcI4xZOGmtp1QGE3Yg7k+Yx+lFkEfmtkNJ0wnxDxJ3JZjDjwLQWbapOARNTH0CRQj00Hp5MQRuCYWETmTj61Z5OudX6Y38+nPvDc5Ty5i8ca6C+iKvf4QmIUNvkFmc/mvBsbcZpof1dd6fmmEK70uEGVPQbOo3S+fHpANCL7ALiD9nGLqeuEG1F5rjRW0wHI6AnXlo5kxndpQX/oxPPzfTuT8Inp+8EWLJHiVn+O+DLQTCijsv4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51WkRJKxoNAYt2fPLkMwVDs3yG6Xrh4XEa5I6RjtrjrI64IAsiPfVVAYoLXRjDKVSczfkJuy4BUa7PA2z8skQ4i/+rGmnWXNk4lN8SH7qk8OyjugHMM8N5i1</e:CipherValue>
        </e:CipherData>
      </e:EncryptedData>
    </o:Security>
  </s:Header>
  <s:Body u:Id="_2">
    <e:EncryptedData Id="_3" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
      <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
        <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#_1"/>
        </o:SecurityTokenReference>
      </KeyInfo>
      <e:CipherData>
        <e:CipherValue>naQiwhfpoT8xWJ72S9E62+dkbV/RKc9idba5I5UyeMvchrE8DWpsPFeiNlSvvR8SpgVgE7S1f7HuqhRgqOiB4QBPbiWUZRycMVo7f2Suj+uJ3/hTxB51MpZ9jEYGf3Vbi2qjrgUN1BEWg/R5yYbWUB1hsXzaL6ccqIqgI4hHWhX55te6lvg0bs7CwfKZorLYY7+1UeMkaDEu83Dsy6O4oYKfKSyRDRpFRRzG0kk/H50bDut4Jl8NlO/L6HRROVOZLShuttymxlkEdAsojZm7g1MKiff1imUcfxJoSUYETYl6hXd8EKADiS22vhc+3F4ZXCux/exy2STxgBei8OYsLH3mV6SS2yKyLUG1yyMSScXjKPYRFtd9Ku1rzl7YYBabm+5l59vIwAgN8pK+NRuVuNwpgU9ARNDWOYb5dllS6OBNc3S7U7ANNEL+FOsWSv71PtyttWFn8anecWaTnnm85qe4VA97rEmArJw3cSZ0YFt7cHfuR1miCjek2sU3DY5zuCrAi5ObBjvy40/1iB3vv6rLkm2KJzksyhFO2OXd8rilMpnE6Yp+aWn5Zjujjz+YH8oQGfEkxOAE+wKOOXGpUzhnAIoAmYxyL0hTaBe6eokOUKONvxiZtpR5T86mjNry</e:CipherValue>
      </e:CipherData>
    </e:EncryptedData>
  </s:Body>
</s:Envelope>

Again below this is the Fiddler trace for the response message.

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/ExecuteResponse</a:Action>
    <a:RelatesTo u:Id="_5">urn:uuid:e5c9ff4c-0752-4c24-9dbb-8ac49e6f4c46</a:RelatesTo>
    <ActivityId CorrelationId="cf45b67e-ea16-4a0b-b9fa-cafc8b70ac8e" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">00000000-0000-0000-0000-000000000000</ActivityId>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4480">
        <u:Created>2011-04-09T22:02:14.688Z</u:Created>
        <u:Expires>2011-04-09T22:07:14.688Z</u:Expires>
      </u:Timestamp>
      <c:DerivedKeyToken u:Id="_0" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:247def00-8dd1-47ee-b396-538ae9bcbc44" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct"/>
        </o:SecurityTokenReference>
        <c:Offset>0</c:Offset>
        <c:Length>24</c:Length>
        <c:Nonce>deNjAhrA3jpalpOD2mfjSg==</c:Nonce>
      </c:DerivedKeyToken>
      <c:DerivedKeyToken u:Id="_1" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:247def00-8dd1-47ee-b396-538ae9bcbc44" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct"/>
        </o:SecurityTokenReference>
        <c:Nonce>dCRq0bmNk5BYAs++nDBFrQ==</c:Nonce>
      </c:DerivedKeyToken>
      <e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:DataReference URI="#_3"/>
        <e:DataReference URI="#_6"/>
      </e:ReferenceList>
      <e:EncryptedData Id="_6" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
          <o:SecurityTokenReference>
            <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#_1"/>
          </o:SecurityTokenReference>
        </KeyInfo>
        <e:CipherData>
          <e:CipherValue>aigA7nWL7kS6sGtoAyXXZjgZUn7TlWoa8vjaut609vNpE2ijl/6g1obAwizJXVZskbRW9Y2cEGqisxbe/3zv9KVEywiYiI7IEB98lORGFc+U8zJVWxWuuNZRMGQU6u1ypA5Aj9FF3mYwWeUmuHzmjrLYemiin3VBojne/jsG55APbaRMit8N1jNRg4cNBqI/3Tak0w4GvKycs0hqi7KDvQURlT/Io9EoYNzzKSKcC7B5CWov2hqoVjBd0SWQKT084msZ2JGZhmjtvsitHFG9a7HQtSGIVvE46EDt208D+2v7Mjvh6E467Y5cRh2fbOZY0VrmhBvrzI8Glx52aPlvAm6pBXzjJCQtnikEG6n0DEh3nLhfGBt4d+PuPNamUloAbmYgxKT4EtRWKtkey0NCKye5Ge/MBjx+u02B39AU2y6yoyKrMSC058IGL0yGNPqrwWCPNLtiWRllye7HOJ+U7fIrtTW+fVUYwxhsxejNHX8qld2059zx7OALyn4Z8KgyCQOzLOE0ZU6mminSBx7sgkcJT4Ez3hiYUz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otrbrq6C9qUOl8TWKqGNos4Efnot3OoFtSdu/LC6rDRszUXM8m87aLqNYNkEXwVqKCCceamSUeHSjmB37qCau2mS6brVGRdNZiOctK70JGsGT8jKSnSbBGLYJ9TsrmW9DDFr2RA+qwgBj75h3oFJtgX4lTi3CPDs2yrW7rOKdBPuo5XU6Y5lzTCFL2eMAO1PJduXuyyUihWiopIuM82CtpsPodfa/sFvjguFbQc7o1/wvEPBd3jXt/ZYDToF3WqUdw55jOs0iqNL2JLGc45nXgcYHyarZCp9HVPtwcK7cjXDtkz/4x51XZU3aDcLI96KPjoa1QaulKqgrwccZXHcz8I0Zo8rvc25Mxctd3B7lF0uNhAj4T7nLs9IOQ1X3B1aZgXRx7aXDNRzEeBeO7GPUEfq3KKqfkJYsfo9uFjJDXo5R8GHDmUV1QHULILNwkYeY31yg9d0SgB53PGjiohm3ug5PZ0mBHShBfUCuBpRcq9fa2h</e:CipherValue>
        </e:CipherData>
      </e:EncryptedData>
    </o:Security>
  </s:Header>
  <s:Body u:Id="_2">
    <e:EncryptedData Id="_3" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
      <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
        <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#_1"/>
        </o:SecurityTokenReference>
      </KeyInfo>
      <e:CipherData>
        <e:CipherValue>5HSblwEyHFKE78RidjYtxVfsh8oOfFBH6afHqreaRmfeD0Tokt8g1bhZheACIOX6T/lTcI7wuMJL57A0Yi/qZSsZ9NpecnkbRiN3hUs+e+9JxyG3rf7q3by58yb6/4fR3Hl+xVz6yzcjU2gTcBoZoB3seXu3UQZoIsI9YZ9ci0eeOY3wqOoNxv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/64/m5ymwbNhFZZXNlaMNHctAk7inwULBIzC2KH9wPKgFLDjTNh1s+Pd4BiVgvzMP1wwH4EW1EstwhqZefmJpQDXWQPLSkl3CqySMMe1E/EsGLxn/n/8n2iYc2mnxZY6yjbzWCa8vlt8aWZAX5h7KCHvJpM+7gqAmLBqWpuNwdjDVAfynqNaWH6gRjUOHqbfLcIfCkAvtWAivY9kWlU48zqScwTdUb9KiMVGP01X7rw3tpKpYp+H1lR6u3jQSSnU8sr1XEVIs3Z</e:CipherValue>
      </e:CipherData>
    </e:EncryptedData>
  </s:Body>
</s:Envelope>

Now below is the WCF trace at the service level that shows the actual contents of the SOAP request.

<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute</a:Action>
    <a:MessageID>urn:uuid:e5c9ff4c-0752-4c24-9dbb-8ac49e6f4c46</a:MessageID>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink"></VsDebuggerCausalityData>
  </s:Header>
  <s:Body>
    <Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
      <request xmlns:d4p1="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d4p3="http://schemas.microsoft.com/crm/2011/Contracts" i:type="d4p3:WhoAmIRequest">
        <d4p1:Parameters xmlns:d5p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic"></d4p1:Parameters>
        <d4p1:RequestId i:nil="true"></d4p1:RequestId>
        <d4p1:RequestName>WhoAmI</d4p1:RequestName>
      </request>
    </Execute>
  </s:Body>
</s:Envelope>

Finally below is the WCF trace at the service level that shows the actual contents of the SOAP response. You can see the details about the executing user.

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action s:mustUnderstand="1" u:Id="_4" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/ExecuteResponse</a:Action>
    <a:RelatesTo u:Id="_5" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:e5c9ff4c-0752-4c24-9dbb-8ac49e6f4c46</a:RelatesTo>
    <ActivityId CorrelationId="cf45b67e-ea16-4a0b-b9fa-cafc8b70ac8e" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">00000000-0000-0000-0000-000000000000</ActivityId>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4480" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <u:Created>2011-04-09T22:02:14.688Z</u:Created>
        <u:Expires>2011-04-09T22:07:14.688Z</u:Expires>
      </u:Timestamp>
      <c:DerivedKeyToken u:Id="_0" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:247def00-8dd1-47ee-b396-538ae9bcbc44" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct"></o:Reference>
        </o:SecurityTokenReference>
        <c:Offset>0</c:Offset>
        <c:Length>24</c:Length>
        <c:Nonce>
          <!-- Removed-->
        </c:Nonce>
      </c:DerivedKeyToken>
      <c:DerivedKeyToken u:Id="_1" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:247def00-8dd1-47ee-b396-538ae9bcbc44" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct"></o:Reference>
        </o:SecurityTokenReference>
        <c:Nonce>
          <!-- Removed-->
        </c:Nonce>
      </c:DerivedKeyToken>
      <e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:DataReference URI="#_3"></e:DataReference>
        <e:DataReference URI="#_6"></e:DataReference>
      </e:ReferenceList>
      <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
          <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
          <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"></SignatureMethod>
          <Reference URI="#_2">
            <Transforms>
              <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
            <DigestValue>CM5e0byUp3ccAE2dGzBmaEoULOQ=</DigestValue>
          </Reference>
          <Reference URI="#_4">
            <Transforms>
              <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
            <DigestValue>T5XEnhEHcT3kntcAeWTHEDElkHg=</DigestValue>
          </Reference>
          <Reference URI="#_5">
            <Transforms>
              <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
            <DigestValue>qUejK6uFN8IMPRBGOgD0T+IRpYk=</DigestValue>
          </Reference>
          <Reference URI="#uuid-8fcc72f9-4325-4918-84d2-20233d35381a-4480">
            <Transforms>
              <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
            <DigestValue>TY+iuqtq/ZKovc0vC9ZKFPMEttQ=</DigestValue>
          </Reference>
        </SignedInfo>
        <SignatureValue>Z6DV7dz+0wTs9aeynb/6KC04Pcs=</SignatureValue>
        <KeyInfo>
          <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#_0"></o:Reference>
          </o:SecurityTokenReference>
        </KeyInfo>
      </Signature>
    </o:Security>
  </s:Header>
  <s:Body u:Id="_2" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <ExecuteResponse xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
      <ExecuteResult i:type="b:WhoAmIResponse" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.microsoft.com/crm/2011/Contracts">
        <a:ResponseName>WhoAmI</a:ResponseName>
        <a:Results xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <a:KeyValuePairOfstringanyType>
            <c:key>UserId</c:key>
            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">8179fcb3-fb55-e011-ab42-005056b863d7</c:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <c:key>BusinessUnitId</c:key>
            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">a6fa9e52-564a-e011-ab42-005056b863d7</c:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <c:key>OrganizationId</c:key>
            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">dec6a83f-564a-e011-ab42-005056b863d7</c:value>
          </a:KeyValuePairOfstringanyType>
        </a:Results>
      </ExecuteResult>
    </ExecuteResponse>
  </s:Body>
</s:Envelope>

Hope you find this useful.



Viewing all articles
Browse latest Browse all 20

Trending Articles