Rails ActionWebservice called using /api error

hi amri,
just try running your server at 3000 and your client code from a server running at 3001 i mean run two webrick servers
1-for server on which web service is there
2-for the client application which will try accessing this service

if it works then your code is correct

few weeks back i had same problem it worked this way problem is with webrick i suppose it cannot act as both server and client for webservice at sametime on localhost it runs into a loop.

just try this if it helps