Forum: Ruby on Rails Web services in Rails - inconvenient???

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e2dd87a31c5d3e07adc9efa375f4dc4?d=identicon&s=25 rph (Guest)
on 2007-02-12 14:30
I'm semi-new to Rails, and the work I'm doing now requires a few
Rails-based web services to interact to form the whole of our project.
I have some things working using ActionWebService, but it seems as
though I have to put the "whatever_api.rb" file in the /app/apis folder
EVERY time I want to use the API.  This doesn't seem right when I
realizing how much Rails attempts to keep things DRY.

I'm almost positive I'm doing something wrong, here.  I'm not using REST
in my applications, but I don't know if that's an alternative.

Can I simply use ".to_xml"?  And what exactly does the WSDL for?  Does
that play into this at all?  Unfortunately, another .NET application has
to call the web-service, but that shouldn't be an issue, right?

I'd love to have someone who is more experienced than I to shed some
light on how he/she would handle a few web-services in Rails.  My main
problem is avoiding the distribution of the "whatever_api.rb" file
across all of the applications, causing me to update each and every one
if something changes.  Plus I have multiple files.  I'm just searching
for a better solution.

Thanks a lot for any insight.
9d1310212bb9dfe69ee6b259c7945392?d=identicon&s=25 Sheldon Hearn (sheldonh)
on 2007-02-12 19:19
(Received via mailing list)
rph wrote:

> I'm semi-new to Rails, and the work I'm doing now requires a few
> Rails-based web services to interact to form the whole of our project.

Excellent.  Do yourself an enormous favor and pick up a copy of Agile
Web Development with Rails (2nd ed), available as a book or PDF.

It has a whole section on web services, where you'll learn how to use
the web_service generator to scaffold up your web services and get to
the good stuff quickly.

> I have some things working using ActionWebService, but it seems as
> though I have to put the "whatever_api.rb" file in the /app/apis folder
> EVERY time I want to use the API.

That file is created for your automatically when you scaffold a web
service.

If you can't afford the book, try Google for:

    rails web services

Just be wary of RESTful services without checking that your .NET
developers are prepared to consume them.

Ciao,
Sheldon.
This topic is locked and can not be replied to.