3.1.5 Processing Events and Sequencing Rules

When the server receives a request that contains a SOAP ActivityId Header Block, the server MUST process the header block and save the ActivityId contained in the header. The server MUST echo the ActivityId sent by the client in its response message. Future related requests from the client typically continue to use the same ActivityId (as specified in section 3.2.5). This allows implementers to infer causality relationships between messages, and to determine the set of messages that led up to (and result from) an error.

The following figure shows a typical message exchange sequence with corresponding data.

Sequence of a request-reply message exchange

Figure 2: Sequence of a request-reply message exchange

Every server participating in correlated tracing using the .NET Tracing Protocol MUST implement processing to receive and send the SOAP ActivityId Header Block. Participation can be externally configured. The following state diagram shows the receiving end of a server participating in correlated activity tracing. A state diagram showing the sending portion of server participation follows later in this section.

State of a server receiving a request when Correlation Mode is enabled

Figure 3: State of a server receiving a request when Correlation Mode is enabled

The request-response messaging consists of a request message from client to server and a corresponding response message from server to client. When the server is sending a response for the request that included the SOAP ActivityId Header Block and Correlation Mode is enabled, it MUST insert an ActivityId XML element into the SOAP header of the response. It MUST use the ActivityId, which is always set to the ActivityId received in the request. The CorrelationId attribute of the ActivityId element MUST be a newly generated unique GUID string.

When the server is sending a response for the request that did not include the SOAP ActivityId Header Block and the server is configured to participate in correlated tracing, it MUST insert a SOAP ActivityId Header Block into the SOAP header of the response with the value of ActivityId being a newly generated unique GUID string. The CorrelationId attribute of the ActivityId element MUST be a newly generated unique GUID string.

The following state diagram shows the sending end of a server participating in correlated activity tracing.

State of a server sending a response when participating in correlated activity tracing

Figure 4: State of a server sending a response when participating in correlated activity tracing