Web services in Rails - inconvenient?

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.

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 D. 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.