# Ruby SOAP Bug?

**URL:** <https://www.ruby-forum.com/t/ruby-soap-bug/139440>\
**Category:** Ruby\
**Created:** [June 3, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440 "2008-06-03T22:54:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 3, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/1 "2008-06-03T22:54:37Z")

</div>

I’ve spent a few days now looking on how to access a wsdl over ssl.  
I’m using Ruby 1.8.6 and SOAP4R 1.5.8  
In short, I need to connect to a wsdl file and also need to do the basic  
authentication before SOAP::WSDLDriverFactory.new call.  
So I created a soap/property file and put the correct information in  
there.  
I followed this link for a simple ruby program:  
[http://dev.ctor.org/soap4r/wiki/AccessingBasicAuthProtectedWsdl](http://dev.ctor.org/soap4r/wiki/AccessingBasicAuthProtectedWsdl)

After I set everything up, I started seeing weird errors.  
So I debugged an debugged and finally I saw something funky with the  
httpconfigloader.rb’s set\_basic\_auth method.  
So I googled to see if it’s a bug or not and came upon this blog:  
[http://cubiclecoder.blogspot.com/2005/10/of-aggregators-laptops-ruby-and-soap.html](http://cubiclecoder.blogspot.com/2005/10/of-aggregators-laptops-ruby-and-soap.html)

He talks about the same problem I am having with set\_basic\_auth.  
But noone else seems to have this problem.

So what do I do in this case?  
Do I submit this as a bug to Ruby guys?  
Is this indeed a bug?

I would appreciate any responses.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 3, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/2 "2008-06-03T23:31:01Z")

</div>

Greg L. wrote:

> I would appreciate any responses.

I wrote a blog post a few days ago about how to do this:  
[http://s2.diffuse.it/blog/show/62\_Consume+SSL+protected+Web+Services+with+soap4r](http://s2.diffuse.it/blog/show/62_Consume+SSL+protected+Web+Services+with+soap4r)  
maybe it is of some use to you.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 4, 2008, 12:04am UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/3 "2008-06-04T00:04:24Z")

</div>

I actually have looked at your blog as well when developing/debugging.  
My coding strategy is pretty much the same as yours.  
I’m using  
client.protocol.http.ssl\_config.verify\_mode=OpenSSL::SSL::VERIFY\_NONE  
option instead of messing with the certificates.

However my problem is that the set\_basic\_auth function does not treat  
the entries in the soap/property file correctly. Basically what happens  
is client.set\_basic\_auth gets called three times with these values:  
First time: url, nil, nil  
Second time: nil, userid, nil  
Third time: nil, nil, password

I find it strange that not more people are seeing this problem.  
And since your code is working, I confused why mine is not.  
What are your ruby and soap4r versions?

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 4, 2008, 9:10am UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/4 "2008-06-04T09:10:59Z")

</div>

Greg L. wrote:

> I actually have looked at your blog as well when developing/debugging.

cool 🙂 at least i did not write that post only for me alone 🙂

> However my problem is that the set\_basic\_auth function does not treat  
> the entries in the soap/property file correctly. Basically what happens  
> is client.set\_basic\_auth gets called three times with these values:  
> First time: url, nil, nil  
> Second time: nil, userid, nil  
> Third time: nil, nil, password

i don’t know. this did not happen to me, so i can’t help you. sorry.

> I find it strange that not more people are seeing this problem.  
> And since your code is working, I confused why mine is not.  
> What are your ruby and soap4r versions?

ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]  
soap4r (1.5.8)

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 4, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/5 "2008-06-04T20:00:32Z")

</div>

OK, I was able to solve this by using the soap4r gem. All I did was  
added:

gem ‘soap4r’

line to the top of my code.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 4, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/6 "2008-06-04T21:15:37Z")

</div>

Greg L. wrote:

> OK, I was able to solve this by using the soap4r gem. All I did was  
> added:
> 
> gem ‘soap4r’
> 
> line to the top of my code.

Great. Thanks for sharing.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 4, 2008, 7:23pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/7 "2008-06-04T19:23:56Z")

</div>

So I think I might have figured out what the problem is.

I looked at the soap4r’s httpconfigloader.rb and it handles  
set\_basic\_auth different then ruby’s soap/httpconfigloader.rb. I’m  
guessing the “bug” is really only in the ruby’s version.  
I have the soap4r gem installed but I am not using it for some reason.  
What is the difference between the ruby’s soap and soap4r? They seem  
quite similar.  
Am I suppose to require something to use the soap4r’s version of the  
code?

Here’s my simple app, by the way:

require ‘soap/wsdlDriver’  
wsdl = ‘[https://server/path/to/file.wsdl](https://server/path/to/file.wsdl)’  
soap = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver

And here’s the soap/property file:

client.protocol.http.basic\_auth.1.url = [https://server/path/to/file.wsdl](https://server/path/to/file.wsdl)  
client.protocol.http.basic\_auth.1.userid = username  
client.protocol.http.basic\_auth.1.password = password

client.protocol.http.ssl\_config.verify\_mode=OpenSSL::SSL::VERIFY\_NONE

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [September 20, 2010, 8:16pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/8 "2010-09-20T20:16:30Z")

</div>

S2 wrote:

> Greg L. wrote:
> 
> > OK, I was able to solve this by using the soap4r gem. All I did was  
> > added:
> > 
> > gem ‘soap4r’
> > 
> > line to the top of my code.
> 
> Great. Thanks for sharing.

I apologize in advance for a dumb question, but in a Rails 2.3.x  
environment. Where should the property file go?

And, when you say: soap/property  
Is it supposed to be a file called “property” in a directory called  
“soap” under “lib” ? e.g. PROJECT\_ROOT/lib/soap/property ?

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [January 25, 2012, 12:36pm UTC](https://www.ruby-forum.com/t/ruby-soap-bug/139440/9 "2012-01-25T12:36:22Z")

</div>

Galen Palmer wrote in post #942421:

> And, when you say: soap/property  
> Is it supposed to be a file called “property” in a directory called  
> “soap” under “lib” ? e.g. PROJECT\_ROOT/lib/soap/property ?

…just in case anyone else comes across this question:  
Yes, a file called “property” in a directory called “soap” somewhere in  
the ruby path or in your appplication’s directory.
