Creating a web service with AWS


#1

So I’ve read the Action Web Service bit of the documentation for a
while, searched around and asked on the IRQ channel and I just can’t
seem to get a simple Hello World type web service up and running with
AWS on Rails.

I have a file called hello_person_api.rb which looks like this:

class HelloPersonAPI < ActionWebService::API::Base
api_method :HelloName, :expects =>[:string], :returns => [:string]
end

I have put that in the /app/apis/ directory. I also have a file named
hello_person.rb which contains this:

class HelloPerson < ApplicationController

def HelloName( name )
return "Hello "+name;
end
end

I have put that in the /app/controllers/ directory.

As far as I can understand it, that ought to do something (although I
have no idea what path things are supposed to be on so they could be
in the wrong place) but when ask it to do anything I get this:

http://localhost:3000/HelloPerson

Routing Error

No route for path: “HelloPerson”

Failure reasons:
<ActionController::Routing::Route “:controller/service.wsdl” when
{:action=>“wsdl”}> failed because no controller found at subpath
helloperson
<ActionController::Routing::Route “:controller/:action/:id” ||
{:id=>nil, :action=>“index”}> failed because no controller found at
subpath helloperson

Any ideas what else I need to do?

thanks,

-ben


#2

I think you Controller needs to look like the following:

class HelloPerson < ApplicationController

wsdl_service_name ‘HelloPerson’

def HelloName( name )
return "Hello "+name;
end
end


From: removed_email_address@domain.invalid on behalf of Ben M.
Sent: Tue 1/31/2006 11:37 AM
To: removed_email_address@domain.invalid
Subject: [Rails] Creating a web service with AWS

So I’ve read the Action Web Service bit of the documentation for a
while, searched around and asked on the IRQ channel and I just can’t
seem to get a simple Hello World type web service up and running with
AWS on Rails.

I have a file called hello_person_api.rb which looks like this:

class HelloPersonAPI < ActionWebService::API::Base
api_method :HelloName, :expects =>[:string], :returns => [:string]
end

I have put that in the /app/apis/ directory. I also have a file named
hello_person.rb which contains this:

class HelloPerson < ApplicationController

def HelloName( name )
return "Hello "+name;
end
end

I have put that in the /app/controllers/ directory.

As far as I can understand it, that ought to do something (although I
have no idea what path things are supposed to be on so they could be
in the wrong place) but when ask it to do anything I get this:

http://localhost:3000/HelloPerson

Routing Error

No route for path: “HelloPerson”

Failure reasons:
<ActionController::Routing::Route “:controller/service.wsdl” when
{:action=>“wsdl”}> failed because no controller found at subpath
helloperson
<ActionController::Routing::Route “:controller/:action/:id” ||
{:id=>nil, :action=>“index”}> failed because no controller found at
subpath helloperson

Any ideas what else I need to do?

thanks,

-ben


#3

Thanks for this.

In the end, with a lot of help from folk on IRQ and random voodoo
experimentation I got something up and running, which I should be
able to work with a bit. My main problem was that although I had
updated to the latest version of Rails my version of AWS was a bit old
and didn’t work very well.

I’ve added a howto for a basic web service to the rails Wiki so anyone
else in my state of distress should hopefully be able to sort
themselves out…

-ben