[devel] Fw: how to make SOAP4R read WSDL files?

Alexander Bokovoy =?iso-8859-1?q?a=2Ebokovoy_=CE=C1_sam-solutions=2Enet?=
Пн Апр 8 14:44:44 MSD 2002


О сколько нам открытий чудных готовит Google...

----- Forwarded message from Ian Macdonald <ian на google.com> -----

Date: Sat, 6 Apr 2002 09:22:25 +0900
From: Ian Macdonald <ian на google.com>
To: ruby-talk на ruby-lang.org (ruby-talk ML)
Subject: how to make SOAP4R read WSDL files?
Posted: Fri, 5 Apr 2002 16:22:16 -0800
Organization: Google, Inc.

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          | 

----- End forwarded message -----

-- 
/ Alexander Bokovoy
Software architect and analyst             // SaM-Solutions Ltd.
---
This fortune is encrypted -- get your decoder rings ready!




Подробная информация о списке рассылки Devel