Forum: Ruby on Rails Web services and login?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Oliver Charles (Guest)
on 2006-01-12 10:15
Has anyone managed to do this? I thought about using sessions but they
dont want to work for me... Here's what I'm doing as a little test:

class NotLoggedIn < Exception


class ProjectsController < ApplicationController
  wsdl_service_name 'Projects'
  web_service_api ProjectsApi

  def Login
  	@session[:loggedIn] = true

  def GetProjects
  	if @session[:loggedIn]
	  	return Project.find(:all)
		raise NotLoggedIn, "You are not logged in!"

  def CreateProject(name)
  	Project.create(:name => name)
  	return name << "Wee"

Nothing fancy, but doing


in c#, gets a NotLoggedIn exception. Any ideas?
Peter S. (Guest)
on 2006-01-12 13:00
(Received via mailing list)
To take a guess (since I'm exploring Web services from the other side of
things) I would expect that rails is using a cookie to maintain its
In order for the second call to connect to the session in the rails
application the cookies that are set in the response to the first call (
ProjectService.Login()) need to be propagated back to the second call (

If this isn't happening then the call to GetProjects will not see a
cookie and will create a new session.

I would expect that .Net does the session and cookie management
on the client. But it would seem from what I've been reading that Java
doesn't do this by default so maybe .Net is copying Java a little too
closely on this one.
Oliver Charles (Guest)
on 2006-01-12 16:54
Ah, that would make sense I suppose. Well, what do you think about
having a list of currently logged in ips in a table? This app doesn't
need to be hugely realtime (and I doubt I'll have massive tables, beyond
a few meg even).

Unless you've got any other ideas?
This topic is locked and can not be replied to.