Http 405 method not allowed error calling a webservice

Hello everyone,

I am experiencing some difficulties with a web service I’m creating.

This webservice has a login method which checks some credentials
against an user database. Everything works beautifully so far.
Now I’m trying to add a method which creates an instance of an object
(which, incidentally, belongs_to an user).
So i added the following to my api and service definition:

class MywsApi < ActionWebService::API::Base

inflect_names false
api_method :login, :expects => [[:string]], :returns => [[:int] ]
api_method :newThing, :expects => [[:string]], :returns => [:int] #<-
added this line

end

class MywsService < ActionWebService::Base
web_service_api MywsApi

def login(name, password)

#does stuff to authenticate
end

def newThing(session_id, param1, param2) #<-Added this method

@user = User.find(session_id)
@thing= @user.things.build({:user => @user, :field1 =>
param1, :field2=> param2})
if @thing.save
return 0
else
return 1
end
end

end

The login method works perfectly, but when I fire the newThing event I
receive a most saddening:
“http 405: method not allowed”.

Am I missing something? do I need to add anything elsewhere to get
another method working?
Any help would be immensely appreciated.

Thanks in advance.

Regards,
Rey9999

My bad… I was calling the service on the wrong port.
As always, all work and no sleep make Rey9999 go blind.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs