From 991d0c409cc6b1d916330a32a9624aef808176a4 Mon Sep 17 00:00:00 2001 From: nahi Date: Sun, 22 May 2005 13:20:28 +0000 Subject: * lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.4. == SOAP client and server == === for both client side and server side === * improved document/literal service support. style(rpc,document)/use(encoding, literal) combination are all supported. for the detail about combination, see test/soap/test_style.rb. * let WSDLEncodedRegistry#soap2obj map SOAP/OM to Ruby according to WSDL as well as obj2soap. closes #70. * let SOAP::Mapping::Object handle XML attribute for doc/lit service. you can set/get XML attribute via accessor methods which as a name 'xmlattr_' prefixed ( -> Foo#xmlattr_name). === client side === * WSDLDriver capitalized name operation bug fixed. from 1.5.3-ruby1.8.2, operation which has capitalized name (such as KeywordSearchRequest in AWS) is defined as a method having uncapitalized name. (converted with GenSupport.safemethodname to handle operation name 'foo-bar'). it introduced serious incompatibility; in the past, it was defined as a capitalized. define capitalized method as well under that circumstance. * added new factory interface 'WSDLDriverFactory#create_rpc_driver' to create RPC::Driver, not WSDLDriver (RPC::Driver and WSDLDriver are merged). 'WSDLDriverFactory#create_driver' still creates WSDLDriver for compatibility but it warns that the method is deprecated. please use create_rpc_driver instead of create_driver. * allow to use an URI object as an endpoint_url even with net/http, not http-access2. === server side === * added mod_ruby support to SOAP::CGIStub. rename a CGI script server.cgi to server.rb and let mod_ruby's RubyHandler handles the script. CGIStub detects if it's running under mod_ruby environment or not. * added fcgi support to SOAP::CGIStub. see the sample at sample/soap/calc/server.fcgi. (almost same as server.cgi but has fcgi handler at the bottom.) * allow to return a SOAPFault object to respond customized SOAP fault. * added the interface 'generate_explicit_type' for server side (CGIStub, HTTPServer). call 'self.generate_explicit_type = true' if you want to return simplified XML even if it's rpc/encoded service. == WSDL == === WSDL definition === * improved XML Schema support such as extension, restriction, simpleType, complexType + simpleContent, ref, length, import, include. * reduced "unknown element/attribute" warnings (warn only 1 time for each QName). * importing XSD file at schemaLocation with xsd:import. === code generation from WSDL === * generator crashed when there's '-' in defined element/attribute name. * added ApacheMap WSDL definition. * sample/{soap,wsdl}: removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/wsdl/googleSearch/GoogleSearch.rb | 258 ------------------------- sample/wsdl/googleSearch/GoogleSearchDriver.rb | 101 ---------- sample/wsdl/googleSearch/README | 6 - sample/wsdl/googleSearch/httpd.rb | 20 -- sample/wsdl/googleSearch/sampleClient.rb | 56 ------ sample/wsdl/googleSearch/samplehttpd.conf | 2 - sample/wsdl/googleSearch/sjissearch.sh | 3 - sample/wsdl/googleSearch/wsdlDriver.rb | 23 --- 8 files changed, 469 deletions(-) delete mode 100644 sample/wsdl/googleSearch/GoogleSearch.rb delete mode 100644 sample/wsdl/googleSearch/GoogleSearchDriver.rb delete mode 100644 sample/wsdl/googleSearch/README delete mode 100644 sample/wsdl/googleSearch/httpd.rb delete mode 100644 sample/wsdl/googleSearch/sampleClient.rb delete mode 100644 sample/wsdl/googleSearch/samplehttpd.conf delete mode 100644 sample/wsdl/googleSearch/sjissearch.sh delete mode 100644 sample/wsdl/googleSearch/wsdlDriver.rb (limited to 'sample/wsdl/googleSearch') 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((.*?)), '((*\\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 -- cgit v1.2.3