josephholsten/rets4r — Issue #25: Unable to parse XML on first try due to 'undefined method `each' for #<String:
Author: eric-roland
Created: 2012-01-24 22:38:21+00:00
State: open

I am trying to log into RIMLS:

client = RETS4R::Client.new('http://ris.retsiq.com/rets/login')
client.logger = @@importer_logger
client.set_pre_request_block do |rets, http, headers|
headers["User-Agent"] = "RETS4R/0.8.5"
end
client.login('someusername', 'somepassword')

And it is throwing a parsing exception:

RETS4R::Client::ParserException: #
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client/parser/rexml.rb:54:in `rescue in parse'
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client/parser/rexml.rb:38:in `parse'
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client/parser/rexml.rb:46:in `rescue in parse'
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client/parser/rexml.rb:38:in `parse'
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client.rb:163:in `parse'
from /Users/Eric/.rvm/gems/ruby-1.9.2-p290/gems/rets4r-0.8.5/lib/rets4r/client.rb:274:in `login'

Log:

-> "HTTP/1.1 200 OK\r\n"

-> "Set-Cookie: JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; Path=/\r\n"

-> "Set-Cookie: JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; Path=/\r\n"

-> "MIME-Version: 1.0\r\n"

-> "Cache-Control: private\r\n"

-> "RETS-Version: RETS/1.7\r\n"

-> "X-AspNet-Version: 2.0.50727\r\n"

-> "Date: Tue, 24 Jan 2012 22:30:48 GMT\r\n"

-> "Set-Cookie: ASP.NET_SessionId=ibj2ebzs4gt1qwypfyt5r555; path=/; HttpOnly\r\n"

-> "Set-Cookie: RETS-Session-ID=ibj2ebzs4gt1qwypfyt5r555; path=/\r\n"

-> "RETS-Server: Interealty-RETS/1.5.247.0\r\n"

-> "Server: Microsoft-IIS/6.0\r\n"

-> "Cache-Control: private\r\n"

-> "Cache-Control: private, max-age=0\r\n"

-> "WWW-Authenticate: Digest realm=\"rets@retsiq.com\",qop=\"auth\",nonce=\"8bcfc4871b7be2d7074251b025fde500\", opaque=\"3005cbc41daa2\"\r\n"

-> "Content-Type: text/xml\r\n"

-> "Content-Length: 541\r\n"

-> "\r\n"

reading 541 bytes...

-> "\r\n\r\nMemberName=Some User\r\nUser=Some Broker\r\nBroker=Some Broker\r\nMetadataVersion=30.15.91715\r\nMetadataTimestamp=Fri, 20 Jan 2012 15:28:35 GMT\r\nMinMetadataTimestamp=Fri, 20 Jan 2012 15:28:35 GMT\r\nTimeoutSeconds=3600\r\nChangePassword=/rets/changepassword\r\nGetMetadata=/rets/getmetadata\r\nGetObject=/rets/getobject\r\nLogin=/rets/login\r\nLogout=/rets/logout\r\nSearch=/rets/search\r\nX-Selector=/rets/selector\r\n\r\n\r\n"

read 541 bytes

Conn keep-alive

Response headers: {"set-cookie"=>["JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; Path=/", "JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; Path=/", "ASP.NET_SessionId=ibj2ebzs4gt1qwypfyt5r555; path=/; HttpOnly", "RETS-Session-ID=ibj2ebzs4gt1qwypfyt5r555; path=/"], "mime-version"=>["1.0"], "cache-control"=>["private", "private", "private, max-age=0"], "rets-version"=>["RETS/1.7"], "x-aspnet-version"=>["2.0.50727"], "date"=>["Tue, 24 Jan 2012 22:30:48 GMT"], "rets-server"=>["Interealty-RETS/1.5.247.0"], "server"=>["Microsoft-IIS/6.0"], "www-authenticate"=>["Digest realm=\"rets@retsiq.com\",qop=\"auth\",nonce=\"8bcfc4871b7be2d7074251b025fde500\", opaque=\"3005cbc41daa2\""], "content-type"=>["text/xml"], "content-length"=>["541"]}
Set header 'Cookie' to 'JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; JSESSIONID=0EC465C71AE7A1C5EC089917C8C482CF; ASP.NET_SessionId=ibj2ebzs4gt1qwypfyt5r555; RETS-Session-ID=ibj2ebzs4gt1qwypfyt5r555'

MemberName=Some Body

User=Some Info

Broker=Some Broker

MetadataVersion=30.15.91715

MetadataTimestamp=Fri, 20 Jan 2012 15:28:35 GMT

MinMetadataTimestamp=Fri, 20 Jan 2012 15:28:35 GMT

TimeoutSeconds=3600

ChangePassword=/rets/changepassword

GetMetadata=/rets/getmetadata

GetObject=/rets/getobject

Login=/rets/login

Logout=/rets/logout

Search=/rets/search

X-Selector=/rets/selector

Unable to parse XML on first try due to 'undefined method `each' for #'. Now retrying.
REXML parser was unable to parse XML: NilClass is not a valid input stream. It must walk
like either a String, an IO, or a Source.
Unparsable XML was:

=====================

Any ideas? Rails 3.0.9 Ruby 1.9.2