Friday, May 13, 2005

Asymmetrical WS-Addressing

I have to admit that I like symmetry for a number of reasons. Nature prefers symmetry in a wide range of areas and it shows up all around us. So, symmetry is good. I know it's not a hard-and-fast rule, but we've followed nature before and I reckon it still has a lot to teach us. And more pragmatically, symmetry just makes sense. To paraphrase Occam's Razor: the simplest solution is probably the right one. So, why make things more complex than they need to be?

So how does this relate to WS-Addressing? Well ever since I started to use it when the Web Services Coordination and Transaction specifications, I've been annoyed by the fact that not everything is a WS-Addr End Point Reference (EPR). Basically in WS-Addr, an EPR is a delivery address for your message and contains the URI of the service as well as other information needed to ultimately deliver that message.

When sending a message, you can define wsa:ReplyTo, wsa:FaultTo and wsa:From all as EPRs. But the actual destination address isn't an EPR! Or more accurately, it's a broken apart EPR: as a receiver, you may have got it in a wsa:ReplyTo, but if you then want to us it to send a response, you have to do some work with it first.

For example, here's a valid wsa header for an input message:

<S:Header>
<wsa:MessageID>http://example.com/someuniquestring
</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://example.com/business/client1
</wsa:Address>
<wsa:ReferenceParameters>
<foo:dest objid=urn:1234:5678/>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:To S:mustUnderstand="1">
mailto:fabrikam@example.com</wsa:To>
<wsa:Action>http://example.com/fabrikam/mail/Delete
</wsa:Action>
</S:Header>

Now in a symmetrical world, I should simply be able to take the wsa:ReplyTo EPR and put it (renamed as wsa:To of course) into the SOAP header of the response message like so:

<S:Header>
<wsa:To>
<wsa:Address>http://example.com/business/client1
</wsa:Address>
<wsa:ReferenceParameters>
<foo:dest objid=urn:1234:5678/>
</wsa:ReferenceParameters>
</wsa:To>
</S:Header>

But no, I can't do that. I have to take everything out of the wsa:ReplyTo and essentially promote the contents to the root, like so:

<S:Header>
<wsa:To>
<wsa:Address>http://example.com/business/client1
</wsa:Address>
</wsa:To>
<foo:dest objid=urn:1234:5678/>
</S:Header>

And as you can see, it's not actually as simple as that - I've got to break apart the ReferenceParameters (which could be arbitrary in size). Why can't I just use the EPR I received as an EPR? It can't be because of deficiencies in the SOAP processing model and I don't see how it adds anything to the architecture/model (if anything it detracts from it).

In short: It does not make sense!

1 comment:

  1. http://lists.w3.org/Archives/Public/public-ws-addressing/2005May/0028.html

    ReplyDelete