The WCF MessageEncoder Decoded 1

The MessageEncoder

MessageEncoders typically inhabit Transport Channels, although MessageEncoders can be used elsewhere in the Channel Stack. Often, a MessageEncoder’s sole purpose is to turn the bytes coming over the wire into a WCF Message Class representation.

Typically, bytes on the wire are a Multipurpose Internet Mail Extensions (MIME) content type. MIME support is a WCF cornerstone. WCF is also built for SOAP-based interactions. In fact, WCF comes equipped to handle multiple SOAP versions and various forms of XML data. MessageEncoders shipping with WCF can build messages from various content and SOAP protocols.

So, with all this support for content and protocols, why would you build your own MessageEncoder?

Why Build Your Own?

As you may have guessed, not all data coming over the wire can be neatly categorized and packaged. Therefore, creating a Message class representation may require some custom handling. Custom handling may entail data decrypting/encrypting or may be supplemented by an additional source.

Other reasons for building your own MessageEncoder is tht you may want to utilize a custom Message class throughout your Channel Stack or you may want to apply a transformation to the incoming data as you create a Message class.

Whatever the case when writing your own MessageEncoder, you will probably apply the same general formula and toolset. Now, you’re going to explore the sample code and I’m going to share the formula and toolset for building your own MessageEncoder.

Tags: , , , , ,

This entry was posted on Monday, May 12th, 2008 at 5:25 pm and is filed under xml. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 

2 Responses to “The WCF MessageEncoder Decoded 1”

  1. Votexml » The WCF MessageEncoder Decoded 2 Says:

    […] the MessageEncode is embedded inside of a WCF. As stated earlier, normally a MessageEncoder inhabits a Transport […]

  2. The WCF MessageEncoder Decoded 3 | Votexml Says:

    […] is the base class for all MessageEncoders. MessageEncoder contains overridable versions of the overloaded ReadMessage and WriteMessage […]

Leave a Reply