Comparison of REST Vs XML-RPC

Posted on October 30, 2006. Filed under: comparison, compigiri, Computer, internet, REST, Web, XML, XML-RPC |

Some background of the protocols

Rest protocol uses the HTTP GET and HTTP PUT methods to communicate with an application server. For example an API for a typical application would look like


http://example.com/users/

http://example.com/users/{user} (one for each user)

http://example.com/findUserForm


http://example.com/locations/

http://example.com/locations/{location} (one for each location)

http://example.com/findLocationForm

The client typically a webbrowser needs to construct HTTP requests and parse XML or HTML responses.

XML-RPC uses XML protocol to make Remote procedure calls to execute functions defined on objects, over the network.

An RPC application might define operations such as the following:

getUser()
addUser()
removeUser()
updateUser()
getLocation()
addLocation()
removeLocation()
updateLocation()
listUsers()
listLocations()
findLocation()
findUser()

The client needs to construct an XML request and parse the XML response.

Comparison

REST is an HTTP based protocol. Whereas XML-RPC is XML based.
IMO, REST being an HTTP based protocol works best when the client is a browser. XML-RPC on the other hand is XML based. So no assumption is made about the client which is going to use the protocol.
When the client is a browser, more efforts need to be put in by the client to use XML-RPC than to use REST.

An advantage of REST over XML-RPC is that each object has its own URL and can easily be cached, copied, and bookmarked.

Advantage of XML-RPC is that it is client independant. Any sort of client be it a desktop application a mobile application, a mashup using information from your site can easily integrate with XML-RPC.

Overall I think REST has its advantages in the browser world. But as more and more applications are using the web as a platform and accessing it through a variety of methods other than web browsers XML-RPC has and edge over REST.

Conclusion

Web services should provide and XML based interface like XML-RPC. The could also provide a RESTful interface built on top of XML-RPC to support browser based clients.

Web service implementation

About these ads

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

13 Responses to “Comparison of REST Vs XML-RPC”

RSS Feed for Abstract-n-Concrete Comments RSS Feed

Thank you for a simple, easy to understand, and readily usable analysis of the two techniques. I had to read 200+ articles before I found this just-plain-good explnation.

and i don’t know, how to make it bette. Zaid Bethanie.

that’s why it will never wor. Eka Kolour.

Why will it never work?

Nice, informative article. Best of all, brief!

Thanks for the explanation. Cleared up some questions I had.

The browser world?

REST is not only for browsers. HTTP is a widely spread protocol also used for B2B communication.
In fact, why would a browser directly call a REST service unless the service delivers HTML, which is rather uncommon?

“But as more and more applications are using the web as a platform and accessing it through a variety of methods other than web browsers…” ???

This article is outdated.

“The client typically a webbrowser needs to construct HTTP requests and parse XML or HTML responses.”

There is no need a browser to use REST api, here is the sample python code used to print the response of a request using REST api.

import requests
url2=’http://localhost:8080/api/cmdb/ci/count/all/userkey=CCA8144E-F040-4330-8B8E-84175E5876D2′
r = requests.post(url2)
print r.text

Hmm it looks like your site ate my first comment (it was extremely long) so I guess
I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.

I as well am an aspiring blog blogger but I’m still new to everything. Do you have any helpful hints for newbie blog writers? I’d genuinely appreciate it.

I’m not sure exactly why but this blog is loading very slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem
still exists.


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: