REST – Updating a resource has multiple side effects
I have seen REST or ROA described as Distributed Objects Realized and believe me I get it. However, different operations on objects have different side-effects and from an implementation perspective I struggle with why REST is necessarily better in ALL situations.
Let me give an example. Imagine a resource X that can be updated (PUT’d) in various ways and traverse multiple states, the representation (or payload) sent to my implementation will need to contain information on what “update”I want to do. In essence, my intent is not solely conveyed in the fact that I am using PUT – the consumer of my service needs to know the appropriate payload before they can effectively use my service. (Could it be that my resource design is wrong?) Knowing how to “PUT” to some resource doesn’t help them that much. I think this is a fact that is severely understated!
This is why I think the design of the messages passed between consumer and service is also quite important.
Somewhat related to this point is the fact that “SOAP bashers” conflate SOAP with RPC. I would counter and say you can do SOAP without RPC, in fact I do it all the time using the WSE toolkit and SSDL. My consumers just send a message to an endpoint using their protocol of choice and that’s the end of the story. Most interactions (at this point) are complex operations (PUTs?) and so I personally don’t seem to gain much from a standard interface.
Is the SOAP payload overkill in some (ok many) instances, yes! But I would suggest that has little to do with RPC in itself. Have Microsoft, Sun, IBM, industry trainers etc. educated people incorrectly when it comes to SOAP-based web service design? Probably.
Having said all that, I believe RESTful solutions have their place in my toolkit. The nature of the client and the service that I need to provide ultimately drives how I build my service. Distilling requirements to the point where I know what tool to use is the hard part.🙂
Now I could be missing the point completely here so if I am, feel free to comment and point out my error in thinking.