From: ruby talk Date: 2005-05-17T22:11:27+09:00 Subject: Google API, Soap and windows XP Hello,I am playing with the google api and soap. I have the newest versionof soap and i think ruby 1.8. I created my code on a laptop withmandrake 10.2 with the same version of ruby and soap. On my laptop itworks fine. On my windows computer it give me an error."F:\Documents and Settings\iv\Desktop\googlerip>ruby googled.rbmonkey filetype:pdfLoading compatibility library...c:/ruby/lib/ruby/1.8/xsd/datatypes.rb:172:in `_set': {http://www.w3.org/2001/XMLSchema}string: cannot accept '... Tibetan year of the monkey. These instructions are traditionally given ...
thus will give the rare ΓÇÖMonkey-Year-TeachingsΓÇÖ after the inauguration in ...'. (XSD::ValueSpaceError) from c:/ruby/lib/ruby/1.8/xsd/datatypes.rb:114:in `set' from c:/ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:453:in `decode_textbuf' from c:/ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:214:in `decode_tag_end' from c:/ruby/lib/ruby/1.8/soap/parser.rb:185:in `decode_tag_end' from c:/ruby/lib/ruby/1.8/soap/parser.rb:146:in `end_element' from c:/ruby/lib/ruby/1.8/xsd/xmlparser/parser.rb:75:in `end_element' from c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:36:in `do_parse' from c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `parse' ... 7 levels... from (eval):2:in `doGoogleSearch' from googled.rb:16 from googled.rb:15:in `each' from googled.rb:15" I am working off an example i found on the internet. Here is my code: require "soap/driver" ENDPOINT = 'http://api.google.com/search/beta2' NS = 'urn:GoogleSearch' KEY = "Enter_your_Key" fail "Missing query args" if ARGV.empty? query = ARGV.join(" ") soap = SOAP::Driver.new(nil, nil, NS, ENDPOINT) soap.addMethodWithSOAPAction( 'doGoogleSearch', NS, 'key', 'q', 'start', 'maxResults', 'filter', 'restrict', 'safeSearch', 'lr', 'ie', 'oe') i=0for i in 0..90 res = soap.doGoogleSearch( KEY, query, i, 10, false, nil, false, nil, 'latin1', 'latin1') puts "Estimated result count: " + res.estimatedTotalResultsCount puts "Searched in:" + res.searchTime + " seconds" puts "Index start:" + res.startIndex puts "Index End:" + res.endIndex res.resultElements.each do |entry| puts puts entry.URL puts filename=entry.URL.gsub("//", '').gsub("~", '').gsub("/", '') if(!(FileTest.exist?(filename))) then aFile = File.new(filename, "w+") aFile.puts Net::HTTP.get(URI.parse(entry.URL)) puts entry.snippet end end i=i+9end Am i missing something on my windows computer? Becker