All methods on System.ServiceModel.Channels.Message
allow you to read the message body only once and fail if it is called after the message has been read. The msdn documentation confirms that only the body of the message can be read. However, if you call ToString()
on an already read message, you seem to get the entire envelope for soap, body and all.
Thus, in my case, it would be possible to access the body even after it has been read, if only its methods allow it.
Is there something I am missing here? Does ToString()
as a workaround so that the body is not reliable in some situations?
In my case, I work on some error logs for some WCF operations and get the original message from OperationContext.RequestContext.RequestMessage
. I am logging the message with ToString()
, because this is the only way to find so that I can log the body of the message.
source share