Ruby SOAP Bug?

G

Greg Lazarev

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

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

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.
 
G

Greg Lazarev

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?
 
G

Greg Lazarev

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'
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
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
 
G

Greg Lazarev

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.
 
G

Galen Palmer

S2 said:
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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top