# Simple HTTPS usage

**URL:** <https://www.ruby-forum.com/t/simple-https-usage/176572>\
**Category:** Rails\
**Created:** [October 2, 2009, 10:31am UTC](https://www.ruby-forum.com/t/simple-https-usage/176572 "2009-10-02T10:31:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [October 2, 2009, 10:31am UTC](https://www.ruby-forum.com/t/simple-https-usage/176572/1 "2009-10-02T10:31:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [October 15, 2009, 9:25am UTC](https://www.ruby-forum.com/t/simple-https-usage/176572/2 "2009-10-15T09:25:06Z")

</div>

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](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
