Web Services: XML-RPC, SOAP, and REST
A now a note on web services.
Web services and their prime role in a service oriented architecture are all the rage in IT at the moment, including GIS. I’ve talked about SOA and web services before, but I never hit on the different implementations of web services. Understanding the differences between these implementations is important in designing your own web services and consuming the web services of others.
Generally speaking, there are three web service implementations: XML-RPC, SOAP, and REST.
- Remote procedure call using HTTP as the transport and XML as the encoding
- Works over HTTP Post
Now let’s look at SOAP.
- Remote procedure call using HTTP (generally) as the transport and XML as the encoding
- Works over HTTP Post
- Generally requires a separate toolkit
- Tends to be complex and slow
People generally fault SOAP for two very legitimate things. It is mind-bogglingly complex and over-equipped for almost any task you can think of, but particularly so for the relatively simple thing you probably want to do. Its elaborate feature set means its can be a pain to deal with, and the odds of you ever needing that elaborate feature set isn’t terribly high. The second thing people fault it for is speed: it’s the single slowest way to implement a web service, hands down. Amazon, which releases its very popular web services under both SOAP and REST, say their REST services are seven times faster.
Which brings us to REST.
- URI call through HTTP GET
- Bound to HTTP
- No extra toolkits required
- Doesn’t share all of the features of SOAP
To sum up:
- Advantages of SOAP
- Easy to consume - sometimes
- Rigid type checking - adheres to WSDL contract
- WSDL offers some built-in metadata
- A number of development tools support it
- Advantages of REST
- Lightweight - not a lot of extra XML markup
- Human readable results
- Easy to build - no toolkits required
- High performance
In terms of popularity, SOAP tends to get higher marks internally in corporations, particularly those on the .NET platform, but REST seems to be more popular in the “real world” (Amazon reports its REST services receive ~80% of its web service traffic).
So, those are your three web service implementations. Of the three, stick with SOAP and REST, and use the one that makes the most sense for what you’re doing and what you’re doing it with. Happy coding.
There’s a PHP project called NuSOAP that does output WSDL given some information, but I haven’t tried it.