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.
On 5 February 2013 15:54, BalaRaju Vankala <[email protected]> wrote:
> 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 <
> [email protected]> wrote:
>
>> 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 :(
>>
>>
>> On 5 February 2013 15:19, Walter Lee Davis <[email protected]> wrote:
>>
>>> Older book, but very useful anyway: Service-Oriented Design with Ruby
>>> and Rails by Paul Dix (Addison/Wesley).
>>>
>>> Walter
>>>
>>> On Feb 5, 2013, at 10:16 AM, BalaRaju Vankala wrote:
>>>
>>> > 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,
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > 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 [email protected].
>>> > To post to this group, send email to [email protected]
>>> .
>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>> >
>>> >
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
>
> ----------------------------------------------------------------------------------------------------
> Thank You.
>
> Best Wishes,
>
> BalaRaju Vankala,
> 8886565300.
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.