# How to use WSDLDriverFactory with basic authentication?

**URL:** <https://www.ruby-forum.com/t/how-to-use-wsdldriverfactory-with-basic-authentication/52044>\
**Category:** Ruby\
**Created:** [January 10, 2006, 2:04pm UTC](https://www.ruby-forum.com/t/how-to-use-wsdldriverfactory-with-basic-authentication/52044 "2006-01-10T14:04:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddavidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@ddavidson](https://www.ruby-forum.com/u/ddavidson)\
**Post date:** [January 10, 2006, 2:04pm UTC](https://www.ruby-forum.com/t/how-to-use-wsdldriverfactory-with-basic-authentication/52044/1 "2006-01-10T14:04:40Z")

</div>

I am trying to use SOAP::WSDLDriverFactory but the server requires  
basic authentication.

I’ve tried using something like:

WSDL\_URI = ‘[http://user:password@server:80/TestService?wsdl](http://user:password@server:80/TestService?wsdl)’;  
factory = SOAP::WSDLDriverFactory.new(WSDL\_URI)

But I keep getting parse errors:

/usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:112:in `decode\_tag’: Unknown  
element {}html. (WSDL::XMLSchema::Parser::UnknownElementError)

Which I am rather sure is due to the need for basic authentication,  
since other SOAP services that don’t require authentication work just  
fine. I can also get the raw WSDL just fine using something like:

require ‘net/http’  
Net::HTTP.start(‘server’) { |http|  
req = Net::HTTP::Get.new(“/TestService?wsdl”)  
req.basic\_auth( ‘user’, ‘password’ )  
response = http.request(req)  
puts response.body  
}

Any tips on how to use basic authentication with WSDLDriverFactory, or  
how else can I work around this?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ddavidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@ddavidson](https://www.ruby-forum.com/u/ddavidson)\
**Post date:** [February 5, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/how-to-use-wsdldriverfactory-with-basic-authentication/52044/2 "2006-02-05T15:40:54Z")

</div>

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

Hi,

Sorry for late reply.

ddavidson wrote:

> /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:112:in `decode\_tag’: Unknown  
> element {}html. (WSDL::XMLSchema::Parser::UnknownElementError)

No easy way for now. It should be allowed to configure basic\_auth  
user/passwd with property file. Soap4r client reads “soap/property”  
file in ruby’s search path but you cannot set basic\_auth parameters now.  
I filed a ticket at [http://dev.ctor.org/soap4r/ticket/198](http://dev.ctor.org/soap4r/ticket/198) .

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFD5g3Pf6b33ts2dPkRAlBsAJ9BZWSVY97cYyTKlDVQJRcAyabTrwCgqtLo  
fDYa3UkC3BDtmGnGLfGmmrc=  
=JAq4  
-----END PGP SIGNATURE-----
