From: Dido Sevilla Date: 2006-02-14T20:15:32+09:00 Subject: Odd HTTP headers causing SOAP to fail 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.