httpi: 401 when authenticating via ntlm with domain

I’m trying to communicate with soap service via savon. It requires ntlm authentication with domain. I use following code to test service connection:

request = HTTPI::Request.new
request.url = "service_url"
request.auth.ntlm("username", "password", "domain")

response = HTTPI.get(request)
response.body

but always get following error

#<HTTPI::Response:0x00000002b5fe30 @code=401, @headers={"content-type"=>"text/html", "server"=>"Microsoft-IIS/7.0", "www-authenticate"=>["Negotiate", "NTLM"], "x-powered-by"=>"ASP.NET", "date"=>"Fri, 30 Aug 2013 06:26:58 GMT", "content-length"=>"1293"}

But, when I’m trying to access service via browser using Domain\Username and password everything is ok.

Am I doing smthing wrong??

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 28 (16 by maintainers)

Most upvoted comments

Hey everyone, I’m having the same issue. The patch provided by @antoniusostermann didn’t help me and the server responds with 415 when applied.

Tested the same request with SoapUI and it’s working but not with httpi

Any help?

If anyone else comes here having a similar issue (only 401 responses), which is not fixed by updating rubyntlm / which is not directly concerned to the domain issue, and if your server responds two header entries (Negotiate AND NTLM), this issue might help you: https://github.com/savonrb/httpi/issues/139

I know this doesn’t belong to this issue directly, but I came here weeks ago, and would have been very happy if any comment here would have helped me solving my 401 issue.