Forum: Ruby Odd HTTP headers causing SOAP to fail

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2d3ec3a83b4f8784d6853564fa0d2e77?d=identicon&s=25 Dido Sevilla (Guest)
on 2006-02-14 15:13
(Received via mailing list)
I've been tasked to interop with a SOAP gateway provided by another
company to access their service, and have tried to write a program
using the soap4r that's integrated with Ruby 1.8.4, based on some code
those people have written for Perl's SOAP::Lite. I've ran into strange
errors when attempting to make SOAP calls to their server, which is
apparently based on IIS.  A wiredump shows the following:

-> "HTTP/1.1 100 Continue\r\n"
-> "Server: Microsoft-IIS/5.0\r\n"
-> "Date: Tue, 14 Feb 2006 11:04:56 GMT\r\n"
-> "\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Server: Microsoft-IIS/5.0\r\n"
-> "Date: Tue, 14 Feb 2006 11:05:06 GMT\r\n"
-> "Connection: close\r\n"
-> "HTTP/1.1 200 OK\r\n"
/usr/lib/ruby/1.8/net/http.rb:2006:in `each_response_header': wrong
header line format (Net::HTTPBadResponse)
	from /usr/lib/ruby/1.8/net/http.rb:1979:in `read_new'
	from /usr/lib/ruby/1.8/net/http.rb:1046:in `request'
	from /usr/lib/ruby/1.8/net/http.rb:840:in `post'
	from /usr/lib/ruby/1.8/soap/netHttpClient.rb:93:in `post'
	from /usr/lib/ruby/1.8/soap/netHttpClient.rb:116:in `start'
	from /usr/lib/ruby/1.8/net/http.rb:545:in `start'
	from /usr/lib/ruby/1.8/soap/netHttpClient.rb:115:in `start'
	from /usr/lib/ruby/1.8/soap/netHttpClient.rb:92:in `post'
	from /usr/lib/ruby/1.8/soap/streamHandler.rb:170:in `send_post'
	from /usr/lib/ruby/1.8/soap/streamHandler.rb:109:in `send'
	from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route'
	from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call'
	from /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call'
	from /usr/lib/ruby/1.8/soap/rpc/driver.rb:232:in `login'
	from soaptest.rb:23

It appears that their IIS server resent the 'HTTP/1.1 200 OK' status
line, and that caused net/http to raise the wrong header line format
exception. The equivalent code with Perl and SOAP::Lite has no
problems making calls on their site. A desperate, one-line addition to
net/http.rb, after line 2003, adding the following:

          next if line =~ /^HTTP/

seems like it's able to work around the bug, and now my Ruby SOAP
program works alright.  Of course, I'm not happy with this local patch
that I've done (an upgrade will instantly break my programs unless
this has been addressed), and am wondering if anyone else has
encountered this type of behavior with IIS or other HTTP servers, used
either in a SOAP context or otherwise. The fact that SOAP::Lite (0.66,
and libwww-perl 5.803) on Perl 5.8.7 had no trouble with their site
makes me feel that this is a bug.

By the way, exact system description: Gentoo Linux, Ruby 1.8.4-r1,
soap4r 1.5.5.  The same behavior manifests on Ruby 1.8.2.
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-02-14 16:54
(Received via mailing list)
On Tuesday 14 February 2006 08:15 pm, Dido Sevilla wrote:

Please email NaHi nahi@ruby-lang.org
and/or
use the trac http://dev.ctor.org/soap4r

Tsume
This topic is locked and can not be replied to.