Forum: Ruby on Rails Web Services on Rails.

Posted by BalaRaju Vankala (Guest)
on 2013-02-05 16:18
(Received via mailing list)
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


--
Posted by Walter Davis (walterdavis)
on 2013-02-05 16:20
(Received via mailing list)
Older book, but very useful anyway: Service-Oriented Design with Ruby 
and Rails by Paul Dix (Addison/Wesley).

Walter
Posted by BalaRaju Vankala (Guest)
on 2013-02-05 16:30
(Received via mailing list)
Thank you Walter Lee Davis.


On Tue, Feb 5, 2013 at 8:49 PM, Walter Lee Davis <waltd@wdstudio.com> 
wrote:

> for WEB SERVICES on Rails.
> >
> >
>
> --
> 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-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


--
Posted by Peter Hickman (Guest)
on 2013-02-05 16:38
(Received via mailing list)
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 :(
Posted by BalaRaju Vankala (Guest)
on 2013-02-05 16:56
(Received via mailing list)
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


On Tue, Feb 5, 2013 at 9:02 PM, Peter Hickman <
peterhickman386@googlemail.com> wrote:

>
>> >
>> > Thanks in Advance
>> >
>> >
>>
>
--
Posted by Peter Hickman (Guest)
on 2013-02-05 21:39
(Received via mailing list)
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.
Posted by Robert Walker (robert4723)
on 2013-02-06 17:58
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 by BalaRaju Vankala (Guest)
on 2013-02-07 12:36
(Received via mailing list)
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


On Wed, Feb 6, 2013 at 10:28 PM, Robert Walker <lists@ruby-forum.com> 
wrote:

> http://developer.github.com/v3/
>
> looking at to get a idea of how web services work in Rails.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


--
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.