Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7542433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:09:54+00:00 2026-05-30T08:09:54+00:00

I am using ActiveResource against a non-Rails REST API… in fact even the Rest

  • 0

I am using ActiveResource against a non-Rails REST API… in fact even the “Rest” part is doubtful but they tried:

Although RESTful applications are ideally stateless, the ALM platform
requires sessions to manage locking, client life time, and perform
other basic tasks. Session management is performed using a cookie
named QCSession.

Anyway, I need to issue one GET to “authentication-point/authenticate” to get a user authenticated and take a cookie back. Just not sure how to do that. Here is what I have but I am getting a 404 error:

class AlmActiveResource < ActiveResource::Base
  attr_accessor :lwsso_cookie, :qcsession_cookie

  self.site     = "http://alm_url/qcbin/"
  self.user     = "name"
  self.password = "pw"

  def self.authentication
    @auth_point    = "authentication-point/authenticate"
    self.prefix(@auth_point)
    meow = self.get(:authenticate)
    Rails.logger.debug("Meow: #{meow.inspect}")

  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:09:55+00:00Added an answer on May 30, 2026 at 8:09 am

    I had the exact same problem. I finally had to put everything in the controller to get it to talk to ALM. It’s not the best but it works. Here’s the Index action in the ReleaseCycles controller:

     def index
        conn=getAuthenticatedCurl
        conn.url="#{$HPQC_REST_URL}/release-cycles"
        conn.perform
        results=conn.response_code
        hash=Hash.from_xml(conn.body_str)
        respond_to do |format|
            format.html { render :xml => hash }
            format.xml  { render :xml => hash }
            format.json { render :json => hash }
        end
        conn.url=$HPQC_LOGOUT_URL
        conn.perform
        conn.close
        return results
    end
    

    I created the get “getAuthenticatedCurl” in the ApplicationController. It looks like:

      $HPQC_HOST = "http://<your_alm_server>:8080"
      $HPQC_REST_URL = "#{$HPQC_HOST}/qcbin/rest/domains/<DOMAIN>/projects/<PROJECT>"
      $HPQC_LOGIN_URL = "#{$HPQC_HOST}/qcbin/authentication-point/authenticate"
      $HPQC_LOGOUT_URL = "#{$HPQC_HOST}/qcbin/authentication-point/logout"
    
      def getAuthenticatedCurl
        @_conn = Curl::Easy.new($HPQC_LOGIN_URL)
        @_conn.verbose = true
        @_conn.http_auth_types = :basic
        @_conn.userpwd = '<username>:<password>'
        @_conn.enable_cookies = true
        @_conn.cookiejar = 'cookies.txt'
        @_conn.perform #creates the first cookie instance, which allows subsequent calls to the HPQC API
        puts "connected...."
        return @_conn
      end
    

    It’s not pretty but it works and it’s fast. My next step is to do the same thing as an ActiveResource. Hope it helps and good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a REST API that I am trying to access using Rails 3.0.1
I have been using ActiveResource in my Ruby on Rails applications for some time,
I'm trying to get my head around nested associations in Rails using ActiveResource. My
I have a Rails app whose major part is to query another web-service using
just getting started with Rails, I would like to consume a webservice (using ActiveResource)
I'm writing a client that consumes a non-REST API (i.e. GET site.com/gettreasurehunts), which requires
I'm using ActiveResource in my rails app to talk to another rails app (both
I have rails applications, which communicate with each other using ActiveResource. I have setup
I am using Ruby on Rails 3 and I am considering to use ActiveResource
I tried using ActiveResource to parse a web service that was more like a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.