diff options
Diffstat (limited to 'sample/wsdl/googleSearch')
-rw-r--r-- | sample/wsdl/googleSearch/GoogleSearch.rb | 258 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/GoogleSearchDriver.rb | 101 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/README | 6 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/httpd.rb | 20 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/sampleClient.rb | 56 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/samplehttpd.conf | 2 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/sjissearch.sh | 3 | ||||
-rw-r--r-- | sample/wsdl/googleSearch/wsdlDriver.rb | 23 |
8 files changed, 0 insertions, 469 deletions
diff --git a/sample/wsdl/googleSearch/GoogleSearch.rb b/sample/wsdl/googleSearch/GoogleSearch.rb deleted file mode 100644 index e124208b91..0000000000 --- a/sample/wsdl/googleSearch/GoogleSearch.rb +++ /dev/null @@ -1,258 +0,0 @@ -# urn:GoogleSearch -class GoogleSearchResult - @@schema_type = "GoogleSearchResult" - @@schema_ns = "urn:GoogleSearch" - - def documentFiltering - @documentFiltering - end - - def documentFiltering=(value) - @documentFiltering = value - end - - def searchComments - @searchComments - end - - def searchComments=(value) - @searchComments = value - end - - def estimatedTotalResultsCount - @estimatedTotalResultsCount - end - - def estimatedTotalResultsCount=(value) - @estimatedTotalResultsCount = value - end - - def estimateIsExact - @estimateIsExact - end - - def estimateIsExact=(value) - @estimateIsExact = value - end - - def resultElements - @resultElements - end - - def resultElements=(value) - @resultElements = value - end - - def searchQuery - @searchQuery - end - - def searchQuery=(value) - @searchQuery = value - end - - def startIndex - @startIndex - end - - def startIndex=(value) - @startIndex = value - end - - def endIndex - @endIndex - end - - def endIndex=(value) - @endIndex = value - end - - def searchTips - @searchTips - end - - def searchTips=(value) - @searchTips = value - end - - def directoryCategories - @directoryCategories - end - - def directoryCategories=(value) - @directoryCategories = value - end - - def searchTime - @searchTime - end - - def searchTime=(value) - @searchTime = value - end - - def initialize(documentFiltering = nil, - searchComments = nil, - estimatedTotalResultsCount = nil, - estimateIsExact = nil, - resultElements = nil, - searchQuery = nil, - startIndex = nil, - endIndex = nil, - searchTips = nil, - directoryCategories = nil, - searchTime = nil) - @documentFiltering = documentFiltering - @searchComments = searchComments - @estimatedTotalResultsCount = estimatedTotalResultsCount - @estimateIsExact = estimateIsExact - @resultElements = resultElements - @searchQuery = searchQuery - @startIndex = startIndex - @endIndex = endIndex - @searchTips = searchTips - @directoryCategories = directoryCategories - @searchTime = searchTime - end -end - -# urn:GoogleSearch -class ResultElement - @@schema_type = "ResultElement" - @@schema_ns = "urn:GoogleSearch" - - def summary - @summary - end - - def summary=(value) - @summary = value - end - - def URL - @uRL - end - - def URL=(value) - @uRL = value - end - - def snippet - @snippet - end - - def snippet=(value) - @snippet = value - end - - def title - @title - end - - def title=(value) - @title = value - end - - def cachedSize - @cachedSize - end - - def cachedSize=(value) - @cachedSize = value - end - - def relatedInformationPresent - @relatedInformationPresent - end - - def relatedInformationPresent=(value) - @relatedInformationPresent = value - end - - def hostName - @hostName - end - - def hostName=(value) - @hostName = value - end - - def directoryCategory - @directoryCategory - end - - def directoryCategory=(value) - @directoryCategory = value - end - - def directoryTitle - @directoryTitle - end - - def directoryTitle=(value) - @directoryTitle = value - end - - def initialize(summary = nil, - uRL = nil, - snippet = nil, - title = nil, - cachedSize = nil, - relatedInformationPresent = nil, - hostName = nil, - directoryCategory = nil, - directoryTitle = nil) - @summary = summary - @uRL = uRL - @snippet = snippet - @title = title - @cachedSize = cachedSize - @relatedInformationPresent = relatedInformationPresent - @hostName = hostName - @directoryCategory = directoryCategory - @directoryTitle = directoryTitle - end -end - -# urn:GoogleSearch -class ResultElementArray < Array - # Contents type should be dumped here... - @@schema_type = "ResultElementArray" - @@schema_ns = "urn:GoogleSearch" -end - -# urn:GoogleSearch -class DirectoryCategoryArray < Array - # Contents type should be dumped here... - @@schema_type = "DirectoryCategoryArray" - @@schema_ns = "urn:GoogleSearch" -end - -# urn:GoogleSearch -class DirectoryCategory - @@schema_type = "DirectoryCategory" - @@schema_ns = "urn:GoogleSearch" - - def fullViewableName - @fullViewableName - end - - def fullViewableName=(value) - @fullViewableName = value - end - - def specialEncoding - @specialEncoding - end - - def specialEncoding=(value) - @specialEncoding = value - end - - def initialize(fullViewableName = nil, - specialEncoding = nil) - @fullViewableName = fullViewableName - @specialEncoding = specialEncoding - end -end - diff --git a/sample/wsdl/googleSearch/GoogleSearchDriver.rb b/sample/wsdl/googleSearch/GoogleSearchDriver.rb deleted file mode 100644 index 9901b89071..0000000000 --- a/sample/wsdl/googleSearch/GoogleSearchDriver.rb +++ /dev/null @@ -1,101 +0,0 @@ -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 - diff --git a/sample/wsdl/googleSearch/README b/sample/wsdl/googleSearch/README deleted file mode 100644 index 461a5634dc..0000000000 --- a/sample/wsdl/googleSearch/README +++ /dev/null @@ -1,6 +0,0 @@ -wsdlDriver.rb: Do google search using WSDL. - -Whole files except wsdl.rb in this directory is created by wsdl2ruby.rb from -GoogleSearch.wsdl with options; - -% wsdl2ruby.rb --wsdl http://api.google.com/GoogleSearch.wsdl --classdef --client_skelton --servant_skelton --cgi_stub --standalone_server_stub --driver --force diff --git a/sample/wsdl/googleSearch/httpd.rb b/sample/wsdl/googleSearch/httpd.rb deleted file mode 100644 index bebcff96c6..0000000000 --- a/sample/wsdl/googleSearch/httpd.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby - -require 'webrick' -require 'soap/property' - -docroot = "." -port = 8808 -if opt = SOAP::Property.loadproperty("samplehttpd.conf") - docroot = opt["docroot"] - port = Integer(opt["port"]) -end - -s = WEBrick::HTTPServer.new( - :BindAddress => "0.0.0.0", - :Port => port, - :DocumentRoot => docroot, - :CGIPathEnv => ENV['PATH'] -) -trap(:INT){ s.shutdown } -s.start diff --git a/sample/wsdl/googleSearch/sampleClient.rb b/sample/wsdl/googleSearch/sampleClient.rb deleted file mode 100644 index b05d57be54..0000000000 --- a/sample/wsdl/googleSearch/sampleClient.rb +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env ruby - -# This file is a sample based on GoogleSearchClient.rb, which can be -# generated by WSDL file and wsdl2ruby.rb. -# -# $ wsdl2ruby.rb --type client --force \ -# --wsdl http://api.google.com/GoogleSearch.wsdl -# -# See wsdlDriver.rb to use WSDL file directly (slow). -require 'GoogleSearchDriver.rb' - -endpoint_url = ARGV.shift -obj = GoogleSearchPort.new(endpoint_url) - -# Uncomment the below line to see SOAP wiredumps. -# obj.wiredump_dev = STDERR - -# SYNOPSIS -# doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe) -# -# ARGS -# key - {http://www.w3.org/2001/XMLSchema}string -# q - {http://www.w3.org/2001/XMLSchema}string -# start - {http://www.w3.org/2001/XMLSchema}int -# maxResults - {http://www.w3.org/2001/XMLSchema}int -# filter - {http://www.w3.org/2001/XMLSchema}boolean -# restrict - {http://www.w3.org/2001/XMLSchema}string -# safeSearch - {http://www.w3.org/2001/XMLSchema}boolean -# lr - {http://www.w3.org/2001/XMLSchema}string -# ie - {http://www.w3.org/2001/XMLSchema}string -# oe - {http://www.w3.org/2001/XMLSchema}string -# -# RETURNS -# return GoogleSearchResult - {urn:GoogleSearch}GoogleSearchResult -# -# RAISES -# N/A -# -key = q = start = maxResults = filter = restrict = safeSearch = lr = ie = oe = nil -key = File.open(File.expand_path("~/.google_key")) { |f| f.read }.chomp -q = "Ruby" -start = 0 -maxResults = 10 -filter = false -restrict = "" -safeSearch = false -lr = "" -ie = "utf-8" -oe = "utf-8" -result = obj.doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe) - -result.resultElements.each do |ele| - puts "== #{ele.title}: #{ele.URL}" - puts ele.snippet - puts -end diff --git a/sample/wsdl/googleSearch/samplehttpd.conf b/sample/wsdl/googleSearch/samplehttpd.conf deleted file mode 100644 index 85e9995021..0000000000 --- a/sample/wsdl/googleSearch/samplehttpd.conf +++ /dev/null @@ -1,2 +0,0 @@ -docroot = . -port = 8808 diff --git a/sample/wsdl/googleSearch/sjissearch.sh b/sample/wsdl/googleSearch/sjissearch.sh deleted file mode 100644 index b8efb20647..0000000000 --- a/sample/wsdl/googleSearch/sjissearch.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - - -ruby -Ks wsdlDriver.rb 'Ruby ‚È‚Ð' diff --git a/sample/wsdl/googleSearch/wsdlDriver.rb b/sample/wsdl/googleSearch/wsdlDriver.rb deleted file mode 100644 index 9059aed2df..0000000000 --- a/sample/wsdl/googleSearch/wsdlDriver.rb +++ /dev/null @@ -1,23 +0,0 @@ -#require 'uconv' -require 'soap/wsdlDriver' - -word = ARGV.shift -# You must get key from http://www.google.com/apis/ to use Google Web APIs. -key = File.open(File.expand_path("~/.google_key")) { |f| f.read }.chomp - -GOOGLE_WSDL = 'http://api.google.com/GoogleSearch.wsdl' -# GOOGLE_WSDL = 'GoogleSearch.wsdl' - -def html2rd(str) - str.gsub(%r(<b>(.*?)</b>), '((*\\1*))').strip -end - - -google = SOAP::WSDLDriverFactory.new(GOOGLE_WSDL).create_driver -#google.wiredump_dev = STDERR -result = google.doGoogleSearch( key, word, 0, 10, false, "", false, "", 'utf-8', 'utf-8' ) -result.resultElements.each do |ele| - puts "== #{html2rd(ele.title)}: #{ele.URL}" - puts html2rd(ele.snippet) - puts -end |