SOAP and NTLM Authentication

A

Andrew Porter

[Note: parts of this message were removed to make it a legal post.]

I'm trying to integrate with Sharepoint Services, and need to connect
to the server using NTLM authentication. I can't get the following
lines of code to work:

WSDL_URL = 'http://sharepoint.wavetronix.local/_vti_bin/lists.asmx?WSDL'
soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver

I keep getting a 401, "Unauthorized" error. This code does work:

client = HTTPClient.new
client.set_auth(nil, 'DOMAIN\username', 'password')
response = client.get(WSDL_URL)

All examples I find show setting authorization properties AFTER the
create_rpc_driver call above. I need to authorize BEFORE so I can
actually access the WSDL file. How do I do this?

Andy Porter
p: (801) 319-0475 | e: (e-mail address removed)
 
M

Mark Thomas

[Note:  parts of this message were removed to make it a legal post.]

I'm trying to integrate with Sharepoint Services, and need to connect  
to the server using NTLM authentication. I can't get the following  
lines of code to work:

WSDL_URL = 'http://sharepoint.wavetronix.local/_vti_bin/lists.asmx?WSDL'
soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver

I keep getting a 401, "Unauthorized" error. This code does work:

client = HTTPClient.new
client.set_auth(nil, 'DOMAIN\username', 'password')
response = client.get(WSDL_URL)

All examples I find show setting authorization properties AFTER the  
create_rpc_driver call above. I need to authorize BEFORE so I can  
actually access the WSDL file. How do I do this?

http://markthomas.org/2007/09/12/getting-started-with-soap4r/
 
A

Andrew Porter

The example you give on your blog, like all the others I've seen,
assumes the WSDL file is "in the open." In my case, I have to
authenticate in order to even get to it. Your example creates the
driver first, then adds authentication for subsequent requests. I
can't even create the driver. The SOAP::WSDLDriverFactory.new() call
fails every time with a 401, "Unauthorized" error.

Also, I'm using the SOAP libraries in Ruby 1.8.6. It's my
understanding that soap4r was integrated into this version of Ruby. Am
I mistaken?


[Note: parts of this message were removed to make it a legal post.]

I'm trying to integrate with Sharepoint Services, and need to connect
to the server using NTLM authentication. I can't get the following
lines of code to work:

WSDL_URL = 'http://sharepoint.wavetronix.local/_vti_bin/lists.asmx?WSDL'
soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver

I keep getting a 401, "Unauthorized" error. This code does work:

client = HTTPClient.new
client.set_auth(nil, 'DOMAIN\username', 'password')
response = client.get(WSDL_URL)

All examples I find show setting authorization properties AFTER the
create_rpc_driver call above. I need to authorize BEFORE so I can
actually access the WSDL file. How do I do this?

http://markthomas.org/2007/09/12/getting-started-with-soap4r/
 
D

Dan Webb [dbw]

I'm not sure it'll be totally helpful. But the tutorial I wrote on
adding extra header using SOAP4R may point you in the right direction.

http://dan-webb.co.uk/wordpress/?p=3D13

SOAP4R was integrated in 1.8.6 but is an old and buggy version of it. So
you Hiro recommends you update it and use the newer version (1.5.8)


Cheers,
Dan


-----Original Message-----
From: Andrew Porter [mailto:p[email protected]]=20
Sent: 27 March 2009 16:01
To: ruby-talk ML
Subject: Re: SOAP and NTLM Authentication

The example you give on your blog, like all the others I've seen, =20
assumes the WSDL file is "in the open." In my case, I have to =20
authenticate in order to even get to it. Your example creates the =20
driver first, then adds authentication for subsequent requests. I =20
can't even create the driver. The SOAP::WSDLDriverFactory.new() call =20
fails every time with a 401, "Unauthorized" error.

Also, I'm using the SOAP libraries in Ruby 1.8.6. It's my =20
understanding that soap4r was integrated into this version of Ruby. Am =20
I mistaken?


[Note: parts of this message were removed to make it a legal post.]

I'm trying to integrate with Sharepoint Services, and need to connect
to the server using NTLM authentication. I can't get the following
lines of code to work:

WSDL_URL =3D 'http://sharepoint.wavetronix.local/_vti_bin/lists.asmx?WSDL'
soap =3D SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver

I keep getting a 401, "Unauthorized" error. This code does work:

client =3D HTTPClient.new
client.set_auth(nil, 'DOMAIN\username', 'password')
response =3D client.get(WSDL_URL)

All examples I find show setting authorization properties AFTER the
create_rpc_driver call above. I need to authorize BEFORE so I can
actually access the WSDL file. How do I do this?

http://markthomas.org/2007/09/12/getting-started-with-soap4r/
 
M

Mark Thomas

The example you give on your blog, like all the others I've seen,  
assumes the WSDL file is "in the open." In my case, I have to  
authenticate in order to even get to it. Your example creates the  
driver first, then adds authentication for subsequent requests. I  
can't even create the driver. The SOAP::WSDLDriverFactory.new() call  
fails every time with a 401, "Unauthorized" error.

Since you have shown you can get the WSDL, can't you just use it
locally when generating your client?

wsdl2ruby --wsdl said:
Also, I'm using the SOAP libraries in Ruby 1.8.6. It's my  
understanding that soap4r was integrated into this version of Ruby. Am  
I mistaken?

Do NOT use the built-in libraries. Please upgrade to the latest.
 
A

Andrew Porter

The following code seems to be working:

require 'rubygems'
gem 'soap4r'
require 'defaultDriver'

user = 'DOMAIN\username'
pass = 'password'

driver = ListsSoap.new
driver.options['protocol.http.auth.ntlm'] = [nil, user, pass]
driver.wiredump_file_base = 'soap.log'

lists = driver.getListCollection(nil)


I used the wsdl2ruby utility and generated the files. I was, however,
hoping to do this dynamically…
 
V

Vetrivel Vaithilingam

Andrew said:
The following code seems to be working:

require 'rubygems'
gem 'soap4r'
require 'defaultDriver'

user = 'DOMAIN\username'
pass = 'password'

driver = ListsSoap.new
driver.options['protocol.http.auth.ntlm'] = [nil, user, pass]
driver.wiredump_file_base = 'soap.log'

lists = driver.getListCollection(nil)


I used the wsdl2ruby utility and generated the files. I was, however,
hoping to do this dynamically…


Hai ,
I have tried this . But it is not working . For network
credential i have used this . After using also , i got Authentication
failure error from the server .
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top