Couldn't find 'web_service' generator...

Subscribe to Couldn't find 'web_service' generator... 7 post(s), 2 voice(s)

 
Avatar Neil 9 post(s)

I’m on Rails 2.02, and I’m having trouble getting the ‘web_service’ generator to run – has it been removed from Rails?! If so, is there a plugin I can use? Sorry if I’m doing something incredibly stupid with this one, but it’s thrown a real spanner in the works in this chapter!

 
Avatar EldonAlameda Administrator 196 post(s)

Hi Neil,

Yes – Action Web Service was removed from Rails 2.0 and replaced by ActiveResource for RESTful web services.

I haven’t had a chance to test out adding Action Web Service back into Rails 2.0 yet, but had this page bookmarked that might help you

http://www.texperts.com/2007/12/21/using-action-web-service-with-rails-20/

 
Avatar Neil 9 post(s)

Excellent, I’ve give that a go and I’ll get back to you…

 
Avatar Neil 9 post(s)

After reading through the bookmark – and all the authors comments re. REST vs SOAP – I might just leave web_service for a while. I’ve only been learning Rails for the last two weeks, so I’ll come back when I’m more comfortable with switching my head between REST and non-REST controllers!

 
Avatar EldonAlameda Administrator 196 post(s)

Hi Neil,

I don’t see any comments on that page – am I missing something?

But anyways while I’m sure you’ll find that there are a lot of opinions out there, I think that it’s good to learn how to use all three approaches (i.e. XML-RPC, SOAP and REST). While REST has a lot of very outspoken supporters within the Rails community, there are going to be plenty of times when you may need to support a SOAP or XML-RPC service as well in which case – Action Web Service makes it very easy.

When I was first learning Rails – I used Action Web Service in numerous applications to provide a SOAP interface for my boss (a visual basic programmer). With that SOAP interface he could easily tie the desktop applications he built into my Rails applications—which allowed us to do some pretty interesting things.

For him, consuming a SOAP service was a simple matter because of the tools that he had in Visual Studio. However, he never wanted to go through the process of building an interface to a REST service.

So all that to say – even though Action Web Service isn’t included with Rails anymore, doesn’t mean that it doesn’t still have value. It’s just no longer the “preferred” way to provide web services into your Rails app.

 
Avatar Neil 9 post(s)

Thanks again for the fast response!

There was the comment “REST is very much the way forward as far as Rails in concerned”, but looking back after a night’s sleep and a strong latte, I must have been reading through some other sources on REST/Action Web Service at the same time (pretty tired, plus I had about a zillion + 1 tabs open with Rails tutorials on REST!). And yes, I’m still interested in coming back to SOAP and XML-RPC, just after I’m confident with the API’s offered for free by REST.

I imagine this is quite a strange point in the lifespan to be learning the Rails framework. In many of the tutorials I’ve been following, I’ve had to learn to change paths and urls to include parent models, and that’s just for starters. You have to be very attentive! I bet it’s even worse for people writing those books and tutorials….

 
Avatar EldonAlameda Administrator 196 post(s)

:-)

Yeah – Rails has always been somewhat of a moving target. It’s first year was an especially crazy time, and there have been a fairly significant number of changes made it to the framework even after Rails went to 2.0. So it does take a bit of time to keep up but honestly – I think it’s worth it.

And yes – writing a book on Rails is especially stressful as things can change dramatically while you’re writing (or within weeks of the book being done). But I’m a glutton for punishment as I’ve been asked to write a beginning Rails 2.0 style book this year.