    # File lib/metacat.rb, line 141
      def login(username, password)
        response = metacat_get({
          'action'    =>  'login',
          'qformat'   =>  'xml',
          'username'  =>  username,
          'password'  =>  password
        })
        if(response.content_type == 'text/xml')
          doc = REXML::Document.new(response.read_body)
          if(doc.root.name == 'login')
            @cookie = response.response['set-cookie']
            @logged_in = true
          else
            raise MetacatPermissionDenied, "login error: "+doc.root.elements['message'].text
          end
        else
          raise MetacatResponseError
        end
      end