Searching Google vith SOAP4R

(Dalibor Sramek) #1

Hi.

Does anybody use SOAP4R to access Google search service?

I do not want to dive too deep into SOAP peculiarities. So I just tried to
make Pickaxe examples to work. I am getting:
: No Deserializer found to deserialize a ':restrict' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'. (SOAP::FaultError)

I installed the newest SOAP4R version but Google samples included in the
distribution crashed on various errors too.

Any ideas?

Thanks

Dalibor Sramek

···

--
Dalibor Sramek http://www.insula.cz/dali \ In the eyes of cats
/ dalibor.sramek@insula.cz \ all things
/ >H blog http://www.transhumanismus.cz/blog.php \ belong to cats.

(Mauricio Fernandez) #2

batsman@tux-chan:/tmp$ cat ggl.rb
require 'soap/wsdlDriver'

g = SOAP::WSDLDriverFactory.new('http://api.google.com/GoogleSearch.wsdl').create_rpc_driver
g.generate_explicit_type = true

google_key = File.read(File.join(ENV["HOME"], ".google_key"))

r = g.doGoogleSearch(google_key, "ruby", 0, 5, false, "", false, "", "", "" )

puts "About #{r.estimatedTotalResultsCount} results"
puts
r.resultElements.each do |e|
  puts "#{e.title}: #{e['URL']}"
  puts "#{e.snippet}"
  puts
end
batsman@tux-chan:/tmp$ RUBYOPT= ruby ggl.rb
About 2570000 results

<b>Ruby</b> Home Page: http://www.ruby-lang.org/
The Object-Oriented Programming Language <b>Ruby</b> <b>Ruby</b>: Programmers&#39; Best Friend <b>...</b><br> security@<b>ruby</b>-lang.org is a private ML, and anyone can post to it without <b>...</b>

<b>Ruby</b> Central: http://www.rubycentral.com/
<b>Ruby</b> resource: One-click Windows installer; online copy of Programming <b>Ruby</b>: The<br> Pragmatic Programmer&#39;s Guide. [Open Publication License]

Programming <b>Ruby</b>: The Pragmatic Programmer&#39;s Guide: http://www.rubycentral.com/book/
Full online HTML text at <b>Ruby</b> Central, with download link. [Open Content, Open<br> Publication License]

<b>Ruby</b> on Rails: http://www.rubyonrails.org/
Rails is a full-stack, open-source web framework in <b>Ruby</b> for writing real-world<br> applications with joy and less code than most frameworks spend doing XML <b>...</b>

Dining Out at <b>Ruby</b> Tuesday Restaurant: http://www.rubytuesday.com/
Awesome Food. Serious Salad Bar. Dining out at <b>Ruby</b> Tuesday features popular<br> choices and a wide variety sure toappeal to anyone&#39;s appetite.

···

On Wed, Aug 24, 2005 at 09:52:32PM +0900, Dalibor Sramek wrote:

Does anybody use SOAP4R to access Google search service?

I do not want to dive too deep into SOAP peculiarities. So I just tried to
make Pickaxe examples to work. I am getting:
: No Deserializer found to deserialize a ':restrict' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'. (SOAP::FaultError)

I installed the newest SOAP4R version but Google samples included in the
distribution crashed on various errors too.

--
Mauricio Fernandez

(Dalibor Sramek) #3

Thanks. Your code works although only with the version 1.5.4. The 1.5.3
packaged to Ruby 1.8.2 fails.

Dalibor Sramek

···

On Thu, Aug 25, 2005 at 01:08:00AM +0900, Mauricio Fernández wrote:

batsman@tux-chan:/tmp$ cat ggl.rb

--
Dalibor Sramek http://www.insula.cz/dali \ In the eyes of cats
/ dalibor.sramek@insula.cz \ all things
/ >H blog http://www.transhumanismus.cz/blog.php \ belong to cats.