Well personally speaking we use REST serialising to XML or JSON (we much prefer JSON). It’s probably not text book web services but our clients have no problem using them.
We only use SOAP for legacy services and then we tend to proxy them through REST XML because it’s much easier to use.
Once we have a SOAP client or server working we are too afraid to touch it incase it breaks
I am new to develop web services, Can you Explain how its work with an Example in Rails ??. I am Searching in google, but I didn’t get the appropriate result.
As an example we supply live football results so we have a feed like this
/feed/updates.{xml|json}
By calling this feed the client gets a list of matches that have had something happen in them (goals, cards, substitutions etc) since the last time they called this feed. By using an optional since parameter they can control the information that they receive.
So an initial call to /feed/updates.xml will return them a list of matches something like this
The client then waits a bit (perhaps 5 seconds, perhaps a minute) and then calls the href attribute of the since element
/feed/updates.xml?since=2013-01-05 13:24:35Z
which will return a buch of xml with a new since element which the client can call.
We have a feed controller with both an updates method and a match method. As far as rails is concerned these are just web pages that have the mime type of text/xml or application/json
Of course there is more to it than this. We also set cache headers to protect ourselves from clients that think that they need to poll 2 or 3 times a second. We also detect the client and only send them the data that they want (not all clients are interested in what is happening in the Thai second division), logging, auditing.
As far was we are concerned these are just web pages. That said 99% of our feeds are read only so they are simply GET requests on the required url. Once you start accepting data from clients it gets a little more complicated, but not much more.
This system serves us well. We supply live feed of scores, cards, substitutions etc to several UK bookmakers so this can get quite heavily loaded at times.
Thank you Peter Hickman,
I am new to develop web services, Can you Explain how its work with an
Example in Rails ??. I am Searching in google, but I didn't get the
appropriate result.
Thanks in Advance
If you would like to see how a well designed REST API (web service) is
put together from the client's point of view take a look here:
Take note that there are a few different camps for web services, but
they primarily break down into one of three major categories.
1. XML-RPC (Remote Procedure Call) via SOAP
2. WS-* (Web Services - Deathstar) also via SOAP
3. RESTful (Representation State Transfer)
WS-* actually covers both 1 and 2 above, but it was worth pointing out
the two basic types, RPC and Document styles.
Rails is, and has always been, an opinionated framework and RESTful web
services is the clear winner for Rails applications. There is no
build-in support for SOAP. There are some third party gems out there if
you absolutely, positively, are forced to consume SOAP services.
There is far to much to know about web services to try to explain here,
but when done correctly, building a Rails application IS building a
RESTful web service. However, you will want to consider your
application's design from both the perspective of the web user and any
potential web service clients. As I said the GitHub developer is worth
looking at to get a idea of how web services work in Rails.
Thank you @Robert Walker, @Peter Hickman… If I have any confusion while I am developing the Web Services, I will definitely take suggestions from you guys.