# Patent

## Title
Encoding/decoding while allowing varying message formats per message

## Abstract

Encoding and/or decoding of messages. On the encoding end, a composite encoder encodes message from an internal format that is used by internal system components into an external format. However, the composite encoder may encode the outgoing messages into different external formats on a per-message basis. For incoming message, a composite decoder decodes incoming messages from any one of a plurality of external formats into the internal format also on a per-message basis. A per-message report mechanism permits internal system components and the encoding/decoding components to communicate information regarding the encoding or decoding on a per message basis. This permits a higher level of collaboration and complexity in the encoding and decoding process.

## Background
BACKGROUND
The Windows Communication Foundation and other distributed system platforms have a decoding process, in which an external representation (or format) of a message is converted into some internal representation (or format). The external representation of the message is more suited towards the delivery system to get the message into and out of the system, whereas the internal representation can be processed by the system itself. An example of a common internal representation is, for example, eXtensible Markup Language (XML) or Infoset data. Likewise, the system has an encoding process in which an internal representation of a message is converted into some external representation for transport.
Traditionally, the choice of external message formats is static. All messages originating from a certain endpoint are encoded into the same format, and all messages accepted by a certain endpoint are expected to be in a certain format. There is conventionally some level of format auto-detection capabilities for incoming messages. For example, some conventional systems can automatically detect whether an incoming message is using UTF8 or UTF16 character encoding or whether the message is plain XML or is it an MTOM (Message Transmission Optimization Mechanism) message. However, these format differences are not significant enough that different processing is needed further up in the stack. Accordingly, once a basic transform is applied during decoding, no other action need be taken in order to accept the message.
BRIEF SUMMARY
At least some embodiments described herein relate to mechanisms for encoding outgoing messages and/or decoding incoming messages. On the encoding end, a composite encoder encodes messages from an internal format that is used by internal system components into an external format. However, the composite encoder may encode the outgoing messages into different external formats on a per-message basis. A per-message report mechanism permits the internal system components to write encoding informing on a per-message basis, thereby allowing the internal system components to control how particular outgoing messages are encoded. In one embodiment, a programming component offers a programming model that allows a programmer to control the encoding used for particular outgoing messages.
For incoming messages, a composite decoder decodes incoming messages from any one of a plurality of external formats into the internal format also on a per-message basis. The composite decoder is capable of reporting decoding information to the per-message report mechanism, and perhaps is also capable of reading decoding information from the per-message report mechanism. The internal system components might also read the decoding information, allowing such internal system components to perform format-specific processing of the incoming message, even though the internal system components may not have access to the incoming message in its original external format.
In one embodiment, the number of external formats supported by the encoding and/or decoding is extensible. This may be accomplished by adding new encoding components, rather than changing the entire system. Accordingly, a flexible encoding and decoding mechanism is described that allows a system to interface with messages of a variety of external formats, without requiring that the internal system components work directly with all of those external formats. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.



BRIEF DESCRIPTION OF THE DRAWINGS
In order to describe the manner in which the above-recited and other advantages and features can be obtained, a more particular description of various embodiments will be rendered by reference to the appended drawings. Understanding that these drawings depict only sample embodiments and are not therefore to be considered to be limiting of the scope of the invention, the embodiments will be described and explained with additional specificity and detail through the use of the accompanying drawings in which:
FIG. 1 illustrates an example computing system in which embodiments described herein may be employed;
FIG. 2 illustrates an example encoding environment and message flow; and
FIG. 3 illustrates an example decoding environment and message flow.



DETAILED DESCRIPTION
In accordance with embodiments described herein, a flexible mechanism for encoding outgoing messages and/or decoding incoming messages is described. On the encoding end, a composite encoder encodes messages from an internal format that is used by internal system components into an external format. However, the composite encoder may encode the outgoing messages into different external formats on a per-message basis. A per-message report mechanism permits the internal system components to write encoding informing on a per-message basis, thereby allowing the internal system components to control how particular outgoing messages are encoded. In one embodiment, a programming component offers a programming model that allows a programmer to control the encoding used when encoding an outgoing message.
For incoming message, a composite decoder decodes incoming messages from any one of a plurality of external formats into the internal format also on a per-message basis. The composite decoder is capable of reporting decoding information to the per-message report mechanism, and perhaps is also capable of reading decoding information from the per-message report mechanism. The internal system components might also read the decoding information, allowing such internal system components to perform format-specific processing of the incoming message, even though the internal system components may not have access to the incoming message in its original external format.
First, some introductory discussion regarding a computing system that may be used to operate an encoding and decoding environment will be described with respect to FIG. 1. Then, various embodiments of the encoding and decoding mechanism will be described with respect to FIGS. 2 and 3.
Computing systems are now increasingly taking a wide variety of forms. Computing systems may, for example, be handheld devices, appliances, laptop computers, desktop computers, mainframes, distributed computing systems, or even devices that have not conventionally considered a computing system. In this description and in the claims, the term “computing system” is defined broadly as including any device or system (or combination thereof) that includes at least one processor, and a memory capable of having thereon computer-executable instructions that may be executed by the processor. The memory may take any form and may depend on the nature and form of the computing system. A computing system may be distributed over a network environment and may include multiple constituent computing systems.
As illustrated in FIG. 1, in its most basic configuration, a computing system 100 typically includes at least one processing unit 102 and memory 104. The memory 104 may be physical system memory, which may be volatile, non-volatile, or some combination of the two. The term “memory” may also be used herein to refer to non-volatile mass storage such as physical storage media. If the computing system is distributed, the processing, memory and/or storage capability may be distributed as well. As used herein, the term “module” or “component” can refer to software objects or routines that execute on the computing system. The different components, modules, engines, and services described herein may be implemented as objects or processes that execute on the computing system (e.g., as separate threads).
In the description that follows, embodiments are described with reference to acts that are performed by one or more computing systems. If such acts are implemented in software, one or more processors of the associated computing system that performs the act direct the operation of the computing system in response to having executed computer-executable instructions. An example of such an operation involves the manipulation of data. The computer-executable instructions (and the manipulated data) may be stored in the memory 104 of the computing system 100.
Computing system 100 may also contain communication channels 108 that allow the computing system 100 to communicate with other message processors over, for example, the network 110. Communication channels 108 are examples of communications media. Communications media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism and include any information-delivery media. By way of example, and not limitation, communications media include wired media, such as wired networks and direct-wired connections, and wireless media such as acoustic, radio, infrared, and other wireless media. The term computer-readable media as used herein includes both storage media and communications media.
Embodiments within the scope of the present invention also include computer-readable media for carrying or having computer-executable instructions or data structures stored thereon. Such computer-readable media can be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise physical storage and/or memory media such as RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store desired program code means in the form of computer-executable instructions or data structures and which can be accessed by a general purpose or special purpose computer. When information is transferred or provided over a network or another communications connection (either hardwired, wireless, or a combination of hardwired or wireless) to a computer, the computer properly views the connection as a computer-readable medium. Thus, any such connection is properly termed a computer-readable medium. Combinations of the above should also be included within the scope of computer-readable media.
Computer-executable instructions comprise, for example, instructions and data which cause a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described herein. Rather, the specific features and acts described herein are disclosed as example forms of implementing the claims.
FIG. 2 illustrates encoding environment 200 showing an example message flow associated with the encoding of outgoing messages. FIG. 3 shows a decoding environment 300 showing an example message flow associated with the decoding of incoming messages. The encoding environment 200 and the decoding environment 300 may be shared to provide an environment that does both encoding and decoding. However, the broadest principles described herein are not limited to performing both encoding and decoding, but perhaps could just include encoding, or perhaps just including decoding. This encoding/decoding architecture makes it possible to operate systems in a format-independent way, and allows for new formats to be added in the future by only changing the encoding/decoding components, rather than having to modify the rest of the system.
The encoding environment 200 and/or the decoding environment 300 may be operated using the computing system 100 of FIG. 1, although that is not required. If implemented using the computing system 100, the various components of the encoding environment 200 and decoding environment 300 may be instantiated in memory 104 upon computer-executable instructions of a computer program product being executed by the one or more processors 102. The network 110 may be used for message exchange, although messages may be exchanged between internal components of the computing system 100 as well.
First, the flow of encoding will be described with respect to the encoding environment 200 of FIG. 2. In the encoding example, three messages 201A, 202A, and 203A are subjected to encoding to thereby generate corresponding encoded messages 201B, 202B and 203B. Specifically, messages 201A, 202A and 203A are provided from one or more internal system components 210 to a composite encoder 220.
The system components 210 operate internal to a particular system. There may be quite a number of components operating internally to a system. However, the system components 210 are illustrated as including two system components 211 and 212. The vertical ellipses 213 represents that there may be other numbers (one, or three or more) of system components operating within a system. Complex systems may include numerous system components.
At least some of the system components 210 are configured to operate upon messages having a particular message format. Such a format may be referred to hereinafter as an “internal message format” since they are message formats usable by internal system components 210. In FIGS. 2 and 3, all of the messages are symbolically illustrated as having a particular shape (either a circle, a triangle, or a square). In this symbolism, messages having the same shape are of a common message format. Messages having different shapes are of a different message format.
For instance, messages 201A, 202A and 203A each are symbolized as being circles. This represents that each of the messages 201A and 202A and 203A are of the same message format. This message format is the message format that the internal system components 210 are configured to operate with. As an example, perhaps that message format is eXtensible Markup Language (XML) or Infoset. In that case, the internal system components 210 would be configured to operate using XML messages. However, as will be explained, even though the internal system components 210 are configured to operate with a limited number of internal message formats (and perhaps just one message format), the principles described herein allow systems to communicate outwardly using a variety of message formats.
There is no requirement regarding the timing of delivery of the messages 201A, 202A and 203A to the composite encoder 220. One may be delivered after the other at any time. Nevertheless, they are shown together to show how each message may be encoded differently using the composite encoder 220. The ellipses 204A represents that there may be yet other messages provided by the internal system components 210 to the composite encoder 220. In one embodiment, there may be one composite encoder 220 for each endpoint that the internal system components 210 sends and/or receives messages from. Accordingly, the composite encoder may contain endpoint specific configuration information such as, for example, whether to encode using UTF-8, Unicode, or other text encoding formats.
The composite encoder 220 is configured to encode messages from the internal message format to a plurality of different external message formats on a per-message basis. An external format is a format that might be understood by components outside of the system. Although the composite encoder 220 is illustrated as a single component, the composite encoder 220 may be implemented as multiple collaborating components, and perhaps even nested components.
Back to the example message flow, message 201A is converted from an internal message format (e.g., XML) to a particular external message format as represented by encoded message 201B. In this case, the external message format is different than the internal message format. This is represented by the encoded message 201B being represented as a triangle, whereas before the message 201A was a circle. As an example, perhaps the triangle represents a binary message format.
Message 202A is converted from the internal message format into an encoded message 202B. In this case, the encoded message 202B is still in the same format as the original message 202A as each message 202A and 202B are symbolized as being circles. This demonstrates that the encoding process may not change the message format of the message, although some processing may be performed in the encoding.
Message 203A is converted from the internal message format into the encoded message 203B. In this case, the encoded message 203B is yet in another message format different than the internal message format. As an example, the square shape may symbolize JavaScript Object Notation (JSON). Although in some examples described herein, the internal message format is XML, and the external message formats are binary, XML, and JSON, the principles described herein may operate for any internal message format, and any number and identity of external message formats.
The composite encoder 220 is illustrated as including three constituent encoders 221, 222 and 223. Each constituent encoder may be responsible for encoding messages from the internal format into one of more external formats. In an example in which each encodes into only one external format, the encoder 221 might have encoded the message 201A into message 201B, the encoder 222 might have encoded the message 202A into message 202B, and encoder 223 might have encoded the message 203A into message 203B. For instance, encoder 221 might be a binary encoder, encoder 222 might be an XML encoder, and encoder 223 might be a JSON encoder.
The ellipses 224 represents that there may be other encoders suitable for encoding to yet other message formats. In fact, as will be described further herein, the composite encoder 220 is extensible to include additional encoders. Furthermore, the principles described herein are not even limited to currently existing message formats. As new message formats are developed, an appropriate encoder may be developed and added to the composite encoder 220.
The composite encoder 220 has associated therewith a selection mechanism 225 that selects, on a per-message basis, a constituent encoder to use when encoding a corresponding message. The principles described herein are not limited to how the selection mechanism 225 makes a selection decision. However, in one example, the selection mechanism 225 uses the content type of the corresponding message to identify a constituent encoder to use to encode that message. For instance, HyperText Transport Protocol (HTTP) messages contain headers that define a content type of the message contained in the HTTP message body. If, for example, the content type was image and sound data, perhaps a binary encoder would be selected. If, on the other hand, the content type was an object known to be in XML format, the XML encoder would be selected, and so forth.
In one specific implementation, the selection mechanism may in some cases be configured to make a selection of the encoder based on content type without even communicating with a constituent encoder. For instance, if for the moment, all outgoing messages are to be encoded as binary, the selection mechanism 225 may be temporarily at least configured to always select the binary encoder. Alternatively or in addition, the selection mechanism 225 may query the constituent encoders 221 through 223 themselves, perhaps in a predetermined order, as to whether they can encode messages of the designated content type. Once an encoder is found that can encode the designated content type, that encoder is selected to encode the message. This querying function of the selection mechanism 225 allows for additional constituent encoders to be added to the composite encoder 220. The additional constituent encoder would register with the selection mechanism 225 so that the encoder may be queried as to its capabilities to encode messages of a particular content type. Optionally, once the selection mechanism 225 is made aware of which encoder is capable of encoding which content type, the selection mechanism may cache that information for future encoder selection decisions.
In one embodiment, in which JSON, XML and binary are the supported external message formats, the selection mechanism might first query the JSON encoder, second the XML encoder, and third the binary encoder. Since a binary encoder is typically capable of handling encoding of all content types, the binary encoder may be a considered a fall-back encoder if the JSON and XML encoders could not encode a particular message.
The encoding environment also includes a per-message report mechanism 230, which allows information regarding the encoding (or decoding) of a message to be reported. For instance, information regarding the encoding of message 201A may be placed in location 231 of the report mechanism 230. Information regarding the encoding of message 202A may be placed in location 232 of the report mechanism 230. Information regarding the encoding of message 203A may be placed in location 233 of the report mechanism 230. The locations 231 through 233 may be in a centralized location, but alternatively, the locations 231 through 233 might actually be properties on the messages themselves. The ellipses 234 represents that there might be yet other locations for each other message encountered or to be encountered by the composite encoder 220
The arrow 241 represents that the composite encoder 220 may read encoding information from, and write encoding information to, the per-message report mechanism 230. Likewise, the arrow 242 represents that the internal system components 210 (or at least one of the internal system components) can read encoding information from, and write encoding information to, the per-message report mechanism.
If the encoding information specifies an actual encoding format to be applied to a message, the selection mechanism 225 may read that encoding format, and select the appropriate constituent encoder when encoding the message. In addition, the internal system components 210 may query the appropriate location to verify what encoding format a message will ultimately be sent using. This would allow the internal system component to make appropriate allowances and perform appropriate processing of a message given the information that the message will ultimately be encoded using a specific format.
For instance, suppose that a message is be encoded from an XML message format to a JSON message format, whereas another external format could have been XML. The JSON message format is fundamentally typed. For example, there is a difference between a number and a string in JSON message formats. XML format is fundamentally untyped in that everything, including numbers, is represented as strings. The encoding process from an XML internal format to a JSON external format would require type information, whereas if we are encoding to an XML message format, this type information would be superfluous. Thus, a serializer within the internal system components 210 could serialize differently (including or excluding type information as appropriate) depending on the encoding that the message will be subjected to.
In another example, one of the internal system components 210 might actually be a programming component that provides programming tools. A programmer might like to have some control over an encoding to be applied to a particular message. The programming tool might provide interfaces that allow the programmer to specify the encoding format.
The programming tool might also specify that a message is of a particular content type. This content type information may be provided into the per-message report mechanism 230. The composite encoder 220 may then override any contradicting default content type information that would be applied by the actual constituent encoder that performs the encoding, and instead would apply the content type designation instructed by the programmer.
The programming tool might also specify that a response to a message is of a particular content type. This content type information may be provided into the per-message report mechanism 230. When a response to the message is received, the selection mechanism 225 may use the content type information specified by the programmer, and select the appropriate decoder based on that content type.
For example, consider the following source code examples that might represent function calls offered by a programming component of the internal system components 210:

    [OperationContract] Person GetPerson( );
    ┌OperationContract┐ Stream GetPicture( );
    [WebInvoke(ResponseType=Json)] [OperationContract] Person GetPersonJson( );


The programming component (or perhaps some formatter/serializer-level code) may indicate to the encoding process that the GetPerson method is supposed to return a response that has an XML external message format, that the GetPicture method is supposed to return a response that has a binary external message format (e.g., an image), and that the GetPersonJson method is supposed to return a response that has a JSON external message format. Such indications may be provided into the per-message report mechanism 230.
FIG. 3 illustrates a decoding environment 300, which is quite similar to the encoding environment 200. In fact, the composite encoder 220 of FIG. 2 and the composite decoder 320 of FIG. 3 may be integrated into a single composite encoder/decoder. Also, the per-message reporting mechanism 330 of FIG. 3 may be the same as the per-message reporting mechanism 230 of FIG. 2. Likewise, the internal system components 310 of FIG. 3 may be the same as the internal system components 210 of FIG. 2.
In the decoding example, three messages 301B, 302B and 303B are received by the composite decoder 320. Other messages 304B may also be received. Each of the three messages 301B, 302B and 303B are of a different external format. For instance, similar to FIG. 2, message 301B may be a binary message format, message 302B may be an XML message format, and message 303B may be a JSON message format. The constituent decoders 321 through 324 of the composite decoder 320 may be the same as the corresponding constituent encoders 221 through 224 of the composite encoder 220.
The decoder 321 decodes encoded message 301B having one external format (e.g., binary) into message 301A having the internal message format (e.g., XML). The decoder 322 decodes encoded message 302B having external format (e.g., XML) into message 302A having the internal message format. The decoder 323 decodes encoded message 303B having one external format (e.g., JSON) into message 303A having the internal message format. Other messages may be decoded as represented by the vertical ellipses 304A. The system components 311 through 313 may then process the messages 301A through 304A since they are structured in the internal message format.
The per-message report mechanism 330 may be used by the composite decoder 320 and the internal system components 310 as an accessible location to store decoding information on a per-message basis.
The selection mechanism 325 may select the appropriate decoder 321 through 323 for each incoming message. The selection mechanism 325 may automatically detect an external format of each in-coming message. For instance, the selection mechanism 325 might examine the per-message report mechanism 330 to determine if there is any specified message format for the received message. The selection mechanism 325 might also identify a content type of the incoming message, then itself decide the appropriate decoder based on that content type. The selection mechanism 325 might also inquire of the decoders 321 through 323 as to whether they are capable of decoding messages of the particular designated content type.
Several examples will now be described illustrating how decoding information in the per-message report mechanism 330 may be used. In one example, the composite decoder might specify during the decoding process what the original external message format was corresponding to a particular incoming message. The internal system components may discover that external message format by querying the per-message report mechanism 330. The internal system components might then perform appropriate format specific processing depending on what the external message format was.
For example, consider an incoming message that could be either in XML or JSON message format, and consider a system where the internal message format is always XML. Both the incoming message having the XML external message format and the incoming message having the JSON external message format would be decoded to the XML internal message format. However, perhaps a different deserializer should be used when the message is processed further depending on whether the external message format was XML or JSON. One reason this might be is because XML is fundamentally an ordered format and JSON is fundamentally unordered, and the serializer needs to know whether to proceed in an ordered or unordered way.
In a programming model example, consider the following operation:

    [OperationContract] PutPerson(Person p);


In this case, perhaps the PutPerson method is desired to automatically select the right serializer (for JSON or XML) depending on whether an incoming message is in JSON or XML.
As a second example of using the decoding information, perhaps one of the internal system components is to validate whether or not an incoming message is valid depending on its external message format. If the incoming message format arrived in a valid external message format, the message may be validated, and otherwise rejected. The validation may be based on certain programming model constructs, such as inferring an acceptable data format automatically based on certain things such as the types used.
In a programming model example, consider the following operation:

    [OperationContract] PutPicture(Stream s);


In this case, perhaps the method PutPicture is to only accept binary messages. The decoding information allows validation of the corresponding binary message.
As previously mentioned, the decoding information allows one or more of the internal system components 310 to perform further processing in a format-dependent way. After this processing, the message may further be represented in yet other internal system components in a format-independent way. For instance, once the message is validated or deserialized depending on the external message format, the message may then be further processed using its internal message format, regardless of what its external message format was.
Accordingly, the principles described herein permit a flexible mechanism for encoding and/or decoding messages across a variety of external message formats. The present invention may be embodied in other specific forms without departing from its spirit or essential characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the invention is, therefore, indicated by the appended claims rather than by the foregoing description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope.

## Claims

1. A method, implemented in a computing environment comprising at least one processor operatively coupled to a memory, for selectively encoding messages formatted with an internal format into a plurality of different external formats on a per-message basis, the method comprising:
receiving a message formatted with an internal format at a composite encoder/decoder that comprises a plurality of constituent encoders and decoders, the encoders configured to encode messages from the internal format to a plurality of different external message formats on a per-message basis, wherein each of the plurality of constituent encoders encodes messages into at least one of the plurality of different external message formats, and wherein the internal format is processable by one or more internal system components;
consulting a per-message encoding/decoding report mechanism that includes encoding/decoding information that comprises selection of an appropriate external message format into which to encode the message as an outgoing message as well as selection of a decoding format corresponding to a response to the outgoing message, wherein the encoding information is written to the per-message encoding/decoding report mechanism by at least one of the one or more internal system components on a per-message basis;
selecting the appropriate external message format based on consulting the per-message encoding report mechanism and the encoding information, wherein selecting the appropriate external message format comprises using a content type corresponding to the message;
selecting an appropriate encoder from among the plurality of constituent encoders based on selecting the appropriate external message format, wherein the appropriate encoder encodes messages into the appropriate external message format; and
encoding the message into the outgoing message with the appropriate encoder, such that the outgoing message is formatted with the external message format.

2. The method of claim 1, wherein the at least one of the one or more internal system components permits a programmer to select the appropriate external message format corresponding to a particular the message.

3. The method of claim 1, wherein the at least one of the one or more internal system components permits a programmer to select the decoding format corresponding to the response to the outgoing message.

4. The method of claim 1, wherein the internal format comprises eXtensible Markup Language (XML) or Infoset format.

5. The method of claim 1, wherein the plurality of external formats includes at least one of binary, XML or Infoset.

6. The method of claim 1, wherein the composite encoder/decoder manages the plurality of constituent encoders, and wherein the composite encoder/decoder is configured to be extensible to include additional constituent encoders.

7. The method of claim 1, further comprising:
receiving another message formatted with the internal format;
selecting an different encoder from among the plurality of constituent encoders; and
encoding the another message into another outgoing message formatted with another external message format that is different from the particular external message format, using the different encoder.

8. The method of claim 1, wherein each of the one or more internal system components operate upon messages having the internal message format, while external components operate upon messages having the plurality of external formats.

9. The method of claim 1, wherein selecting the appropriate external message format comprises querying at least one of the constituent encoders to determine encoding capabilities.

10. The method of claim 1, wherein the encoding/decoding information also includes selection of a particular content type of the message and wherein encoding the message into the outgoing message with the appropriate encoder comprises overriding a default content type of the appropriate encoder, such that the outgoing message is formatted with the external message format and particular content type.

11. A method, implemented within a computing environment comprising at least one processor operatively coupled to a memory, a computer-implemented method for selectively decoding messages formatted with a plurality of different external formats into an internal format on a per-message basis, the method comprising:
receiving an incoming message at a composite encoder/decoder, wherein the incoming message is received as a response to an outgoing message previously encoded by the composite encoder/decoder and is formatted with a particular external format selected from a plurality of different external formats, wherein the composite encoder/decoder comprises a plurality of constituent encoders and decoders, the decoders configured to decode messages from any one of the plurality of different external formats into an internal format on a per-message basis, wherein each of the plurality of constituent decoders decodes messages from at least one of the plurality of different external formats, and wherein the internal format is processable by one or more internal system components;
consulting a per-message encoding/decoding report mechanism that includes encoding/decoding information that relates to the selection of an appropriate decoder with which to decode the incoming message including selection of a decoding format corresponding to the incoming message, the decoding information having been previously written to the per-message report mechanism by an internal system component in connection with the outgoing message, and wherein the composite encoder/decoder is capable of writing information regarding the decoding to the per-message encoding/decoding report mechanism that is readable by at least one of the one or more internal system components;
selecting an appropriate decoder from among the plurality of constituent decoders based on consulting the per-message encoding report mechanism, including the selection of the decoding format corresponding to the incoming message, wherein the appropriate decoder decodes messages from the particular external format into the internal format;
decoding the incoming message into a corresponding internal message formatted with the internal format, using the appropriate decoder; and
writing information identifying the particular external format of the internal message to the encoding/decoding information, and which is used by at least one of the one or more internal system components to perform format-specific processing of the decoded message.

12. The method of claim 11, wherein the format-dependent processing is followed by exposing at least a derivative of the incoming message in a format-independent way to yet one or more additional internal system components.

13. The method of claim 11, wherein the composite encoder/decoder automatically detects an external format of the incoming message using an automatic detection process.

14. The method of claim 13, wherein the automatic detection process is configurable.

15. The method of claim 13, wherein the automatic detection process receives a content type of the incoming message as input.

16. One or more computer storage devices having stored thereon computer-executable instructions that, when executed by at least one processor of a computing system, causes the computing system to implement a method, comprising:
the computing system receiving a message formatted with an internal format at a composite encoder/decoder that comprises a plurality of constituent encoders and decoders, the encoders configured to encode messages from the internal format to a plurality of different external message formats on a per-message basis, wherein each of the plurality of constituent encoders encodes messages into at least one of the plurality of different external message formats, and wherein the internal format is processable by one or more internal system components, the computing system including one or more processors;
the computing system consulting a per-message encoding/decoding report mechanism that includes encoding/decoding information that comprises specification of an appropriate external message format into which to encode the message as an outgoing message as well as specification of a decoding format corresponding to a response to the outgoing message, wherein the encoding information is written to the per-message encoding/decoding report mechanism by at least one of the one or more internal system components on a per-message basis;
the computing system selecting the appropriate external message format based on consulting the per-message encoding report mechanism and the encoding information, wherein selecting the appropriate external message format comprises using a content type corresponding to the message;
the computing system selecting an appropriate encoder from among the plurality of constituent encoders based on selecting the appropriate external message format, wherein the appropriate encoder encodes messages into the appropriate external message format; and
the computing system encoding the message into the outgoing message with the appropriate encoder, such that the outgoing message is formatted with the external message format.

17. One or more computer storage devices having stored thereon computer-executable instructions that, when executed by at least one processor of a computing system, causes the computing system to implement a method, comprising:
the computing system receiving an incoming message at a composite encoder/decoder, wherein the incoming message is received as a response to an outgoing message previously encoded by the composite encoder/decoder and is formatted with a particular external format selected from a plurality of different external formats, wherein the composite encoder/decoder comprises a plurality of constituent encoders and decoders, the decoders configured to decode messages from any one of the plurality of different external formats into an internal format on a per-message basis, wherein each of the plurality of constituent decoders decodes messages from at least one of the plurality of different external formats, and wherein the internal format is processable by one or more internal system components, the computing system including one or more processors;
the computing system consulting a per-message encoding/decoding report mechanism that includes encoding/decoding information that relates to the specification of an appropriate decoder with which to decode the incoming message including specification of a decoding format corresponding to the incoming message, the decoding information having been previously written to the per-message report mechanism by an internal system component in connection with the outgoing message, and wherein the composite encoder/decoder is capable of writing information regarding the decoding to the per-message encoding/decoding report mechanism that is readable at least one of the one or more internal system components;
the computing system selecting an appropriate decoder from among the plurality of constituent decoders based on consulting the per-message encoding report mechanism, including selection of the decoding format corresponding to the incoming message, wherein the appropriate decoder decodes messages from the particular external format into the internal format;
the computing system decoding the incoming internal message into a corresponding message formatted with the internal format, using the appropriate decoder; and
the computing system writing information identifying the particular external format of the internal message to the encoding/decoding information, and which is used by at least one of the one or more internal system components to perform format-specific processing of the decoded message.

18. The method of claim 11, further comprising:
receiving another internal message formatted with a different external format that is different from the particular external format;
selecting an different decoder from among the plurality of constituent decoders; and
decoding the another internal message into another corresponding message formatted with the internal format, using the different decoder.

19. The method of claim 11, wherein the information identifying the particular external format of the internal message is used by at least one of the one or more internal system components to validate whether the incoming message is valid based on the particular external format.