4.1 Sample SOAP Messages

The following examples depict two SOAP messages that contain the SOAP ActivityId Header Block in the SOAP header. The SOAP messages are request and response messages associated with a request-response message exchange pattern. The examples show a complete SOAP envelope, but the discussion focuses only on the SOAP ActivityId Header Block.

The following is a sample request message that includes the SOAP ActivityId Header Block. The sample shows a standard SOAP envelope with a body and a header. The header element contains an <ActivityId> element. The value of ActivityId is "43ffa660-a0c6-4249-bb36-648b73a06213" and the CorrelationId attribute is "7224e2a9-8f9c-4acb-a924-17cb6af67b23".

 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
     <Action s:mustUnderstand="1" 
       xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">
       http://tempuri.org/IService/MyOperation
     </Action>
     <ActivityId CorrelationId="7224e2a9-8f9c-4acb-a924-17cb6af67b23"
 xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">
       43ffa660-a0c6-4249-bb36-648b73a06213</ActivityId>
   </s:Header>
   <s:Body>
     <MyOperation xmlns="http://tempuri.org">
       <MyValue>Some Value</MyValue>
     </MyOperation>
   </s:Body>
 </s:Envelope>

The following is a sample response to the request discussed earlier. The header element for the message includes the <ActivityId> element. As per section 3.1.1, the ActivityId value is the same as received in the request ("43ffa660-a0c6-4249-bb36-648b73a06213"). The protocol also specifies that the CorrelationId attribute is different from the CorrelationId received in the request. In the example, the CorrelationId associated with the response is a new GUID string value ("b898336e-d4e2-4eb7-a2c7-1e23f4630646").

  
 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
     <Action s:mustUnderstand="1"
       xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">
       http://tempuri.org/IService/MyOperation
     </Action>
     <ActivityId CorrelationId="b898336e-d4e2-4eb7-a2c7-1e23f4630646" 
 xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">
       43ffa660-a0c6-4249-bb36-648b73a06213</ActivityId>
   </s:Header>
   <s:Body>
     <MyOperationResponse xmlns="http://tempuri.org">
       <MyOperationResult>
         <MyValue>Some Value</MyValue>
       </MyOperationResult>
     </MyOperationResponse>
   </s:Body>
 </s:Envelope>

The activity trace generated at the client and server ends for the request and response is expected to maintain a correlation with the value of ActivityId ("43ffa660-a0c6-4249-bb36-648b73a06213"). Section 4.2 provides examples of traces with such a correlation.