IDispatchMessageInspector to log plain-text soap messages?
Posted
by
Dan Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Dan Thomas
Published on 2010-01-06T16:49:49Z
Indexed on
2010/12/23
14:54 UTC
Read the original article
Hit count: 288
I've written a WCF IDispatchMessageInspector, so I can log incomming and outgoing messages. But I'm not sure how to get a nicely-formatted XML string to log.
My code looks something like this:
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue);
request = buffer.CreateMessage();
Log("Received", request.ToString();
return null;
}
The result of this logging includes things like "ampersand lt;" and some sort of binary-encoded data.
How do I get something that looks like a standard soap XML document? I know this should be obvious, but I'm just too dense to figure it out.
Thanks.
Dan
© Stack Overflow or respective owner