Connecting to RTC 4.x using Ruby
EclipseTalk . (327●3●61●61)
| asked Mar 20 '13, 12:01 p.m.
edited Mar 21 '13, 7:46 a.m. by Ralph Schoon (63.4k●3●36●46)
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
|
Accepted answer
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
|
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.