Web Services on Rails.

120 views
Skip to first unread message

BalaRaju Vankala

unread,
Feb 5, 2013, 10:16:58 AM2/5/13
to rubyonra...@googlegroups.com
Hello all,

I am so confusing about web services on Rails, can we use REST approach for WEB SERVICES on Rails.

If we use REST Approach Which one is the best one ??? REST or SOAP or WSDL ????
are is there any other process for web services on rails??

I want to learn about web services on Rails, Can you suggest me books or links for that. or Any Examples for web services on Rails.

Thanks in Advance


--
----------------------------------------------------------------------------------------------------
Thank You.

Best Wishes,
 
BalaRaju Vankala,



Walter Lee Davis

unread,
Feb 5, 2013, 10:19:59 AM2/5/13
to rubyonra...@googlegroups.com
Older book, but very useful anyway: Service-Oriented Design with Ruby and Rails by Paul Dix (Addison/Wesley).

Walter
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

BalaRaju Vankala

unread,
Feb 5, 2013, 10:29:56 AM2/5/13
to rubyonra...@googlegroups.com
Thank you Walter Lee Davis.

Peter Hickman

unread,
Feb 5, 2013, 10:32:26 AM2/5/13
to rubyonra...@googlegroups.com
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 :(

BalaRaju Vankala

unread,
Feb 5, 2013, 10:54:58 AM2/5/13
to rubyonra...@googlegroups.com
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

Peter Hickman

unread,
Feb 5, 2013, 3:38:04 PM2/5/13
to rubyonra...@googlegroups.com
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

<updates>
  <update match="1234" href="/feed/match/1234"/>
  <update match="3243" href="/feed/match/3243"/>
  <!-- and a whole load more -->
  <since href="/feed/updates.xml?since=2013-01-05 13:24:35Z"/>
</updates>

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.

Robert Walker

unread,
Feb 6, 2013, 11:58:25 AM2/6/13
to rubyonra...@googlegroups.com
BalaRaju Vankala wrote in post #1095355:
> 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:

http://developer.github.com/v3/

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.

--
Posted via http://www.ruby-forum.com/.

BalaRaju Vankala

unread,
Feb 7, 2013, 6:35:10 AM2/7/13
to rubyonra...@googlegroups.com
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.
thank you


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Sara T.

unread,
Sep 5, 2013, 1:47:48 AM9/5/13
to rubyonra...@googlegroups.com
Thank you Walter Lee Davis.I am developing the Web Services, I will
definitely take suggestions
from
you guys.
thank you

Reply all
Reply to author
Forward
0 new messages