From: Ian Macdonald Date: 2002-04-06T09:22:25+09:00 Subject: how to make SOAP4R read WSDL files? Hi, Here at Google, we're about to start offering an API to our search-engine, so that people can programmatically use Google through a clean and clearly defined interface, rather than have to resort to parsing HTML. As a test, this seemed like a great opportunity to try out SOAP4R. I'm not knowledgeable about SOAP at all (I've read a couple of O'Reillynet articles about it), so I'm probably making mistakes in my basic assumptions. The SOAP4R documentation is also pretty scant. Anyway, the following short program works: #!/usr/bin/ruby require 'soap/driver' endpoint = 'http://api-ab.google.com/search/beta2' ns = 'urn:GoogleSearch' key = 'xxxxxxxxxxxxxxx' service = 'file:GoogleSearch.wsdl' query = ARGV.shift || 'foo' soap = SOAP::Driver.new(nil, nil, ns, endpoint) # uncomment the next line to dump the traffic on the wire # #soap.setWireDumpDev(STDERR) soap.addMethodWithSOAPAction('doGoogleSearch', ns, 'key', 'q', 'start', 'maxResults', 'filter', 'restrict', 'safeSearch', 'lr', 'ie', 'oe') r = soap.doGoogleSearch(key, query, 0, 10, false, nil, false, nil, 'latin1', 'latin1') printf "Estimated number of results is %d.\n", r.estimatedTotalResultsCount printf "Your query took %6f seconds.\n", r.searchTime -- However, rather than have to spell all of this out in the program, I would rather just have SOAP4R read Google's WSDL file. Unfortunately, nothing I've tried so far will make this work. It's not even clear to me that this is implemented. So, does anyone know how I can reduce much of the detail in the code by simply having SOAP4R pull it out of a WSDL file? Ian -- Ian Macdonald | But since I knew now that I could hope for System Administrator | nothing of greater value than frivolous Google, Inc. | pleasures, what point was there in denying ian@google.com | myself of them? -- M. Proust 650.330.0100 x1265 |