# Web service client help needed

**URL:** <https://www.ruby-forum.com/t/web-service-client-help-needed/86094>\
**Category:** Ruby\
**Created:** [February 19, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094 "2007-02-19T21:00:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 19, 2007, 9:00pm UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/1 "2007-02-19T21:00:44Z")

</div>

I still can do this web service right so I ask for some help please.  
I got the wsdl and make a client with wsdl2ruby.rb. When I run ruby -d  
client I got the following output:

= Request

! CONNECT TO XXX.XXX.XXX.XXX:80  
! CONNECTION ESTABLISHED  
POST /DataFeed/DataFeed.asmx HTTP/1.1  
SOAPAction: “[Bing](http://tempuri.org/ReturnLastPriceList)”  
Content-Type: text/xml; charset=utf-8  
User-Agent: SOAP4R/1.5.5 (http-access2.rb/1.1.1.1, ruby 1.8.5  
(2006-12-25) [i386 -mswin32])  
Date: Mon Feb 19 20:41:00 +0100 2007  
Content-Length: 339  
Host: XXX.XXX.XXX.XXX

\<?xml version="1.0" encoding="utf-8" ?\>

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
ZVDPR\</  
ReturnLastPriceList\>

\</env:Body\>  
\</env:Envelope\>

= Response

HTTP/1.1 401 Access Denied  
Server: Microsoft-IIS/5.0  
Date: Mon, 19 Feb 2007 19:40:40 GMT  
WWW-Authenticate: Negotiate  
WWW-Authenticate: NTLM  
Connection: close  
Content-Length: 4431  
Content-Type: text/html

…

I have this web service client in C# but I would like to make it on  
ruby. I ask you for some help, example or a hint.  
Thanks in advance.

dima

---

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 20, 2007, 12:12am UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/2 "2007-02-20T00:12:13Z")

</div>

On 2/19/07, dima [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Content-Type: text/xml; charset=utf-8  
> xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
> Server: Microsoft-IIS/5.0  
> ruby. I ask you for some help, example or a hint.  
> Thanks in advance.
> 
> dima

Just a guess (knowing almost nothing about IIS, NTLM nor WSDL): This  
seems to be an authentication problem. Somewhere (ruby’s tracker?  
svn?) there’s a patch that adds ntlm auth support for net/http.  
Perhaps you could try that. (see ruby-core:10341)

---

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 20, 2007, 12:26am UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/3 "2007-02-20T00:26:14Z")

</div>

On Feb 19, 11:57 am, “dima” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> = Response
> 
> HTTP/1.1 401 Access Denied  
> Server: Microsoft-IIS/5.0  
> Date: Mon, 19 Feb 2007 19:40:40 GMT  
> WWW-Authenticate: Negotiate  
> WWW-Authenticate: NTLM  
> Connection: close  
> Content-Length: 4431  
> Content-Type: text/html

Your web server is rejecting your connection attempt, because you  
haven’t authenticated. If your client will only run on Windows  
systems, you could try the patch below[1], which supports NTLM  
authentication; otherwise, consider using client IP address, or some  
application-level control, for authentication, as NTLM is a  
proprietary Microsoft auth mechanism, and will block most client  
platforms from being able to access your service.

-Lennon

1 -  
[http://rubyforge.org/tracker/index.php?func=detail&aid=5177&group\_id=426&atid=1700](http://rubyforge.org/tracker/index.php?func=detail&aid=5177&group_id=426&atid=1700)

---

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 20, 2007, 9:35am UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/4 "2007-02-20T09:35:54Z")

</div>

Thank you for you swift response.  
I guessed that the problem is with authentication and with NTLM.  
Unfortunately I do not know what that is all about.  
It will be extremely helpful if you have some kind of sample code.

dima

---

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 20, 2007, 9:10pm UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/5 "2007-02-20T21:10:57Z")

</div>

I had to use the 3rd party web service that will not change by mine  
request.  
The rubyntlm has a working http example, throughout socket connection,  
that I will explore and try to combine with soap4r.  
I will share the results of this quest.

dima

---

<div class="post-metadata">

**Author:** ![dima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@dima](https://www.ruby-forum.com/u/dima)\
**Post date:** [February 20, 2007, 7:55pm UTC](https://www.ruby-forum.com/t/web-service-client-help-needed/86094/6 "2007-02-20T19:55:38Z")

</div>

On Feb 20, 12:31 am, “dima” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thank you for you swift response.  
> I guessed that the problem is with authentication and with NTLM.  
> Unfortunately I do not know what that is all about.  
> It will be extremely helpful if you have some kind of sample code.

My suggestion would be to talk to your server administrator, and see  
about turning off the NTLM auth – as I said, it’s a proprietary spec  
used almost exclusively Microsoft-only shops, and is going to cause  
you all kinds of problems when trying to access your web service from  
other client platforms. (Plus, anything based on NTLM auth is  
inherently insecure, as it’s rather easy to crack the LanMan hash  
format.)

If you really need HTTP authentication, stick to the basics: HTTP-  
Digest, optionally protected by HTTPS if you need transport-level  
encryption, too. Take a look here for some examples of using standard  
HTTP authentication with a ruby SOAP client:

> **[SOAP + Basic Authentication in Ruby](http://chrismcmahonsblog.blogspot.com/2006/03/soap-basic-authentication-in-ruby.html)**
>
> Do you need to do SOAP in Ruby? First of all, install the latest version of Ruby you can stand. (I'm using this one . What the heck. I'...

Hope that helps,

-rcoder
