Check out SOAP Resource Representation Header, a recent product of the XML Protocol Working Group. The idea is you stick a resource representation in a SOAP header. When I first read this, I checked the date to make sure it wasn’t April 1st.
Once I decided it probably wasn’t a prank, I decided that there must be some obvious use-case I hadn’t thought of that would motivate you to do this weird and unnatural thing. Here is the first paragraph of the introduction:
The Representation header block is designed to allow applications to carry a representation of a Web resource in a SOAP message. Applications of this header include cases where the receiver has limited ability to get the representation using other means, for example because of access restrictions or because the overhead would be unacceptable.
Those use-cases are little more than sketched-in, and both of them are weird. First, “because of access restrictions.” Yes, those access restrictions sure can get in the way sometimes; but that’s OK, this will provide us with a way around all that awkwardness. BillG and the boys over at Redmond may be working overtime to make Windows really secure, but we’ll show ’em. I can already hear the heads shaking over at the IETF. Not only can you dodge those nasty firewalls by running everything through port 80, you can further obfuscate what you’re doing by wrapping it up in SOAP headers; now that’s what I call progress!
Then there’s the case where “the overhead would be unacceptable.” So, you could just do an HTTP GET and what you’d get would be a representation that is one of the world’s easiest things to parse only you don’t have to because essentially every programming language in the world has a library that already knows how. No, that’s too hard, let’s simplify it by wrapping it up in a SOAP header so that you have to figure out the WSDL pattern first and parse the SOAP wrapper and then look carefully at the addressing and policy and WS-this and WS-that that are going to be jammed into the header along with the representation, and this is going to have lower overhead?
I am reminded (as I often am in WS-* territory) of the famous Australian sheep counters, who can glance at a gaggle of hundreds or even thousands of sheep and in an instant tell you the exact count. The trick is, they count the legs and divide by four.