summaryrefslogtreecommitdiff
path: root/sample/wsdl/googleSearch/GoogleSearchDriver.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-24 15:18:44 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-24 15:18:44 +0000
commitdb9445103c082a306ba085f7677da02ea94b8841 (patch)
treea311d59f031ae5def87f68be71ed1f58abadc031 /sample/wsdl/googleSearch/GoogleSearchDriver.rb
parent8c2fb77787d1f20b4c19c9c52552856c339b86e9 (diff)
* lib/soap/* (29 files): SOAP4R added.
* lib/wsdl/* (42 files): WSDL4R added. * lib/xsd/* (12 files): XSD4R added. * test/soap/* (16 files): added. * test/wsdl/* (2 files): added. * test/xsd/* (3 files): added. * sample/soap/* (27 files): added. * sample/wsdl/* (13 files): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/wsdl/googleSearch/GoogleSearchDriver.rb')
-rw-r--r--sample/wsdl/googleSearch/GoogleSearchDriver.rb101
1 files changed, 101 insertions, 0 deletions
diff --git a/sample/wsdl/googleSearch/GoogleSearchDriver.rb b/sample/wsdl/googleSearch/GoogleSearchDriver.rb
new file mode 100644
index 0000000000..9901b89071
--- /dev/null
+++ b/sample/wsdl/googleSearch/GoogleSearchDriver.rb
@@ -0,0 +1,101 @@
+require 'GoogleSearch.rb'
+
+require 'soap/rpc/driver'
+
+class GoogleSearchPort < SOAP::RPC::Driver
+ MappingRegistry = ::SOAP::Mapping::Registry.new
+
+ MappingRegistry.set(
+ GoogleSearchResult,
+ ::SOAP::SOAPStruct,
+ ::SOAP::Mapping::Registry::TypedStructFactory,
+ { :type => XSD::QName.new("urn:GoogleSearch", "GoogleSearchResult") }
+ )
+ MappingRegistry.set(
+ ResultElementArray,
+ ::SOAP::SOAPArray,
+ ::SOAP::Mapping::Registry::TypedArrayFactory,
+ { :type => XSD::QName.new("urn:GoogleSearch", "ResultElement") }
+ )
+ MappingRegistry.set(
+ DirectoryCategoryArray,
+ ::SOAP::SOAPArray,
+ ::SOAP::Mapping::Registry::TypedArrayFactory,
+ { :type => XSD::QName.new("urn:GoogleSearch", "DirectoryCategory") }
+ )
+ MappingRegistry.set(
+ ResultElement,
+ ::SOAP::SOAPStruct,
+ ::SOAP::Mapping::Registry::TypedStructFactory,
+ { :type => XSD::QName.new("urn:GoogleSearch", "ResultElement") }
+ )
+ MappingRegistry.set(
+ DirectoryCategory,
+ ::SOAP::SOAPStruct,
+ ::SOAP::Mapping::Registry::TypedStructFactory,
+ { :type => XSD::QName.new("urn:GoogleSearch", "DirectoryCategory") }
+ )
+
+ Methods = [
+ ["doGetCachedPage", "doGetCachedPage", [
+ ["in", "key",
+ [SOAP::SOAPString]],
+ ["in", "url",
+ [SOAP::SOAPString]],
+ ["retval", "return",
+ [SOAP::SOAPBase64]]],
+ "urn:GoogleSearchAction", "urn:GoogleSearch"],
+ ["doSpellingSuggestion", "doSpellingSuggestion", [
+ ["in", "key",
+ [SOAP::SOAPString]],
+ ["in", "phrase",
+ [SOAP::SOAPString]],
+ ["retval", "return",
+ [SOAP::SOAPString]]],
+ "urn:GoogleSearchAction", "urn:GoogleSearch"],
+ ["doGoogleSearch", "doGoogleSearch", [
+ ["in", "key",
+ [SOAP::SOAPString]],
+ ["in", "q",
+ [SOAP::SOAPString]],
+ ["in", "start",
+ [SOAP::SOAPInt]],
+ ["in", "maxResults",
+ [SOAP::SOAPInt]],
+ ["in", "filter",
+ [SOAP::SOAPBoolean]],
+ ["in", "restrict",
+ [SOAP::SOAPString]],
+ ["in", "safeSearch",
+ [SOAP::SOAPBoolean]],
+ ["in", "lr",
+ [SOAP::SOAPString]],
+ ["in", "ie",
+ [SOAP::SOAPString]],
+ ["in", "oe",
+ [SOAP::SOAPString]],
+ ["retval", "return",
+ [::SOAP::SOAPStruct, "urn:GoogleSearch", "GoogleSearchResult"]]],
+ "urn:GoogleSearchAction", "urn:GoogleSearch"]
+ ]
+
+ DefaultEndpointUrl = "http://api.google.com/search/beta2"
+
+ def initialize(endpoint_url = nil)
+ endpoint_url ||= DefaultEndpointUrl
+ super(endpoint_url, nil)
+ self.mapping_registry = MappingRegistry
+ init_methods
+ end
+
+private
+
+ def init_methods
+ Methods.each do |name_as, name, params, soapaction, namespace|
+ qname = XSD::QName.new(namespace, name_as)
+ @proxy.add_method(qname, soapaction, name, params)
+ add_rpc_method_interface(name, params)
+ end
+ end
+end
+