More on simple tracing in Indigo

A fellow Indigette, Dan Roth, pointed out to me via e-mail and a comment on my earlier blog entry, that I'd neglected to explain *why* the service level message logs contain SOAP headers that were not actually transmitted by the client. This entry attempts to make up for my earlier omission.
 
The binding I've used in my samples so far does not actually use WS-Addressing on the wire. This means that the messages sent by the client don't actually contain wsa:To or wsa:Action headers. However, it is possible to infer the values of those headers from the HTTP Request-URI and the SOAPAction HTTP header respectively. When a message arrives at the service the server-side plumbing for the binding creates the wsa:To and wsa:Action headers and populates the message object with them. This means that other parts of the plumbing (and the application code, if it cares) don't need to worry about whether the message actually used WS-Addressing or not (at least WRT wsa:To and wsa:Action); the values can always be pulled out of the same place, namely the Headers property of the System.ServiceModel.Message object;
 
  System.ServiceModel.Message.Headers.To
  System.ServiceModel.Message.Headers.Action
 
Inside a the Ping method on the service side, we can get at this information via OperationContext.Current;
 
  OperationContext.Current.IncomingMessageHeaders.To
  OperationContext.Current.IncomingMessageHeaders.Action
 
We could also use
 
  OperationContext.Current.RequestContext.RequestMessage.Headers.To
  OperationContext.Current.RequestContext.RequestMessage.Headers.Action
 
which is slightly more long winded, but shows how you'd get hold of the actual System.ServiceModel.Message object, should you need it.
 

Posted May 22 2005, 05:24 AM by martin-gudgin
Filed under: ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?