Simple HTTPS usage

Hi,

I have to connect via HTTPS to a SOAP service.
I have a crt file from the SOAP service server so I can execute the
HTTPS requests.

Based on the the SOAP service docs I need to import that key (.crt file)
using keytool command on my machine (instructions originally for
java…)

But, I haven’t yet used HTTPS from Rails.

Could someone share some hints? What would be the simplest approach so I
can start testing with the service? I’ll enable https on webrick

So far I have some doubts:

  • Do I need to generate my own keys or just use the one I got
  • Where do I need to place the cert
  • I’ve seen somewhere that a file crypto.yml is needed to access the
    keystore/s
  • How do I finally use them in my app

I’ve seen many tutorials but none simplified to get the very basic thing
running.
Any pointers appreciated. I’ll continue looking at tutorials…

Thanks

Hi,

Here’s an update in case it can help someone else later.

So I needed to make SOAP request over HTTPS. I just had a crt file from
the SOAP server.

Besides soap4r plugin I required the next as well

require “soap/wsdlDriver”
require ‘http-access2’


My SOAP request needed also basic auth as well, and I only managed to
include those headers using this:

class HTTP::Message::Headers
alias :set_header :set_header unless
method_defined?(:set_header)

def set_header
    __set_header__
    set('Authorization','Basic czsddddddddsdsdsdsdsyMzQ=')
end

end


I placed the cert I got into /certs folder

I created a file called “property” into /lib/soap and added
the cert info so soap4r plugin gets it:

client.protocol.http.ssl_config.ca_file =


To make the SOAP request I did the next:

wsdl = ‘https://xxx.xxx.xxx.xxx/soap/services
factory = SOAP::RPC::Driver.new(wsdl)
factory.add_method(‘getServices’, ‘’)

factory.wiredump_dev = STDERR <— so useful to see the SOAP messages

result = factory.getServices()

Cheers