# Soap4r with digest authentication

**URL:** <https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305>\
**Category:** Ruby\
**Created:** [May 11, 2008, 7:27pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305 "2008-05-11T19:27:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [May 11, 2008, 7:27pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/1 "2008-05-11T19:27:07Z")

</div>

Hello all,

I’ve been trying to get digest authentication working for soap calls for  
two weeks now. All the examples I find seem to be flawed. Here’s the  
code that I’m using which is right out of the httpclient docs.

require ‘httpclient’  
require “soap/wsdlDriver”  
require ‘soap/rpc/driver’  
require ‘uri’

user = “admin”  
pass = “pass”  
wsdl = “[http://someserver/file.wsdl](http://someserver/file.wsdl)”

driver = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver  
driver.instance\_methods  
driver.options[“protocol.http.digest\_auth”] \<\<  
[‘[http://someserver/SoapServer.php](http://someserver/SoapServer.php)’, user, pass]

info = driver.GetSystemInformation(‘’)  
puts info

I’ve changed the server url because I don’t want to expose it’s  
location.

The error I get is:  
c:/ruby/lib/ruby/1.8/soap/property.rb:269:in `check_lock': cannot add any key to locked property (TypeError) from c:/ruby/lib/ruby/1.8/soap/property.rb:192:in `local\_referent’  
from c:/ruby/lib/ruby/1.8/soap/property.rb:230:in `referent' from c:/ruby/lib/ruby/1.8/soap/property.rb:106:in `[]’  
from C:/Documents and Settings/Administrator/Desktop/mxpua.rb:19

The line numbers in mxpua.rb won’t match up, but I’m sure you guys see  
where it’s failing.

Any help with this would be great. I can’t understand how all the  
examples I find would all be wrong, but they all seem to use the same  
process to add the digest auth information to the object.

Thanks for your help.

-Ryan

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [May 13, 2008, 9:52pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/2 "2008-05-13T21:52:59Z")

</div>

Anyone? I’d really appreciate the help.

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [May 13, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/3 "2008-05-13T21:59:11Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Ryan Q. wrote:  
| Anyone? I’d really appreciate the help.

Wild guess: You are using SSL where you shouldn’t, or you aren’t using  
SSL where you should?

Can’t be of more help, though.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

~ “Summer is butter on your chin and corn mush between every tooth.”

- -Calvin  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgp8t8ACgkQbtAgaoJTgL8zOgCdG/VS4j6iJaOoB4VahLVoeygq  
2nYAmwYCHZYq5e0iX8Z0Dl0S5g2OUKXm  
=rwPh  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [May 14, 2008, 12:02am UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/4 "2008-05-14T00:02:04Z")

</div>

Phillip,

SSL shouldn’t be a factor here. The service I’m trying to access is  
clear-text http. Just using digest authentication.

The error that I’m getting in Ruby looks to be that I can’t modify the  
‘driver’ object once it’s been created.

I’m guessing that there is either a way to pass those options as the  
object is getting created or there is a different syntax to modify the  
object after it’s been created, but before the SOAP call gets sent.

Thanks,  
Ryan

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [September 7, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/5 "2008-09-07T19:00:59Z")

</div>

Ryan Q. wrote:

> The error I get is:  
> c:/ruby/lib/ruby/1.8/soap/property.rb:269:in `check_lock': cannot add any key to locked property (TypeError) from c:/ruby/lib/ruby/1.8/soap/property.rb:192:in`local\_referent’  
> from c:/ruby/lib/ruby/1.8/soap/property.rb:230:in `referent' from c:/ruby/lib/ruby/1.8/soap/property.rb:106:in`[]’  
> from C:/Documents and Settings/Administrator/Desktop/mxpua.rb:19

Are you running into this issue? I am trying to perform basic  
authentication and getting the same exception.

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [August 16, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/6 "2008-08-16T22:20:14Z")

</div>

Hello,

I have a bit of information, if you are still working on this.

I believe this line

> > driver.options[“protocol.http.digest\_auth”]

should really be

> > driver.options[“protocol.http.auth”]

If the server accepts basic authentication, that will be used.  
If the server accepts digest authentication, that will be used.

I send authentication information to the server in both cases,  
but only the first option (basic) is accepted by the server.

I would like to know if it works for you now?

Soren

Ryan Q. wrote:

> Hello all,
> 
> I’ve been trying to get digest authentication working for soap calls for  
> two weeks now. All the examples I find seem to be flawed. Here’s the  
> code that I’m using which is right out of the httpclient docs.
> 
> require ‘httpclient’  
> require “soap/wsdlDriver”  
> require ‘soap/rpc/driver’  
> require ‘uri’
> 
> user = “admin”  
> pass = “pass”  
> wsdl = “[http://someserver/file.wsdl](http://someserver/file.wsdl)”
> 
> driver = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver  
> driver.instance\_methods  
> driver.options[“protocol.http.digest\_auth”] \<\<  
> [‘[http://someserver/SoapServer.php](http://someserver/SoapServer.php)’, user, pass]
> 
> info = driver.GetSystemInformation(‘’)  
> puts info
> 
> I’ve changed the server url because I don’t want to expose it’s  
> location.
> 
> The error I get is:  
> c:/ruby/lib/ruby/1.8/soap/property.rb:269:in `check_lock': cannot add any key to locked property (TypeError) from c:/ruby/lib/ruby/1.8/soap/property.rb:192:in `local\_referent’  
> from c:/ruby/lib/ruby/1.8/soap/property.rb:230:in `referent' from c:/ruby/lib/ruby/1.8/soap/property.rb:106:in `[]’  
> from C:/Documents and Settings/Administrator/Desktop/mxpua.rb:19
> 
> The line numbers in mxpua.rb won’t match up, but I’m sure you guys see  
> where it’s failing.
> 
> Any help with this would be great. I can’t understand how all the  
> examples I find would all be wrong, but they all seem to use the same  
> process to add the digest auth information to the object.
> 
> Thanks for your help.
> 
> -Ryan

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [September 7, 2008, 7:33pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/7 "2008-09-07T19:33:28Z")

</div>

Ryan Q. wrote:

> Yup, still getting the same error.

I’m collaborating with a Ruby expert tomorrow to see if we can’t find a  
fix or workaround. I’ll update this thread if we succeed.

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [September 7, 2008, 7:23pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/8 "2008-09-07T19:23:47Z")

</div>

Yup, still getting the same error.

This change suggested above didn’t help either.

I believe this line

> > driver.options[“protocol.http.digest\_auth”]

should really be

> > driver.options[“protocol.http.auth”]

David Medinets wrote:

> Ryan Q. wrote:
> 
> > The error I get is:  
> > c:/ruby/lib/ruby/1.8/soap/property.rb:269:in `check_lock': cannot add any key to locked property (TypeError) from c:/ruby/lib/ruby/1.8/soap/property.rb:192:in`local\_referent’  
> > from c:/ruby/lib/ruby/1.8/soap/property.rb:230:in `referent' from c:/ruby/lib/ruby/1.8/soap/property.rb:106:in`[]’  
> > from C:/Documents and Settings/Administrator/Desktop/mxpua.rb:19
> 
> Are you running into this issue? I am trying to perform basic  
> authentication and getting the same exception.

---

<div class="post-metadata">

**Author:** ![rtq-ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@rtq-ruby](https://www.ruby-forum.com/u/rtq-ruby)\
**Post date:** [September 7, 2008, 9:12pm UTC](https://www.ruby-forum.com/t/soap4r-with-digest-authentication/137305/9 "2008-09-07T21:12:12Z")

</div>

That would be great. Let me know how it turns out.

I gave up using Ruby because of this. I wanted to move from Perl to Ruby  
for SOAP type services, but no love.
