Hi,
I have a Ruby script that invokes web services using SSL. It works.
In order to make my web service work over https (SSL) i had to :
_create a directory called “soap” in my working directory.
_create a file in that dir called property that contains :
client.protocol.http.ssl_config.ca_file = ca.pem
_add ca.pem in my working directory that contains my certificates.
So here is what I have in my working dir:
_client.rb
_soap
_soap/property
_ca.pem
The problem is when I try to integrate it in my Ruby on Rails
application I
have the error in my controller:
OpenSSL::X509::StoreError in Air searchController#search_trip
system lib
RAILS_ROOT: D:/www/airtravelonrails/config/…
Application Trace http://localhost:3000/air_search/search_trip# |
Framework
Trace http://localhost:3000/air_search/search_trip# | Full
Tracehttp://localhost:3000/air_search/search_trip#
C:/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:532:in add_file' C:/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:532:in
set_trust_ca’
C:/ruby/lib/ruby/1.8/soap/httpconfigloader.rb:81:in set_ssl_config' C:/ruby/lib/ruby/1.8/soap/property.rb:140:in
each’
C:/ruby/lib/ruby/1.8/soap/property.rb:139:in each' C:/ruby/lib/ruby/1.8/soap/httpconfigloader.rb:66:in
set_ssl_config’
C:/ruby/lib/ruby/1.8/soap/httpconfigloader.rb:34:in set_options' C:/ruby/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:65:in
fetch’
C:/ruby/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in import' C:/ruby/lib/ruby/1.8/wsdl/importer.rb:18:in
import’
C:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:124:in import' C:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:28:in
initialize’
#{RAILS_ROOT}/app/controllers/air_search_controller.rb:39:in new' #{RAILS_ROOT}/app/controllers/air_search_controller.rb:39:in
search_trip’
-e:3:in `load’
-e:3
So when I look closer in the file http-access2 line 532 we see that the
problem comes from the function:
def set_trust_ca(trust_ca_file_or_hashed_dir)
if FileTest.directory?(trust_ca_file_or_hashed_dir)
@cert_store.add_path(trust_ca_file_or_hashed_dir)
else
@cert_store.add_file(trust_ca_file_or_hashed_dir)
end
change_notify
end
from the line @cert_store.add_file(trust_ca_file_or_hashed_dir)
Is anybody knows how to use SSL Web Services in a Rails application?
Thank you.