Now that the July CTP is public, I can divulge the details of a feature that I added to WCF in April.
In PDC ’05 we showed how you can use WCF extensibility to send “POX” (Plain Old Xml) Messages via our runtime. However, it took some magical incantations to enable. These including setting HttpMappingMode
on the HttpTransportBindingElement
, and writing a custom encoder that only writes out the body of the Message.
In July CTP, you now get 1st class support for POX-style Messages. To accomplish this, we added new Addressing and Envelope Versions (AddressingVersion
.None
and EnvelopeVersion
.None
). I’m also happy to report the obsolescence and removal of HttpMappingMode
(nee MapAddressingHeadersToHttpHeaders
for those former Beta 1 users who have been following along).
AddressingVersion
.None
means that your addressing information (To, Action, etc) is transmitted out of band from the Envelope. One example of this type of addressing is BasicHttpBinding — the <To>
is sent as the HTTP Request-Uri, and the <Action>
is sent out as either the SOAP-Action (in SOAP 1.1), or as a parameter to the content-type (in SOAP 1.2). If a particular binding requires WS-Addressing, then they can throw on Send()
for Messages with AddressingVersion
.None
EnvelopeVersion
applies to the basic structure of the Message. This is where SOAP can come in to play. By default, the EnvelopeVersion of a Message is EnvelopeVersion
.Soap12
. SOAP 1.2 includes (among other things), support for Headers, and an outer <Envelope>
tag. To “wash off” the SOAP from the Message (thanks Don), you should create a Message with EnvelopeVersion
.None
. When using such Messages, you cannot add any Headers other than <To>
and <Action>
. <To>
and <Action>
are “special” since they are intrinsics used by the runtime system. <To>
is used by default for addressing dispatch, and <Action>
is used by default for Operation dispatch. Some transports (such as our HTTP Transport) will strip these header values out and lift them into their “framing layer” (i.e. the goo we put around a Message to conform to the HTTP protocol).
For our programming model, AddressingVersion
and EnvelopeVersion
are packaged together into a single MessageVersion
that is assigned to a Message
or a Binding
. Enabling simple POX messaging is now simply a matter of setting up an HTTP binding on your service with a TextEncoder that uses MessageVersion
.None
(or messageVersion=”none” in config-speak). Viola! No SOAP!
NOTE: see here for more information about the breaking changes between Beta 2 and the June CTP.