MessageInspector can intercept the underlying messages of WCF service operation calls. However, this is not the only way for intercepting and customizing messages in a WCF service. In WCF extension architecture, there is another powerful component called
MessageEncoder, which can also perform customization on the underlying messages of WCF service operation calls.
In this recipe, we will demonstrate how we can use a custom MessageEncoder to alter the raw message of a WCF service operation.
The sample service will use a custom
MessageEncoder component to customize the SOAP XML content of each service operation call. The entire process will be as follows: