Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Connecting to RTC 4.x using Ruby

 Hello,
I'm trying to connect to RTC via Ruby with the following code:

<code>
require 'rubygems'
require 'HTTParty'
require 'pp'
require 'json'
 
class Jazz
  include HTTParty
end
 
puts "Authenticating..."
response = Jazz.get('https://testServer/ccm/authenticated/identity')
 
@cookie = response.headers['Set-Cookie']
response = Jazz.get('https://testServer:9443/ccm/authenticated/j_security_check', 
  :query => { "j_username" => "user", "j_password" => "paws"},
  :headers => {'Cookie' => response.headers['Set-Cookie']})
    
if response.headers['x-com-ibm-team-repository-web-auth-msg'] == 'authfailed'
  abort "Authentication failed"
end
puts "Authentication successful"
@cookie = @cookie + ", " + response.headers['Set-Cookie']
</code>

but I can't go pass the authentication. I get this error:

<code>
C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `connect': SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read finished A (OpenSSL::SSL::SSLError)
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `block in connect'
        from C:/Ruby200/lib/ruby/2.0.0/timeout.rb:51:in `timeout'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `connect'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:861:in `do_start'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:850:in `start'
        from C:/Ruby200/lib/ruby/2.0.0/net/http.rb:1366:in `request'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/httparty-0.10.2/lib/httparty/request.rb:91:in `perform'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/httparty-0.10.2/lib/HTTParty.rb:456:in `perform_request'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/httparty-0.10.2/lib/HTTParty.rb:398:in `get'
        from runReport.rb:17:in `<main>'
</code>

Has anyone be successul using Ruby to connect to RTC 4.x?

Thanks for sharing

0 votes


Accepted answer

Permanent link
this little curl script works..  I think your problem is going to CCM not JTS

<code>
set COOKIES=.\cookies.txt

set USER=
set PASSWORD=
set HOST=https://localhost:9743


curl -k -c %cookies% "%host%/jts/authenticated/identity"

curl -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PASSWORD% "%host%/jts/authenticated/j_security_check"

curl -k -L -b %COOKIES% "%host%/ccm/oslc/workitems/catalog
</code>
EclipseTalk . selected this answer as the correct answer

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 491
× 2

Question asked: Mar 20 '13, 12:01 p.m.

Question was seen: 6,413 times

Last updated: Mar 21 '13, 7:46 a.m.

Confirmation Cancel Confirm