Hooking into the Transport layer of WCF
Question
I want to prepend the following text to the response body of a WCF operation:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="transform.xslt" type="text/xsl" ?>
Problem is that the Message class uses XML Readers and Writers to specify the contents of the message. Inserting this text as the first line after the tag makes the Message not well formatted.
So where does the Message object get read and the body contents written to the HTTP response stream? That is where I want to insert the two lines above.
Solution 2
What I needed was a custom MessageEncoder.
OTHER TIPS
It's called Interception, and you can define your own custom interceptions. Take a look at the following links with explanations and samples: http://msdn.microsoft.com/en-us/library/ms751495.aspx http://blogs.msdn.com/drnick/archive/2007/03/07/message-flow-interception-points.aspx