# Webservice consumption over SSL

**URL:** <https://www.ruby-forum.com/t/webservice-consumption-over-ssl/98766>\
**Category:** Rails\
**Created:** [January 30, 2006, 11:17am UTC](https://www.ruby-forum.com/t/webservice-consumption-over-ssl/98766 "2006-01-30T11:17:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giedrius\_Banaitis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90ced4/32.png) [@Giedrius\_Banaitis](https://www.ruby-forum.com/u/Giedrius_Banaitis)\
**Post date:** [January 30, 2006, 11:17am UTC](https://www.ruby-forum.com/t/webservice-consumption-over-ssl/98766/1 "2006-01-30T11:17:45Z")

</div>

Hi, as long as nobody answered to my previous question, i’ll try to  
write in another way.  
I have:  
webservice WSDL link ([https://something?WSDL](https://something?WSDL), that’s .net webservice)  
pem file (certificate, needed to authentificate for gettting data)

i need :  
to consume that webservice without describing API’s for each method (i  
mean use WSL to construct needed structures or objects).

condition:  
use as litle lines of code as possible 🙂  
btw, i would prefer solution, that would work on standart ruby  
instalation (without additional installs, is that possible)

i’ve tried by my self SOAP::WSDLFactoryDriver, but that didn’t worked  
correct (may be because of the lack of information about working using  
SSL,  
but looks like problem is more serious - it didn’t recognized some xml  
elements in .net standart webservice WSDL description)

---

<div class="post-metadata">

**Author:** ![Giedrius\_Banaitis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90ced4/32.png) [@Giedrius\_Banaitis](https://www.ruby-forum.com/u/Giedrius_Banaitis)\
**Post date:** [January 30, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/webservice-consumption-over-ssl/98766/2 "2006-01-30T12:16:37Z")

</div>

I didn’t see your previous message, so I hope I understand your  
question correctly.

Look at [http://dev.ctor.org/soap4r/wiki/HowtouseWSDL4R](http://dev.ctor.org/soap4r/wiki/HowtouseWSDL4R) to see how to  
generate Ruby classes from the WSDL files. Make sure you’re using the  
latest stable SOAP4R (or even trunk).

Just set your endpoint to the https location:  
[https://my.web.service/service.cgi](https://my.web.service/service.cgi) (or whatever extension [asp.net](http://asp.net)  
uses).

If your server has a self-generated certificate you’ll need to set a  
few more options:

```
@service_type = 

```

ServiceType.new(“[https://my.web.service/service.cgi](https://my.web.service/service.cgi)”)  
@service\_type.options[“protocol.http.ssl\_config.verify\_mode”] = nil

And, if you also need to authenticate with http basic authentication:

```
@service_type.options["protocol.http.basic_auth"] <<

```

[“[https://my.web.service/service.cgi](https://my.web.service/service.cgi)” “username”, “password”]

Finally, when you generate the Ruby classes from the WSDL files, you  
will receive a ‘Client.rb’ class for each type. Have a look at that  
for examples on consuming the web services.

Hope that helps a bit?

Ben

---

<div class="post-metadata">

**Author:** ![Giedrius\_Banaitis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90ced4/32.png) [@Giedrius\_Banaitis](https://www.ruby-forum.com/u/Giedrius_Banaitis)\
**Post date:** [January 30, 2006, 2:36pm UTC](https://www.ruby-forum.com/t/webservice-consumption-over-ssl/98766/3 "2006-01-30T14:36:29Z")

</div>

Thanks a lot, i’ve seen that example before, but only now i’ve payed  
attention, that they are using wsdl2ruby first 🙂  
anyway, now i’m having problems with wsdl2ruby, it comes with  
NoMethodError ☹
