summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-22 13:20:28 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-22 13:20:28 +0000
commit991d0c409cc6b1d916330a32a9624aef808176a4 (patch)
tree5e2cc150dc84ab3f6f64685ec7f54e6b2077eae7
parent15b7d439885f4aa97e0f508ef485cadab4b23577 (diff)
* 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 name="bar"/> -> 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
-rw-r--r--ChangeLog81
-rw-r--r--lib/soap/baseData.rb128
-rw-r--r--lib/soap/element.rb17
-rw-r--r--lib/soap/encodingstyle/aspDotNetHandler.rb13
-rw-r--r--lib/soap/encodingstyle/literalHandler.rb35
-rw-r--r--lib/soap/encodingstyle/soapHandler.rb26
-rw-r--r--lib/soap/generator.rb7
-rw-r--r--lib/soap/header/handlerset.rb12
-rw-r--r--lib/soap/header/simplehandler.rb4
-rw-r--r--lib/soap/mapping/factory.rb52
-rw-r--r--lib/soap/mapping/mapping.rb152
-rw-r--r--lib/soap/mapping/registry.rb158
-rw-r--r--lib/soap/mapping/rubytypeFactory.rb41
-rw-r--r--lib/soap/mapping/wsdlencodedregistry.rb182
-rw-r--r--lib/soap/mapping/wsdlliteralregistry.rb337
-rw-r--r--lib/soap/marshal.rb5
-rw-r--r--lib/soap/netHttpClient.rb23
-rw-r--r--lib/soap/rpc/cgistub.rb234
-rw-r--r--lib/soap/rpc/driver.rb347
-rw-r--r--lib/soap/rpc/element.rb101
-rw-r--r--lib/soap/rpc/httpserver.rb99
-rw-r--r--lib/soap/rpc/proxy.rb286
-rw-r--r--lib/soap/rpc/router.rb526
-rw-r--r--lib/soap/rpc/soaplet.rb219
-rw-r--r--lib/soap/soap.rb26
-rw-r--r--lib/soap/streamHandler.rb119
-rw-r--r--lib/soap/wsdlDriver.rb248
-rw-r--r--lib/wsdl/definitions.rb26
-rw-r--r--lib/wsdl/import.rb26
-rw-r--r--lib/wsdl/importer.rb58
-rw-r--r--lib/wsdl/info.rb10
-rw-r--r--lib/wsdl/operation.rb14
-rw-r--r--lib/wsdl/operationBinding.rb30
-rw-r--r--lib/wsdl/param.rb5
-rw-r--r--lib/wsdl/parser.rb35
-rw-r--r--lib/wsdl/port.rb2
-rw-r--r--lib/wsdl/portType.rb3
-rw-r--r--lib/wsdl/soap/cgiStubCreator.rb18
-rw-r--r--lib/wsdl/soap/classDefCreator.rb226
-rw-r--r--lib/wsdl/soap/classDefCreatorSupport.rb6
-rw-r--r--lib/wsdl/soap/complexType.rb37
-rw-r--r--lib/wsdl/soap/definitions.rb39
-rw-r--r--lib/wsdl/soap/driverCreator.rb22
-rw-r--r--lib/wsdl/soap/element.rb6
-rw-r--r--lib/wsdl/soap/fault.rb4
-rw-r--r--lib/wsdl/soap/header.rb13
-rw-r--r--lib/wsdl/soap/mappingRegistryCreator.rb16
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb116
-rw-r--r--lib/wsdl/soap/operation.rb6
-rw-r--r--lib/wsdl/soap/servantSkeltonCreator.rb8
-rw-r--r--lib/wsdl/soap/standaloneServerStubCreator.rb20
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb60
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb5
-rw-r--r--lib/wsdl/xmlSchema/data.rb11
-rw-r--r--lib/wsdl/xmlSchema/element.rb72
-rw-r--r--lib/wsdl/xmlSchema/import.rb25
-rw-r--r--lib/wsdl/xmlSchema/parser.rb39
-rw-r--r--lib/wsdl/xmlSchema/schema.rb36
-rw-r--r--lib/wsdl/xmlSchema/simpleContent.rb56
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb29
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb12
-rw-r--r--lib/xsd/charset.rb2
-rw-r--r--lib/xsd/codegen/classdef.rb2
-rw-r--r--lib/xsd/codegen/commentdef.rb4
-rw-r--r--lib/xsd/codegen/gensupport.rb67
-rw-r--r--lib/xsd/codegen/methoddef.rb2
-rw-r--r--lib/xsd/codegen/moduledef.rb2
-rw-r--r--lib/xsd/datatypes.rb33
-rw-r--r--lib/xsd/iconvcharset.rb2
-rw-r--r--lib/xsd/namedelements.rb14
-rw-r--r--lib/xsd/ns.rb18
-rw-r--r--lib/xsd/qname.rb6
-rw-r--r--lib/xsd/xmlparser.rb2
-rw-r--r--lib/xsd/xmlparser/xmlscanner.rb6
-rw-r--r--sample/soap/authheader/authmgr.rb41
-rw-r--r--sample/soap/authheader/client.rb40
-rw-r--r--sample/soap/authheader/client2.rb42
-rw-r--r--sample/soap/authheader/server.rb73
-rw-r--r--sample/soap/authheader/server2.rb83
-rw-r--r--sample/soap/babelfish.rb16
-rw-r--r--sample/soap/calc/calc.rb17
-rw-r--r--sample/soap/calc/calc2.rb29
-rw-r--r--sample/soap/calc/client.rb26
-rw-r--r--sample/soap/calc/client2.rb29
-rw-r--r--sample/soap/calc/httpd.rb20
-rw-r--r--sample/soap/calc/samplehttpd.conf2
-rw-r--r--sample/soap/calc/server.cgi15
-rw-r--r--sample/soap/calc/server.rb21
-rw-r--r--sample/soap/calc/server2.rb24
-rw-r--r--sample/soap/digraph.rb43
-rw-r--r--sample/soap/exchange/client.rb19
-rw-r--r--sample/soap/exchange/exchange.rb17
-rw-r--r--sample/soap/exchange/httpd.rb20
-rw-r--r--sample/soap/exchange/samplehttpd.conf2
-rw-r--r--sample/soap/exchange/server.cgi14
-rw-r--r--sample/soap/exchange/server.rb16
-rw-r--r--sample/soap/helloworld/hw_c.rb6
-rw-r--r--sample/soap/helloworld/hw_c_gzip.rb8
-rw-r--r--sample/soap/helloworld/hw_s.rb20
-rw-r--r--sample/soap/helloworld/hw_s_gzip.rb21
-rw-r--r--sample/soap/icd/IICD.rb17
-rw-r--r--sample/soap/icd/icd.rb46
-rw-r--r--sample/soap/raa/iRAA.rb154
-rw-r--r--sample/soap/raa/soap4r.rb30
-rw-r--r--sample/soap/raa2.4/raa.rb332
-rw-r--r--sample/soap/raa2.4/raaDriver.rb255
-rw-r--r--sample/soap/raa2.4/raaServiceClient.rb354
-rw-r--r--sample/soap/raa2.4/sample.rb115
-rw-r--r--sample/soap/sampleStruct/client.rb16
-rw-r--r--sample/soap/sampleStruct/httpd.rb20
-rw-r--r--sample/soap/sampleStruct/iSampleStruct.rb22
-rw-r--r--sample/soap/sampleStruct/sampleStruct.rb13
-rw-r--r--sample/soap/sampleStruct/samplehttpd.conf2
-rw-r--r--sample/soap/sampleStruct/server.cgi14
-rw-r--r--sample/soap/sampleStruct/server.rb20
-rw-r--r--sample/soap/scopesample/client.rb34
-rw-r--r--sample/soap/scopesample/httpd.rb22
-rw-r--r--sample/soap/scopesample/samplehttpd.conf2
-rw-r--r--sample/soap/scopesample/servant.rb18
-rwxr-xr-xsample/soap/scopesample/server.cgi29
-rw-r--r--sample/soap/scopesample/server.rb20
-rw-r--r--sample/soap/ssl/files/README1
-rw-r--r--sample/soap/ssl/files/ca.cert23
-rw-r--r--sample/soap/ssl/files/client.cert19
-rw-r--r--sample/soap/ssl/files/client.key15
-rw-r--r--sample/soap/ssl/files/server.cert19
-rw-r--r--sample/soap/ssl/files/server.key15
-rw-r--r--sample/soap/ssl/files/sslclient.properties5
-rw-r--r--sample/soap/ssl/files/sslclient_require_noserverauth.properties2
-rw-r--r--sample/soap/ssl/files/sslclient_with_clientauth.properties9
-rw-r--r--sample/soap/ssl/files/subca.cert21
-rw-r--r--sample/soap/ssl/sslclient.rb12
-rw-r--r--sample/soap/ssl/sslclient_require_noserverauth.rb12
-rw-r--r--sample/soap/ssl/sslclient_with_clientauth.rb12
-rw-r--r--sample/soap/ssl/sslserver.rb49
-rw-r--r--sample/soap/ssl/sslserver_noauth.rb45
-rw-r--r--sample/soap/ssl/sslserver_require_clientauth.rb50
-rw-r--r--sample/soap/swa/client.rb13
-rw-r--r--sample/soap/swa/server.rb23
-rw-r--r--sample/soap/whois.rb14
-rw-r--r--sample/wsdl/amazon/AmazonSearch.rb3057
-rw-r--r--sample/wsdl/amazon/AmazonSearchDriver.rb536
-rw-r--r--sample/wsdl/amazon/sampleClient.rb37
-rw-r--r--sample/wsdl/amazon/wsdlDriver.rb52
-rw-r--r--sample/wsdl/googleSearch/GoogleSearch.rb258
-rw-r--r--sample/wsdl/googleSearch/GoogleSearchDriver.rb101
-rw-r--r--sample/wsdl/googleSearch/README6
-rw-r--r--sample/wsdl/googleSearch/httpd.rb20
-rw-r--r--sample/wsdl/googleSearch/sampleClient.rb56
-rw-r--r--sample/wsdl/googleSearch/samplehttpd.conf2
-rw-r--r--sample/wsdl/googleSearch/sjissearch.sh3
-rw-r--r--sample/wsdl/googleSearch/wsdlDriver.rb23
-rw-r--r--sample/wsdl/raa/raa.wsdl264
-rw-r--r--sample/wsdl/raa/soap4r.rb31
-rw-r--r--sample/wsdl/raa2.4/raa.rb332
-rw-r--r--sample/wsdl/raa2.4/wsdlDriver.rb117
-rw-r--r--test/soap/calc/test_calc.rb7
-rw-r--r--test/soap/calc/test_calc2.rb7
-rw-r--r--test/soap/calc/test_calc_cgi.rb7
-rw-r--r--test/soap/header/server.cgi8
-rw-r--r--test/soap/header/test_authheader.rb9
-rw-r--r--test/soap/header/test_authheader_cgi.rb7
-rw-r--r--test/soap/helloworld/test_helloworld.rb7
-rw-r--r--test/soap/ssl/sslsvr.rb7
-rw-r--r--test/soap/ssl/test_ssl.rb29
-rw-r--r--test/soap/struct/test_struct.rb8
-rw-r--r--test/soap/swa/test_file.rb7
-rw-r--r--test/soap/test_basetype.rb6
-rw-r--r--test/soap/test_streamhandler.rb20
-rw-r--r--test/soap/wsdlDriver/simpletype.wsdl6
-rw-r--r--test/soap/wsdlDriver/test_calc.rb3
-rw-r--r--test/soap/wsdlDriver/test_simpletype.rb15
-rw-r--r--test/wsdl/datetime/DatetimeService.rb42
-rw-r--r--test/wsdl/datetime/test_datetime.rb10
-rw-r--r--test/wsdl/map/test_map.rb11
-rw-r--r--test/wsdl/raa/RAAService.rb3
-rw-r--r--test/wsdl/raa/test_raa.rb9
-rw-r--r--test/wsdl/simpletype/simpletype.wsdl38
-rw-r--r--test/wsdl/simpletype/test_simpletype.rb42
-rw-r--r--test/wsdl/soap/test_soapbodyparts.rb27
-rw-r--r--test/xsd/test_xsd.rb6
181 files changed, 3163 insertions, 9360 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f5cc031a5..8b1c3c1f78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,83 @@
-XSun May 22 19:11:35 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
+Sun May 22 21:54:06 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * 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 name="bar"/> -> 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.
+
+Sun May 22 19:11:35 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#intialize):
should initialize session id context. [ruby-core:4663]
diff --git a/lib/soap/baseData.rb b/lib/soap/baseData.rb
index bf2fe6b25c..6d0f628be9 100644
--- a/lib/soap/baseData.rb
+++ b/lib/soap/baseData.rb
@@ -1,5 +1,5 @@
# soap/baseData.rb: SOAP4R - Base type library
-# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -56,6 +56,14 @@ module SOAPType
@extraattr = {}
end
+ def inspect
+ if self.is_a?(XSD::NSDBase)
+ sprintf("#<%s:0x%x %s %s>", self.class.name, __id__, self.elename, self.type)
+ else
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
+ end
+ end
+
def rootnode
node = self
while node = node.parent
@@ -399,7 +407,7 @@ public
def to_s()
str = ''
self.each do |key, data|
- str << "#{ key }: #{ data }\n"
+ str << "#{key}: #{data}\n"
end
str
end
@@ -442,6 +450,25 @@ public
@array
end
+ def to_obj
+ hash = {}
+ proptype = {}
+ each do |k, v|
+ value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
+ case proptype[k]
+ when :single
+ hash[k] = [hash[k], value]
+ proptype[k] = :multi
+ when :multi
+ hash[k] << value
+ else
+ hash[k] = value
+ proptype[k] = :single
+ end
+ end
+ hash
+ end
+
def each
for i in 0..(@array.length - 1)
yield(@array[i], @data[i])
@@ -509,6 +536,10 @@ class SOAPElement
@text = text
end
+ def inspect
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
+ end
+
# Text interface.
attr_accessor :text
alias data text
@@ -548,8 +579,19 @@ class SOAPElement
@text
else
hash = {}
+ proptype = {}
each do |k, v|
- hash[k] = v.is_a?(SOAPElement) ? v.to_obj : v.to_s
+ value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
+ case proptype[k]
+ when :single
+ hash[k] = [hash[k], value]
+ proptype[k] = :multi
+ when :multi
+ hash[k] << value
+ else
+ hash[k] = value
+ proptype[k] = :single
+ end
end
hash
end
@@ -566,20 +608,41 @@ class SOAPElement
o
end
- def self.from_obj(hash_or_string)
+ def self.from_obj(obj, namespace = nil)
o = SOAPElement.new(nil)
- if hash_or_string.is_a?(Hash)
- hash_or_string.each do |k, v|
- child = self.from_obj(v)
- child.elename = k.is_a?(XSD::QName) ? k : XSD::QName.new(nil, k.to_s)
- o.add(child)
+ case obj
+ when nil
+ o.text = nil
+ when Hash
+ obj.each do |elename, value|
+ if value.is_a?(Array)
+ value.each do |subvalue|
+ child = from_obj(subvalue, namespace)
+ child.elename = to_elename(elename, namespace)
+ o.add(child)
+ end
+ else
+ child = from_obj(value, namespace)
+ child.elename = to_elename(elename, namespace)
+ o.add(child)
+ end
end
else
- o.text = hash_or_string
+ o.text = obj.to_s
end
o
end
+ def self.to_elename(obj, namespace = nil)
+ if obj.is_a?(XSD::QName)
+ obj
+ elsif /\A(.+):([^:]+)\z/ =~ obj.to_s
+ XSD::QName.new($1, $2)
+ else
+ XSD::QName.new(namespace, obj.to_s)
+ end
+ end
+
private
def add_member(name, value)
@@ -590,18 +653,32 @@ private
value
end
- def add_accessor(name)
- methodname = name
- if self.respond_to?(methodname)
- methodname = safe_accessor_name(methodname)
+ if RUBY_VERSION > "1.7.0"
+ def add_accessor(name)
+ methodname = name
+ if self.respond_to?(methodname)
+ methodname = safe_accessor_name(methodname)
+ end
+ Mapping.define_singleton_method(self, methodname) do
+ @data[@array.index(name)]
+ end
+ Mapping.define_singleton_method(self, methodname + '=') do |value|
+ @data[@array.index(name)] = value
+ end
+ end
+ else
+ def add_accessor(name)
+ methodname = safe_accessor_name(name)
+ instance_eval <<-EOS
+ def #{methodname}
+ @data[@array.index(#{name.dump})]
+ end
+
+ def #{methodname}=(value)
+ @data[@array.index(#{name.dump})] = value
+ end
+ EOS
end
- sclass = class << self; self; end
- sclass.__send__(:define_method, methodname, proc {
- @data[@array.index(name)]
- })
- sclass.__send__(:define_method, methodname + '=', proc { |value|
- @data[@array.index(name)] = value
- })
end
def safe_accessor_name(name)
@@ -624,7 +701,7 @@ public
def initialize(type = nil, rank = 1, arytype = nil)
super()
- @type = type || XSD::QName.new
+ @type = type || ValueArrayName
@rank = rank
@data = Array.new
@sparse = false
@@ -646,7 +723,7 @@ public
def [](*idxary)
if idxary.size != @rank
- raise ArgumentError.new("Given #{ idxary.size } params does not match rank: #{ @rank }")
+ raise ArgumentError.new("given #{idxary.size} params does not match rank: #{@rank}")
end
retrieve(idxary)
@@ -656,7 +733,8 @@ public
value = idxary.slice!(-1)
if idxary.size != @rank
- raise ArgumentError.new("Given #{ idxary.size } params(#{ idxary }) does not match rank: #{ @rank }")
+ raise ArgumentError.new("given #{idxary.size} params(#{idxary})" +
+ " does not match rank: #{@rank}")
end
for i in 0..(idxary.size - 1)
@@ -836,7 +914,7 @@ public
private
def self.create_arytype(typename, rank)
- "#{ typename }[" << ',' * (rank - 1) << ']'
+ "#{typename}[" << ',' * (rank - 1) << ']'
end
TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$')
diff --git a/lib/soap/element.rb b/lib/soap/element.rb
index 1494cd61dd..20d7c3bb2c 100644
--- a/lib/soap/element.rb
+++ b/lib/soap/element.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP elements library
-# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -99,7 +99,15 @@ class SOAPBody < SOAPStruct
super(nil)
@elename = EleBodyName
@encodingstyle = nil
- add(data.elename.name, data) if data
+ if data
+ if data.respond_to?(:elename)
+ add(data.elename.name, data)
+ else
+ data.to_a.each do |datum|
+ add(datum.elename.name, datum)
+ end
+ end
+ end
@is_fault = is_fault
end
@@ -129,7 +137,7 @@ class SOAPBody < SOAPStruct
end
end
- raise SOAPParser::FormatDecodeError.new('No root element.')
+ raise Parser::FormatDecodeError.new('no root element')
end
end
@@ -231,8 +239,7 @@ class SOAPEnvelope < XSD::NSDBase
end
def encode(generator, ns, attrs = {})
- SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace,
- SOAPNamespaceTag)
+ SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace, SOAPNamespaceTag)
name = ns.name(@elename)
generator.encode_tag(name, attrs)
diff --git a/lib/soap/encodingstyle/aspDotNetHandler.rb b/lib/soap/encodingstyle/aspDotNetHandler.rb
index e976433a7b..e4b2028f89 100644
--- a/lib/soap/encodingstyle/aspDotNetHandler.rb
+++ b/lib/soap/encodingstyle/aspDotNetHandler.rb
@@ -1,5 +1,5 @@
# SOAP4R - ASP.NET EncodingStyle handler library
-# Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -30,7 +30,7 @@ class ASPDotNetHandler < Handler
def encode_data(generator, ns, qualified, data, parent)
attrs = {}
name = if qualified and data.elename.namespace
- SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace)
+ SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace, '')
ns.name(data.elename)
else
data.elename.name
@@ -61,8 +61,8 @@ class ASPDotNetHandler < Handler
yield(child, true)
end
else
- raise EncodingStyleError.new("Unknown object:#{ data } in this encodingSt
-yle.")
+ raise EncodingStyleError.new(
+ "unknown object:#{data} in this encodingStyle")
end
end
@@ -119,7 +119,6 @@ yle.")
end
def decode_tag(ns, elename, attrs, parent)
- # ToDo: check if @textbuf is empty...
@textbuf = ''
o = SOAPUnknown.new(self, elename)
o.parent = parent
@@ -190,11 +189,11 @@ yle.")
end
when SOAPBasetype
- raise EncodingStyleError.new("SOAP base type must not have a child.")
+ raise EncodingStyleError.new("SOAP base type must not have a child")
else
# SOAPUnknown does not have parent.
- # raise EncodingStyleError.new("Illegal parent: #{ parent }.")
+ # raise EncodingStyleError.new("illegal parent: #{parent}")
end
end
diff --git a/lib/soap/encodingstyle/literalHandler.rb b/lib/soap/encodingstyle/literalHandler.rb
index 5b702785e6..9a494f9295 100644
--- a/lib/soap/encodingstyle/literalHandler.rb
+++ b/lib/soap/encodingstyle/literalHandler.rb
@@ -1,5 +1,5 @@
# SOAP4R - XML Literal EncodingStyle handler library
-# Copyright (C) 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -29,11 +29,22 @@ class LiteralHandler < Handler
def encode_data(generator, ns, qualified, data, parent)
attrs = {}
name = if qualified and data.elename.namespace
- SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace)
+ SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace, '')
ns.name(data.elename)
else
data.elename.name
end
+ data.extraattr.each do |k, v|
+ if k.is_a?(XSD::QName)
+ if k.namespace
+ SOAPGenerator.assign_ns(attrs, ns, k.namespace)
+ k = ns.name(k)
+ else
+ k = k.name
+ end
+ end
+ attrs[k] = v
+ end
case data
when SOAPRawString
@@ -62,13 +73,14 @@ class LiteralHandler < Handler
yield(child, true)
end
when SOAPElement
- generator.encode_tag(name, attrs.update(data.extraattr))
+ generator.encode_tag(name, attrs)
generator.encode_rawstring(data.text) if data.text
data.each do |key, value|
yield(value, qualified)
end
else
- raise EncodingStyleError.new("Unknown object:#{ data } in this encodingStyle.")
+ raise EncodingStyleError.new(
+ "unknown object:#{data} in this encodingStyle")
end
end
@@ -78,7 +90,8 @@ class LiteralHandler < Handler
else
data.elename.name
end
- cr = data.is_a?(SOAPElement) && !data.text
+ cr = (data.is_a?(SOAPCompoundtype) or
+ (data.is_a?(SOAPElement) and !data.text))
generator.encode_tag_end(name, cr)
end
@@ -128,7 +141,6 @@ class LiteralHandler < Handler
end
def decode_tag(ns, elename, attrs, parent)
- # ToDo: check if @textbuf is empty...
@textbuf = ''
o = SOAPUnknown.new(self, elename, decode_attrs(ns, attrs))
o.parent = parent
@@ -172,21 +184,19 @@ class LiteralHandler < Handler
end
def decode_parent(parent, node)
+ return unless parent.node
case parent.node
when SOAPUnknown
newparent = parent.node.as_element
node.parent = newparent
parent.replace_node(newparent)
decode_parent(parent, node)
-
when SOAPElement
parent.node.add(node)
node.parent = parent.node
-
when SOAPStruct
parent.node.add(node.elename.name, node)
node.parent = parent.node
-
when SOAPArray
if node.position
parent.node[*(decode_arypos(node.position))] = node
@@ -195,13 +205,8 @@ class LiteralHandler < Handler
parent.node.add(node)
end
node.parent = parent.node
-
- when SOAPBasetype
- raise EncodingStyleError.new("SOAP base type must not have a child.")
-
else
- # SOAPUnknown does not have parent.
- raise EncodingStyleError.new("Illegal parent: #{ parent }.")
+ raise EncodingStyleError.new("illegal parent: #{parent.node}")
end
end
diff --git a/lib/soap/encodingstyle/soapHandler.rb b/lib/soap/encodingstyle/soapHandler.rb
index 134a2ae8b8..f9152e0df8 100644
--- a/lib/soap/encodingstyle/soapHandler.rb
+++ b/lib/soap/encodingstyle/soapHandler.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP EncodingStyle handler library
-# Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -33,7 +33,7 @@ class SOAPHandler < Handler
attrs = encode_attrs(generator, ns, data, parent)
if parent && parent.is_a?(SOAPArray) && parent.position
- attrs[ns.name(AttrPositionName)] = "[#{ parent.position.join(',') }]"
+ attrs[ns.name(AttrPositionName)] = "[#{parent.position.join(',')}]"
end
name = nil
@@ -75,7 +75,7 @@ class SOAPHandler < Handler
end
else
raise EncodingStyleError.new(
- "Unknown object:#{ data } in this encodingStyle.")
+ "unknown object:#{data} in this encodingStyle")
end
end
@@ -156,7 +156,6 @@ class SOAPHandler < Handler
end
def decode_tag(ns, elename, attrs, parent)
- # ToDo: check if @textbuf is empty...
@textbuf = ''
is_nil, type, arytype, root, offset, position, href, id, extraattr =
decode_attrs(ns, attrs)
@@ -227,6 +226,7 @@ class SOAPHandler < Handler
end
def decode_parent(parent, node)
+ return unless parent.node
case parent.node
when SOAPUnknown
newparent = parent.node.as_struct
@@ -247,10 +247,8 @@ class SOAPHandler < Handler
parent.node.add(node)
end
node.parent = parent.node
- when SOAPBasetype
- raise EncodingStyleError.new("SOAP base type must not have a child.")
else
- raise EncodingStyleError.new("Illegal parent: #{ parent.node }.")
+ raise EncodingStyleError.new("illegal parent: #{parent.node}")
end
end
@@ -266,7 +264,7 @@ private
def create_arytype(ns, data)
XSD::QName.new(data.arytype.namespace,
- content_typename(data.arytype.name) + "[#{ data.size.join(',') }]")
+ content_typename(data.arytype.name) + "[#{data.size.join(',')}]")
end
def encode_attrs(generator, ns, data, parent)
@@ -383,7 +381,7 @@ private
def decode_definedtype(elename, typename, typedef, arytypestr)
unless typedef
- raise EncodingStyleError.new("Unknown type '#{ typename }'.")
+ raise EncodingStyleError.new("unknown type '#{typename}'")
end
if typedef.is_a?(::WSDL::XMLSchema::SimpleType)
decode_defined_simpletype(elename, typename, typedef, arytypestr)
@@ -421,6 +419,10 @@ private
end
o.definedtype = typedef
return o
+ when :TYPE_EMPTY
+ o = SOAPNil.decode(elename)
+ o.definedtype = typedef
+ return o
else
raise RuntimeError.new(
"Unknown kind of complexType: #{typedef.compoundtype}")
@@ -509,7 +511,7 @@ private
case qname.name
when XSD::NilLiteral
is_nil = NilLiteralMap[value] or
- raise EncodingStyleError.new("Cannot accept attribute value: #{ value } as the value of xsi:#{ XSD::NilLiteral } (expected 'true', 'false', '1', or '0').")
+ raise EncodingStyleError.new("cannot accept attribute value: #{value} as the value of xsi:#{XSD::NilLiteral} (expected 'true', 'false', '1', or '0')")
next
when XSD::AttrType
type = value
@@ -523,7 +525,7 @@ private
when AttrRoot
root = RootLiteralMap[value] or
raise EncodingStyleError.new(
- "Illegal root attribute value: #{ value }.")
+ "illegal root attribute value: #{value}")
next
when AttrOffset
offset = value
@@ -578,7 +580,7 @@ private
ref.__setobj__(o)
false
else
- raise EncodingStyleError.new("Unresolved reference: #{ ref.refid }.")
+ raise EncodingStyleError.new("unresolved reference: #{ref.refid}")
end
}
count -= 1
diff --git a/lib/soap/generator.rb b/lib/soap/generator.rb
index edd90492c6..a44d1468b1 100644
--- a/lib/soap/generator.rb
+++ b/lib/soap/generator.rb
@@ -175,7 +175,12 @@ public
def self.assign_ns(attrs, ns, namespace, tag = nil)
if namespace and !ns.assigned?(namespace)
tag = ns.assign(namespace, tag)
- attrs['xmlns:' << tag] = namespace
+ if tag == ''
+ attr = 'xmlns'
+ else
+ attr = "xmlns:#{tag}"
+ end
+ attrs[attr] = namespace
end
end
diff --git a/lib/soap/header/handlerset.rb b/lib/soap/header/handlerset.rb
index 499d6bb8a1..a8eee03023 100644
--- a/lib/soap/header/handlerset.rb
+++ b/lib/soap/header/handlerset.rb
@@ -18,6 +18,12 @@ class HandlerSet
@store = XSD::NamedElements.new
end
+ def dup
+ obj = HandlerSet.new
+ obj.store = @store.dup
+ obj
+ end
+
def add(handler)
@store << handler
end
@@ -51,6 +57,12 @@ class HandlerSet
end
end
end
+
+protected
+
+ def store=(store)
+ @store = store
+ end
end
diff --git a/lib/soap/header/simplehandler.rb b/lib/soap/header/simplehandler.rb
index e7268e04a3..4c6b00ab96 100644
--- a/lib/soap/header/simplehandler.rb
+++ b/lib/soap/header/simplehandler.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP Simple header item handler
-# Copyright (C) 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -30,7 +30,7 @@ class SimpleHandler < SOAP::Header::Handler
def on_outbound
h = on_simple_outbound
- h ? SOAPElement.from_obj(h) : nil
+ h ? SOAPElement.from_obj(h, elename.namespace) : nil
end
def on_inbound(header, mustunderstand)
diff --git a/lib/soap/mapping/factory.rb b/lib/soap/mapping/factory.rb
index a535458c5a..13dffc2dd0 100644
--- a/lib/soap/mapping/factory.rb
+++ b/lib/soap/mapping/factory.rb
@@ -37,24 +37,28 @@ class Factory
end
def setiv2soap(node, obj, map)
- # should we sort instance_variables?
- obj.instance_variables.each do |var|
- name = var.sub(/^@/, '')
- node.add(Mapping.name2elename(name),
- Mapping._obj2soap(obj.instance_variable_get(var), map))
+ if obj.class.class_variables.include?('@@schema_element')
+ obj.class.class_eval('@@schema_element').each do |name, info|
+ type, qname = info
+ if qname
+ elename = qname.name
+ else
+ elename = Mapping.name2elename(name)
+ end
+ node.add(elename,
+ Mapping._obj2soap(obj.instance_variable_get('@' + name), map))
+ end
+ else
+ # should we sort instance_variables?
+ obj.instance_variables.each do |var|
+ name = var.sub(/^@/, '')
+ elename = Mapping.name2elename(name)
+ node.add(elename,
+ Mapping._obj2soap(obj.instance_variable_get(var), map))
+ end
end
end
- # It breaks Thread.current[:SOAPMarshalDataKey].
- def mark_marshalled_obj(obj, soap_obj)
- Thread.current[:SOAPMarshalDataKey][obj.__id__] = soap_obj
- end
-
- # It breaks Thread.current[:SOAPMarshalDataKey].
- def mark_unmarshalled_obj(node, obj)
- Thread.current[:SOAPMarshalDataKey][node.id] = obj
- end
-
private
def setiv2ary(obj, node, map)
@@ -68,7 +72,7 @@ private
node.each do |name, value|
vars[Mapping.elename2name(name)] = Mapping._soap2obj(value, map)
end
- Mapping.set_instance_vars(obj, vars)
+ Mapping.set_attributes(obj, vars)
end
end
@@ -156,20 +160,14 @@ class DateTimeFactory_ < Factory
end
def soap2obj(obj_class, node, info, map)
- obj = nil
- if obj_class == Time
- obj = node.to_time
- if obj.nil?
- # Is out of range as a Time
- return false
- end
- elsif obj_class == Date
- obj = node.data
+ if node.respond_to?(:to_obj)
+ obj = node.to_obj(obj_class)
+ return false if obj.nil?
+ mark_unmarshalled_obj(node, obj)
+ return true, obj
else
return false
end
- mark_unmarshalled_obj(node, obj)
- return true, obj
end
end
diff --git a/lib/soap/mapping/mapping.rb b/lib/soap/mapping/mapping.rb
index e04e3fa50d..626df8c82f 100644
--- a/lib/soap/mapping/mapping.rb
+++ b/lib/soap/mapping/mapping.rb
@@ -1,5 +1,5 @@
# SOAP4R - Ruby type mapping utility.
-# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -23,10 +23,12 @@ module Mapping
# TraverseSupport breaks Thread.current[:SOAPMarshalDataKey].
module TraverseSupport
def mark_marshalled_obj(obj, soap_obj)
+ raise if obj.nil?
Thread.current[:SOAPMarshalDataKey][obj.__id__] = soap_obj
end
def mark_unmarshalled_obj(node, obj)
+ return if obj.nil?
# node.id is not Object#id but SOAPReference#id
Thread.current[:SOAPMarshalDataKey][node.id] = obj
end
@@ -41,10 +43,10 @@ module Mapping
soap_obj
end
- def self.soap2obj(node, registry = nil)
+ def self.soap2obj(node, registry = nil, klass = nil)
registry ||= Mapping::DefaultRegistry
Thread.current[:SOAPMarshalDataKey] = {}
- obj = _soap2obj(node, registry)
+ obj = _soap2obj(node, registry, klass)
Thread.current[:SOAPMarshalDataKey] = nil
obj
end
@@ -107,21 +109,21 @@ module Mapping
elsif registry
registry.obj2soap(obj, type)
else
- raise MappingError.new("No mapping registry given.")
+ raise MappingError.new("no mapping registry given")
end
end
- def self._soap2obj(node, registry)
+ def self._soap2obj(node, registry, klass = nil)
if node.is_a?(SOAPReference)
target = node.__getobj__
# target.id is not Object#id but SOAPReference#id
if referent = Thread.current[:SOAPMarshalDataKey][target.id]
return referent
else
- return _soap2obj(target, registry)
+ return _soap2obj(target, registry, klass)
end
end
- return registry.soap2obj(node)
+ return registry.soap2obj(node, klass)
end
if Object.respond_to?(:allocate)
@@ -157,29 +159,6 @@ module Mapping
end
end
- unless Object.respond_to?(:instance_variable_get)
- class Object
- def instance_variable_get(ivarname)
- instance_eval(ivarname)
- end
-
- def instance_variable_set(ivarname, value)
- instance_eval("#{ivarname} = value")
- end
- end
- end
-
- def self.set_instance_vars(obj, values)
- values.each do |name, value|
- setter = name + "="
- if obj.respond_to?(setter)
- obj.__send__(setter, value)
- else
- obj.instance_variable_set('@' + name, value)
- end
- end
- end
-
# Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here.
# Caution: '.' is not allowed here.
# To follow XML spec., it should be NCName.
@@ -198,28 +177,51 @@ module Mapping
}
end
- def self.class_from_name(name)
- if /^[A-Z]/ !~ name
+ def self.const_from_name(name, lenient = false)
+ const = ::Object
+ name.sub(/\A::/, '').split('::').each do |const_str|
+ if XSD::CodeGen::GenSupport.safeconstname?(const_str)
+ if const.const_defined?(const_str)
+ const = const.const_get(const_str)
+ next
+ end
+ elsif lenient
+ const_str = XSD::CodeGen::GenSupport.safeconstname(const_str)
+ if const.const_defined?(const_str)
+ const = const.const_get(const_str)
+ next
+ end
+ end
return nil
end
- klass = ::Object
- name.split('::').each do |klass_str|
- if klass.const_defined?(klass_str)
- klass = klass.const_get(klass_str)
- else
- return nil
- end
+ const
+ end
+
+ def self.class_from_name(name, lenient = false)
+ const = const_from_name(name, lenient)
+ if const.is_a?(::Class)
+ const
+ else
+ nil
+ end
+ end
+
+ def self.module_from_name(name, lenient = false)
+ const = const_from_name(name, lenient)
+ if const.is_a?(::Module)
+ const
+ else
+ nil
end
- klass
end
def self.class2qname(klass)
- name = if klass.class_variables.include?("@@schema_type")
+ name = if klass.class_variables.include?('@@schema_type')
klass.class_eval('@@schema_type')
else
nil
end
- namespace = if klass.class_variables.include?("@@schema_ns")
+ namespace = if klass.class_variables.include?('@@schema_ns')
klass.class_eval('@@schema_ns')
else
nil
@@ -250,19 +252,75 @@ module Mapping
end
end
- def self.find_attribute(obj, attr_name)
+ def self.define_singleton_method(obj, name, &block)
+ sclass = (class << obj; self; end)
+ sclass.__send__(:define_method, name, &block)
+ end
+
+ def self.get_attribute(obj, attr_name)
if obj.is_a?(::Hash)
obj[attr_name] || obj[attr_name.intern]
else
- name = ::XSD::CodeGen::GenSupport.safevarname(attr_name)
- if obj.respond_to?(name)
- obj.__send__(name)
- else
+ name = XSD::CodeGen::GenSupport.safevarname(attr_name)
+ if obj.instance_variables.include?('@' + name)
obj.instance_variable_get('@' + name)
+ elsif ((obj.is_a?(::Struct) or obj.is_a?(Marshallable)) and
+ obj.respond_to?(name))
+ obj.__send__(name)
+ end
+ end
+ end
+
+ def self.set_attributes(obj, values)
+ if obj.is_a?(::SOAP::Mapping::Object)
+ values.each do |attr_name, value|
+ obj.__add_xmlele_value(attr_name, value)
+ end
+ else
+ values.each do |attr_name, value|
+ name = XSD::CodeGen::GenSupport.safevarname(attr_name)
+ setter = name + "="
+ if obj.respond_to?(setter)
+ obj.__send__(setter, value)
+ else
+ obj.instance_variable_set('@' + name, value)
+ begin
+ define_attr_accessor(obj, name,
+ proc { instance_variable_get('@' + name) },
+ proc { |value| instance_variable_set('@' + name, value) })
+ rescue TypeError
+ # singleton class may not exist (e.g. Float)
+ end
+ end
end
end
end
+ def self.define_attr_accessor(obj, name, getterproc, setterproc = nil)
+ define_singleton_method(obj, name, &getterproc)
+ define_singleton_method(obj, name + '=', &setterproc) if setterproc
+ end
+
+ def self.schema_element_definition(klass)
+ return nil unless klass.class_variables.include?('@@schema_element')
+ elements = {}
+ as_array = []
+ klass.class_eval('@@schema_element').each do |varname, definition|
+ class_name, name = definition
+ if /\[\]$/ =~ class_name
+ class_name = class_name.sub(/\[\]$/, '')
+ as_array << class_name
+ end
+ elements[name ? name.name : varname] = class_name
+ end
+ [elements, as_array]
+ end
+
+ def self.schema_attribute_definition(klass)
+ return nil unless klass.class_variables.include?('@@schema_attribute')
+ klass.class_eval('@@schema_attribute')
+ end
+
class << Mapping
private
def add_md_ary(md_ary, ary, indices, registry)
diff --git a/lib/soap/mapping/registry.rb b/lib/soap/mapping/registry.rb
index e62706f2d8..e733f5c95f 100644
--- a/lib/soap/mapping/registry.rb
+++ b/lib/soap/mapping/registry.rb
@@ -64,50 +64,105 @@ end
# For anyType object: SOAP::Mapping::Object not ::Object
class Object; include Marshallable
def initialize
- @__soap_value_type = {}
- @__soap_value = {}
+ @__xmlele_type = {}
+ @__xmlele = []
+ @__xmlattr = {}
end
- def [](name)
- @__soap_value[name]
+ def inspect
+ sprintf("#<%s:0x%x%s>", self.class.name, __id__,
+ @__xmlele.collect { |name, value| " #{name}=#{value.inspect}" }.join)
end
- def []=(name, value)
- @__soap_value[name] = value
+ def __xmlattr
+ @__xmlattr
end
- def __soap_set_property(name, value)
- unless @__soap_value.key?(name)
- __define_attr_accessor(name)
+ def __xmlele
+ @__xmlele
+ end
+
+ def [](qname)
+ unless qname.is_a?(XSD::QName)
+ qname = XSD::QName.new(nil, qname)
+ end
+ @__xmlele.each do |k, v|
+ return v if k == qname
+ end
+ nil
+ end
+
+ def []=(qname, value)
+ unless qname.is_a?(XSD::QName)
+ qname = XSD::QName.new(nil, qname)
+ end
+ found = false
+ @__xmlele.each do |pair|
+ if pair[0] == qname
+ found = true
+ pair[1] = value
+ end
+ end
+ unless found
+ __define_attr_accessor(qname)
+ @__xmlele << [qname, value]
+ end
+ @__xmlele_type[qname] = :single
+ end
+
+ def __add_xmlele_value(qname, value)
+ found = false
+ @__xmlele.map! do |k, v|
+ if k == qname
+ found = true
+ [k, __set_xmlele_value(k, v, value)]
+ else
+ [k, v]
+ end
+ end
+ unless found
+ __define_attr_accessor(qname)
+ @__xmlele << [qname, value]
+ @__xmlele_type[qname] = :single
end
- __soap_set_property_value(name, value)
+ value
end
private
- def __soap_set_property_value(name, value)
- org = self[name]
- case @__soap_value_type[name]
- when :single
- self[name] = [org, value]
- @__soap_value_type[name] = :multi
+ if RUBY_VERSION > "1.7.0"
+ def __define_attr_accessor(qname)
+ name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
+ Mapping.define_attr_accessor(self, name,
+ proc { self[qname] },
+ proc { |value| self[qname] = value })
+ end
+ else
+ def __define_attr_accessor(qname)
+ name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
+ instance_eval <<-EOS
+ def #{name}
+ self[#{qname.dump}]
+ end
+
+ def #{name}=(value)
+ self[#{qname.dump}] = value
+ end
+ EOS
+ end
+ end
+
+ def __set_xmlele_value(key, org, value)
+ case @__xmlele_type[key]
when :multi
org << value
+ org
+ when :single
+ @__xmlele_type[key] = :multi
+ [org, value]
else
- self[name] = value
- @__soap_value_type[name] = :single
+ raise RuntimeError.new("unknown type")
end
- value
- end
-
- def __define_attr_accessor(name)
- sclass = class << self; self; end
- sclass.__send__(:define_method, name, proc {
- self[name]
- })
- sclass.__send__(:define_method, name + '=', proc { |value|
- self[name] = value
- })
end
end
@@ -123,7 +178,7 @@ class Registry
@registry = registry
end
- def obj2soap(obj, type_qname = nil)
+ def obj2soap(obj)
klass = obj.class
if map = @obj2soap[klass]
map.each do |soap_class, factory, info|
@@ -131,7 +186,10 @@ class Registry
return ret if ret
end
end
- ancestors = klass.ancestors[1..-3] # except itself, Object and Kernel
+ ancestors = klass.ancestors
+ ancestors.delete(klass)
+ ancestors.delete(::Object)
+ ancestors.delete(::Kernel)
ancestors.each do |klass|
if map = @obj2soap[klass]
map.each do |soap_class, factory, info|
@@ -145,10 +203,10 @@ class Registry
nil
end
- def soap2obj(node)
- klass = node.class
- if map = @soap2obj[klass]
+ def soap2obj(node, klass = nil)
+ if map = @soap2obj[node.class]
map.each do |obj_class, factory, info|
+ next if klass and obj_class != klass
conv, obj = factory.soap2obj(obj_class, node, info, @registry)
return true, obj if conv
end
@@ -177,11 +235,13 @@ class Registry
end
def find_mapped_soap_class(target_obj_class)
- @obj2soap[target_obj_class][0]
+ map = @obj2soap[target_obj_class]
+ map.empty? ? nil : map[0][1]
end
def find_mapped_obj_class(target_soap_class)
- @soap2obj[target_soap_class][0]
+ map = @soap2obj[target_soap_class]
+ map.empty? ? nil : map[0][0]
end
end
@@ -202,7 +262,6 @@ class Registry
[::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
[::String, ::SOAP::SOAPString, StringFactory],
[::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Date, ::SOAP::SOAPDateTime, DateTimeFactory],
[::Date, ::SOAP::SOAPDate, DateTimeFactory],
[::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
[::Time, ::SOAP::SOAPTime, DateTimeFactory],
@@ -266,7 +325,6 @@ class Registry
[::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
[::String, ::SOAP::SOAPString, StringFactory],
[::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Date, ::SOAP::SOAPDateTime, DateTimeFactory],
[::Date, ::SOAP::SOAPDate, DateTimeFactory],
[::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
[::Time, ::SOAP::SOAPTime, DateTimeFactory],
@@ -354,17 +412,17 @@ class Registry
end
alias set add
- # This mapping registry ignores type hint.
+ # general Registry ignores type_qname
def obj2soap(obj, type_qname = nil)
- soap = _obj2soap(obj, type_qname)
+ soap = _obj2soap(obj)
if @allow_original_mapping
addextend2soap(soap, obj)
end
soap
end
- def soap2obj(node)
- obj = _soap2obj(node)
+ def soap2obj(node, klass = nil)
+ obj = _soap2obj(node, klass)
if @allow_original_mapping
addextend2obj(obj, node.extraattr[RubyExtendName])
addiv2obj(obj, node.extraattr[RubyIVarName])
@@ -382,7 +440,7 @@ class Registry
private
- def _obj2soap(obj, type_qname)
+ def _obj2soap(obj)
ret = nil
if obj.is_a?(SOAPStruct) or obj.is_a?(SOAPArray)
obj.replace do |ele|
@@ -393,7 +451,7 @@ private
return obj
end
begin
- ret = @map.obj2soap(obj, type_qname) ||
+ ret = @map.obj2soap(obj) ||
@default_factory.obj2soap(nil, obj, nil, self)
return ret if ret
rescue MappingError
@@ -408,12 +466,12 @@ private
end
# Might return nil as a mapping result.
- def _soap2obj(node)
+ def _soap2obj(node, klass = nil)
if node.extraattr.key?(RubyTypeName)
conv, obj = @rubytype_factory.soap2obj(nil, node, nil, self)
return obj if conv
else
- conv, obj = @map.soap2obj(node)
+ conv, obj = @map.soap2obj(node, klass)
return obj if conv
conv, obj = @default_factory.soap2obj(nil, node, nil, self)
return obj if conv
@@ -435,14 +493,14 @@ private
attr.__getobj__.each do |name, value|
vars[name] = Mapping._soap2obj(value, self)
end
- Mapping.set_instance_vars(obj, vars)
+ Mapping.set_attributes(obj, vars)
end
if RUBY_VERSION >= '1.8.0'
def addextend2obj(obj, attr)
return unless attr
attr.split(/ /).reverse_each do |mstr|
- obj.extend(Mapping.class_from_name(mstr))
+ obj.extend(Mapping.module_from_name(mstr))
end
end
else
@@ -450,8 +508,8 @@ private
def addextend2obj(obj, attr)
return unless attr
attr.split(/ /).reverse_each do |mstr|
- m = Mapping.class_from_name(mstr)
- obj.extend(m) if m.class == Module
+ m = Mapping.module_from_name(mstr)
+ obj.extend(m)
end
end
end
diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb
index 6266148b55..61c21d8b20 100644
--- a/lib/soap/mapping/rubytypeFactory.rb
+++ b/lib/soap/mapping/rubytypeFactory.rb
@@ -1,5 +1,5 @@
# SOAP4R - Ruby type mapping factory.
-# Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -168,7 +168,7 @@ class RubytypeFactory < Factory
return nil
end
if obj.to_s[0] == ?#
- raise TypeError.new("can't dump anonymous class #{ obj }")
+ raise TypeError.new("can't dump anonymous class #{obj}")
end
param = SOAPStruct.new(TYPE_CLASS)
mark_marshalled_obj(obj, param)
@@ -179,7 +179,7 @@ class RubytypeFactory < Factory
return nil
end
if obj.to_s[0] == ?#
- raise TypeError.new("can't dump anonymous module #{ obj }")
+ raise TypeError.new("can't dump anonymous module #{obj}")
end
param = SOAPStruct.new(TYPE_MODULE)
mark_marshalled_obj(obj, param)
@@ -222,7 +222,12 @@ class RubytypeFactory < Factory
when ::SOAP::Mapping::Object
param = SOAPStruct.new(XSD::AnyTypeName)
mark_marshalled_obj(obj, param)
- addiv2soapattr(param, obj, map)
+ obj.__xmlele.each do |key, value|
+ param.add(key.name, Mapping._obj2soap(value, map))
+ end
+ obj.__xmlattr.each do |key, value|
+ param.extraattr[key] = value
+ end
when ::Exception
typestr = Mapping.name2elename(obj.class.to_s)
param = SOAPStruct.new(XSD::QName.new(RubyTypeNamespace, typestr))
@@ -258,12 +263,12 @@ private
def unknownobj2soap(soap_class, obj, info, map)
if obj.class.name.empty?
- raise TypeError.new("can't dump anonymous class #{ obj }")
+ raise TypeError.new("can't dump anonymous class #{obj}")
end
singleton_class = class << obj; self; end
if !singleton_methods_true(obj).empty? or
!singleton_class.instance_variables.empty?
- raise TypeError.new("singleton can't be dumped #{ obj }")
+ raise TypeError.new("singleton can't be dumped #{obj}")
end
if !(singleton_class.ancestors - obj.class.ancestors).empty?
typestr = Mapping.name2elename(obj.class.to_s)
@@ -378,7 +383,11 @@ private
obj = klass.new
mark_unmarshalled_obj(node, obj)
node.each do |name, value|
- obj.__soap_set_property(name, Mapping._soap2obj(value, map))
+ obj.__add_xmlele_value(XSD::QName.new(nil, name),
+ Mapping._soap2obj(value, map))
+ end
+ unless node.extraattr.empty?
+ obj.instance_variable_set('@__xmlattr', node.extraattr)
end
return true, obj
else
@@ -387,7 +396,12 @@ private
end
def unknowntype2obj(node, info, map)
- if node.is_a?(SOAPStruct)
+ case node
+ when SOAPBasetype
+ return true, node.data
+ when SOAPArray
+ return @array_factory.soap2obj(Array, node, info, map)
+ when SOAPStruct
obj = unknownstruct2obj(node, info, map)
return true, obj if obj
if !@allow_untyped_struct
@@ -406,6 +420,9 @@ private
end
typestr = Mapping.elename2name(node.type.name)
klass = Mapping.class_from_name(typestr)
+ if klass.nil? and @allow_untyped_struct
+ klass = Mapping.class_from_name(typestr, true) # lenient
+ end
if klass.nil?
return nil
end
@@ -414,7 +431,13 @@ private
end
klass_type = Mapping.class2qname(klass)
return nil unless node.type.match(klass_type)
- obj = Mapping.create_empty_object(klass)
+ obj = nil
+ begin
+ obj = Mapping.create_empty_object(klass)
+ rescue
+ # type name "data" tries Data.new which raises TypeError
+ nil
+ end
mark_unmarshalled_obj(node, obj)
setiv2obj(obj, node, map)
obj
diff --git a/lib/soap/mapping/wsdlencodedregistry.rb b/lib/soap/mapping/wsdlencodedregistry.rb
index 335106fba1..8d495668e9 100644
--- a/lib/soap/mapping/wsdlencodedregistry.rb
+++ b/lib/soap/mapping/wsdlencodedregistry.rb
@@ -1,11 +1,13 @@
# SOAP4R - WSDL encoded mapping registry.
-# Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.
+require 'xsd/qname'
+require 'xsd/namedelements'
require 'soap/baseData'
require 'soap/mapping/mapping'
require 'soap/mapping/typeMap'
@@ -15,35 +17,33 @@ module SOAP
module Mapping
-class WSDLEncodedRegistry
+class WSDLEncodedRegistry < Registry
include TraverseSupport
+ attr_reader :definedelements
attr_reader :definedtypes
attr_accessor :excn_handler_obj2soap
+ attr_accessor :excn_handler_soap2obj
- def initialize(definedtypes, config = {})
+ def initialize(definedtypes = XSD::NamedElements::Empty)
@definedtypes = definedtypes
- @config = config
+ # @definedelements = definedelements needed?
@excn_handler_obj2soap = nil
+ @excn_handler_soap2obj = nil
# For mapping AnyType element.
@rubytype_factory = RubytypeFactory.new(
:allow_untyped_struct => true,
:allow_original_mapping => true
)
+ @schema_element_cache = {}
end
- def obj2soap(obj, type_qname = nil)
+ def obj2soap(obj, qname = nil)
soap_obj = nil
- if obj.nil?
- soap_obj = SOAPNil.new
- elsif type_qname.nil? or type_qname == XSD::AnyTypeName
- soap_obj = @rubytype_factory.obj2soap(nil, obj, nil, self)
- elsif obj.is_a?(XSD::NSDBase)
- soap_obj = soap2soap(obj, type_qname)
- elsif type = @definedtypes[type_qname]
- soap_obj = obj2type(obj, type)
- elsif (type = TypeMap[type_qname])
- soap_obj = base2soap(obj, type)
+ if type = @definedtypes[qname]
+ soap_obj = obj2typesoap(obj, type)
+ else
+ soap_obj = any2soap(obj, qname)
end
return soap_obj if soap_obj
if @excn_handler_obj2soap
@@ -52,15 +52,46 @@ class WSDLEncodedRegistry
}
return soap_obj if soap_obj
end
- raise MappingError.new("Cannot map #{ obj.class.name } to SOAP/OM.")
+ if qname
+ raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
+ else
+ raise MappingError.new("cannot map #{obj.class.name} to SOAP/OM")
+ end
end
- def soap2obj(node)
- raise RuntimeError.new("#{ self } is for obj2soap only.")
+ # map anything for now: must refer WSDL while mapping. [ToDo]
+ def soap2obj(node, obj_class = nil)
+ begin
+ return any2obj(node, obj_class)
+ rescue MappingError
+ end
+ if @excn_handler_soap2obj
+ begin
+ return @excn_handler_soap2obj.call(node) { |yield_node|
+ Mapping._soap2obj(yield_node, self)
+ }
+ rescue Exception
+ end
+ end
+ raise MappingError.new("cannot map #{node.type.name} to Ruby object")
end
private
+ def any2soap(obj, qname)
+ if obj.nil?
+ SOAPNil.new
+ elsif qname.nil? or qname == XSD::AnyTypeName
+ @rubytype_factory.obj2soap(nil, obj, nil, self)
+ elsif obj.is_a?(XSD::NSDBase)
+ soap2soap(obj, qname)
+ elsif (type = TypeMap[qname])
+ base2soap(obj, type)
+ else
+ nil
+ end
+ end
+
def soap2soap(obj, type_qname)
if obj.is_a?(SOAPBasetype)
obj
@@ -82,25 +113,22 @@ private
end
end
- def obj2type(obj, type)
+ def obj2typesoap(obj, type)
if type.is_a?(::WSDL::XMLSchema::SimpleType)
- simple2soap(obj, type)
+ simpleobj2soap(obj, type)
else
- complex2soap(obj, type)
+ complexobj2soap(obj, type)
end
end
- def simple2soap(obj, type)
- o = base2soap(obj, TypeMap[type.base])
- if type.restriction.enumeration.empty?
- STDERR.puts("#{type.name}: simpleType which is not enum type not supported.")
- return o
- end
+ def simpleobj2soap(obj, type)
type.check_lexical_format(obj)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ o = base2soap(obj, TypeMap[type.base])
o
end
- def complex2soap(obj, type)
+ def complexobj2soap(obj, type)
case type.compoundtype
when :TYPE_STRUCT
struct2soap(obj, type.name, type)
@@ -108,8 +136,13 @@ private
array2soap(obj, type.name, type)
when :TYPE_MAP
map2soap(obj, type.name, type)
+ when :TYPE_SIMPLE
+ simpleobj2soap(obj, type.simplecontent)
+ when :TYPE_EMPTY
+ raise MappingError.new("should be empty") unless obj.nil?
+ SOAPNil.new
else
- raise MappingError.new("Unknown compound type: #{ type.compoundtype }")
+ raise MappingError.new("unknown compound type: #{type.compoundtype}")
end
end
@@ -126,18 +159,24 @@ private
end
def struct2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
soap_obj = SOAPStruct.new(type_qname)
- mark_marshalled_obj(obj, soap_obj)
- elements2soap(obj, soap_obj, type.content.elements)
+ unless obj.nil?
+ mark_marshalled_obj(obj, soap_obj)
+ elements2soap(obj, soap_obj, type.content.elements)
+ end
soap_obj
end
def array2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
arytype = type.child_type
soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |item|
- soap_obj.add(Mapping._obj2soap(item, self, arytype))
+ unless obj.nil?
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |item|
+ soap_obj.add(Mapping._obj2soap(item, self, arytype))
+ end
end
soap_obj
end
@@ -145,16 +184,19 @@ private
MapKeyName = XSD::QName.new(nil, "key")
MapValueName = XSD::QName.new(nil, "value")
def map2soap(obj, type_qname, type)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
keytype = type.child_type(MapKeyName) || XSD::AnyTypeName
valuetype = type.child_type(MapValueName) || XSD::AnyTypeName
soap_obj = SOAPStruct.new(MapQName)
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |key, value|
- elem = SOAPStruct.new
- elem.add("key", Mapping._obj2soap(key, self, keytype))
- elem.add("value", Mapping._obj2soap(value, self, valuetype))
- # ApacheAxis allows only 'item' here.
- soap_obj.add("item", elem)
+ unless obj.nil?
+ mark_marshalled_obj(obj, soap_obj)
+ obj.each do |key, value|
+ elem = SOAPStruct.new
+ elem.add("key", Mapping._obj2soap(key, self, keytype))
+ elem.add("value", Mapping._obj2soap(value, self, valuetype))
+ # ApacheAxis allows only 'item' here.
+ soap_obj.add("item", elem)
+ end
end
soap_obj
end
@@ -162,10 +204,64 @@ private
def elements2soap(obj, soap_obj, elements)
elements.each do |element|
name = element.name.name
- child_obj = obj.instance_variable_get('@' + name)
- soap_obj.add(name, Mapping._obj2soap(child_obj, self, element.type))
+ child_obj = Mapping.get_attribute(obj, name)
+ soap_obj.add(name,
+ Mapping._obj2soap(child_obj, self, element.type || element.name))
+ end
+ end
+
+ def any2obj(node, obj_class)
+ unless obj_class
+ typestr = XSD::CodeGen::GenSupport.safeconstname(node.elename.name)
+ obj_class = Mapping.class_from_name(typestr)
+ end
+ if obj_class and obj_class.class_variables.include?('@@schema_element')
+ soap2stubobj(node, obj_class)
+ else
+ Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class)
end
end
+
+ def soap2stubobj(node, obj_class)
+ obj = Mapping.create_empty_object(obj_class)
+ unless node.is_a?(SOAPNil)
+ add_elements2stubobj(node, obj)
+ end
+ obj
+ end
+
+ def add_elements2stubobj(node, obj)
+ elements, as_array = schema_element_definition(obj.class)
+ vars = {}
+ node.each do |name, value|
+ if class_name = elements[name]
+ if klass = Mapping.class_from_name(class_name)
+ # klass must be a SOAPBasetype or a class
+ if klass.ancestors.include?(::SOAP::SOAPBasetype)
+ if value.respond_to?(:data)
+ child = klass.new(value.data).data
+ else
+ child = klass.new(nil).data
+ end
+ else
+ child = Mapping._soap2obj(value, self, klass)
+ end
+ else
+ raise MappingError.new("unknown class: #{class_name}")
+ end
+ else # untyped element is treated as anyType.
+ child = Mapping._soap2obj(value, self)
+ end
+ vars[name] = child
+ end
+ Mapping.set_attributes(obj, vars)
+ end
+
+ # it caches @@schema_element. this means that @@schema_element must not be
+ # changed while a lifetime of a WSDLLiteralRegistry.
+ def schema_element_definition(klass)
+ @schema_element_cache[klass] ||= Mapping.schema_element_definition(klass)
+ end
end
diff --git a/lib/soap/mapping/wsdlliteralregistry.rb b/lib/soap/mapping/wsdlliteralregistry.rb
index c190c9d904..59acf2f658 100644
--- a/lib/soap/mapping/wsdlliteralregistry.rb
+++ b/lib/soap/mapping/wsdlliteralregistry.rb
@@ -1,5 +1,5 @@
# SOAP4R - WSDL literal mapping registry.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -10,48 +10,55 @@ require 'soap/baseData'
require 'soap/mapping/mapping'
require 'soap/mapping/typeMap'
require 'xsd/codegen/gensupport'
+require 'xsd/namedelements'
module SOAP
module Mapping
-class WSDLLiteralRegistry
+class WSDLLiteralRegistry < Registry
attr_reader :definedelements
attr_reader :definedtypes
attr_accessor :excn_handler_obj2soap
attr_accessor :excn_handler_soap2obj
- def initialize(definedelements = nil, definedtypes = nil)
- @definedelements = definedelements
+ def initialize(definedtypes = XSD::NamedElements::Empty,
+ definedelements = XSD::NamedElements::Empty)
@definedtypes = definedtypes
- @rubytype_factory = RubytypeFactory.new(:allow_original_mapping => false)
+ @definedelements = definedelements
+ @excn_handler_obj2soap = nil
+ @excn_handler_soap2obj = nil
@schema_element_cache = {}
+ @schema_attribute_cache = {}
end
def obj2soap(obj, qname)
- ret = nil
- if !@definedelements.nil? && ele = @definedelements[qname]
- ret = _obj2soap(obj, ele)
- elsif !@definedtypes.nil? && type = @definedtypes[qname]
- ret = obj2type(obj, type)
+ soap_obj = nil
+ if ele = @definedelements[qname]
+ soap_obj = obj2elesoap(obj, ele)
+ elsif type = @definedtypes[qname]
+ soap_obj = obj2typesoap(obj, type)
else
- ret = unknownobj2soap(obj, qname)
+ soap_obj = any2soap(obj, qname)
end
- return ret if ret
+ return soap_obj if soap_obj
if @excn_handler_obj2soap
- ret = @excn_handler_obj2soap.call(obj) { |yield_obj|
+ soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
Mapping._obj2soap(yield_obj, self)
}
- return ret if ret
+ return soap_obj if soap_obj
end
- raise MappingError.new("Cannot map #{ obj.class.name } to SOAP/OM.")
+ raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
end
# node should be a SOAPElement
- def soap2obj(node)
+ def soap2obj(node, obj_class = nil)
+ unless obj_class.nil?
+ raise MappingError.new("must not reach here")
+ end
begin
- return soapele2obj(node)
+ return any2obj(node)
rescue MappingError
end
if @excn_handler_soap2obj
@@ -62,108 +69,164 @@ class WSDLLiteralRegistry
rescue Exception
end
end
- raise MappingError.new("Cannot map #{ node.type.name } to Ruby object.")
+ raise MappingError.new("cannot map #{node.type.name} to Ruby object")
end
private
- def _obj2soap(obj, ele)
+ def obj2elesoap(obj, ele)
o = nil
if ele.type
if type = @definedtypes[ele.type]
- o = obj2type(obj, type)
+ o = obj2typesoap(obj, type)
elsif type = TypeMap[ele.type]
o = base2soap(obj, type)
else
- raise MappingError.new("Cannot find type #{ele.type}.")
+ raise MappingError.new("cannot find type #{ele.type}")
end
o.elename = ele.name
elsif ele.local_complextype
- o = SOAPElement.new(ele.name)
- ele.local_complextype.each_element do |child_ele|
- o.add(_obj2soap(Mapping.find_attribute(obj, child_ele.name.name),
- child_ele))
- end
+ o = obj2typesoap(obj, ele.local_complextype)
+ o.elename = ele.name
+ add_attributes2soap(obj, o)
+ elsif ele.local_simpletype
+ o = obj2typesoap(obj, ele.local_simpletype)
+ o.elename = ele.name
else
- raise MappingError.new('Illegal schema?')
+ raise MappingError.new('illegal schema?')
end
o
end
- def obj2type(obj, type)
+ def obj2typesoap(obj, type)
if type.is_a?(::WSDL::XMLSchema::SimpleType)
- simple2soap(obj, type)
+ simpleobj2soap(obj, type)
else
- complex2soap(obj, type)
+ complexobj2soap(obj, type)
end
end
- def simple2soap(obj, type)
- o = base2soap(obj, TypeMap[type.base])
- if type.restriction.enumeration.empty?
- STDERR.puts(
- "#{type.name}: simpleType which is not enum type not supported.")
- return o
- end
+ def simpleobj2soap(obj, type)
type.check_lexical_format(obj)
+ return SOAPNil.new if obj.nil? # ToDo: check nillable.
+ o = base2soap(obj, TypeMap[type.base])
o
end
- def complex2soap(obj, type)
+ def complexobj2soap(obj, type)
o = SOAPElement.new(type.name)
type.each_element do |child_ele|
- o.add(_obj2soap(Mapping.find_attribute(obj, child_ele.name.name),
- child_ele))
+ child = Mapping.get_attribute(obj, child_ele.name.name)
+ if child.nil?
+ if child_ele.nillable
+ # ToDo: test
+ # add empty element
+ o.add(obj2elesoap(nil))
+ elsif Integer(child_ele.minoccurs) == 0
+ # nothing to do
+ else
+ raise MappingError.new("nil not allowed: #{child_ele.name.name}")
+ end
+ elsif child_ele.map_as_array?
+ child.each do |item|
+ o.add(obj2elesoap(item, child_ele))
+ end
+ else
+ o.add(obj2elesoap(child, child_ele))
+ end
end
o
end
- def unknownobj2soap(obj, name)
- if obj.class.class_variables.include?('@@schema_element')
- ele = SOAPElement.new(name)
- add_elements2soap(obj, ele)
- add_attributes2soap(obj, ele)
- ele
+ def any2soap(obj, qname)
+ if obj.is_a?(SOAPElement)
+ obj
+ elsif obj.class.class_variables.include?('@@schema_element')
+ stubobj2soap(obj, qname)
+ elsif obj.is_a?(SOAP::Mapping::Object)
+ mappingobj2soap(obj, qname)
elsif obj.is_a?(Hash)
ele = SOAPElement.from_obj(obj)
- ele.elename = name
+ ele.elename = qname
ele
- else # expected to be a basetype or an anyType.
- o = Mapping.obj2soap(obj)
- o.elename = name
- o
+ else
+ # expected to be a basetype or an anyType.
+ # SOAPStruct, etc. is used instead of SOAPElement.
+ begin
+ ele = Mapping.obj2soap(obj)
+ ele.elename = qname
+ ele
+ rescue MappingError
+ ele = SOAPElement.new(qname, obj.to_s)
+ end
+ if obj.respond_to?(:__xmlattr)
+ obj.__xmlattr.each do |key, value|
+ ele.extraattr[key] = value
+ end
+ end
+ ele
+ end
+ end
+
+ def stubobj2soap(obj, qname)
+ ele = SOAPElement.new(qname)
+ add_elements2soap(obj, ele)
+ add_attributes2soap(obj, ele)
+ ele
+ end
+
+ def mappingobj2soap(obj, qname)
+ ele = SOAPElement.new(qname)
+ obj.__xmlele.each do |key, value|
+ if value.is_a?(::Array)
+ value.each do |item|
+ ele.add(obj2soap(item, key))
+ end
+ else
+ ele.add(obj2soap(value, key))
+ end
+ end
+ obj.__xmlattr.each do |key, value|
+ ele.extraattr[key] = value
end
+ ele
end
def add_elements2soap(obj, ele)
elements, as_array = schema_element_definition(obj.class)
- elements.each do |elename, type|
- child = Mapping.find_attribute(obj, elename)
- name = ::XSD::QName.new(nil, elename)
- if as_array.include?(type)
- child.each do |item|
- ele.add(obj2soap(item, name))
+ if elements
+ elements.each do |elename, type|
+ child = Mapping.get_attribute(obj, elename)
+ unless child.nil?
+ name = XSD::QName.new(nil, elename)
+ if as_array.include?(type)
+ child.each do |item|
+ ele.add(obj2soap(item, name))
+ end
+ else
+ ele.add(obj2soap(child, name))
+ end
end
- else
- ele.add(obj2soap(child, name))
end
end
end
def add_attributes2soap(obj, ele)
attributes = schema_attribute_definition(obj.class)
- attributes.each do |attrname, param|
- attr = Mapping.find_attribute(obj, 'attr_' + attrname)
- ele.extraattr[attrname] = attr
+ if attributes
+ attributes.each do |qname, param|
+ attr = obj.__send__('xmlattr_' +
+ XSD::CodeGen::GenSupport.safevarname(qname.name))
+ ele.extraattr[qname] = attr
+ end
end
end
def base2soap(obj, type)
soap_obj = nil
- if type <= ::XSD::XSDString
- soap_obj = type.new(::XSD::Charset.is_ces(obj, $KCODE) ?
- ::XSD::Charset.encoding_conv(obj, $KCODE, ::XSD::Charset.encoding) :
- obj)
+ if type <= XSD::XSDString
+ soap_obj = type.new(XSD::Charset.is_ces(obj, $KCODE) ?
+ XSD::Charset.encoding_conv(obj, $KCODE, XSD::Charset.encoding) : obj)
else
soap_obj = type.new(obj)
end
@@ -176,35 +239,41 @@ private
end
klass = ::SOAP::Mapping::Object
obj = klass.new
- node.each do |name, value|
- obj.__soap_set_property(name, Mapping.soap2obj(value))
- end
obj
end
- def soapele2obj(node, obj_class = nil)
+ def any2obj(node, obj_class = nil)
unless obj_class
- typestr = ::XSD::CodeGen::GenSupport.safeconstname(node.elename.name)
+ typestr = XSD::CodeGen::GenSupport.safeconstname(node.elename.name)
obj_class = Mapping.class_from_name(typestr)
end
if obj_class and obj_class.class_variables.include?('@@schema_element')
- soapele2definedobj(node, obj_class)
- elsif node.is_a?(SOAPElement)
- node.to_obj
+ soapele2stubobj(node, obj_class)
+ elsif node.is_a?(SOAPElement) or node.is_a?(SOAPStruct)
+ # SOAPArray for literal?
+ soapele2plainobj(node)
else
- result, obj = @rubytype_factory.soap2obj(nil, node, nil, self)
+ obj = Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class)
+ add_attributes2plainobj(node, obj)
obj
end
end
- def soapele2definedobj(node, obj_class)
+ def soapele2stubobj(node, obj_class)
obj = Mapping.create_empty_object(obj_class)
- add_elements2obj(node, obj)
- add_attributes2obj(node, obj)
+ add_elements2stubobj(node, obj)
+ add_attributes2stubobj(node, obj)
obj
end
- def add_elements2obj(node, obj)
+ def soapele2plainobj(node)
+ obj = anytype2obj(node)
+ add_elements2plainobj(node, obj)
+ add_attributes2plainobj(node, obj)
+ obj
+ end
+
+ def add_elements2stubobj(node, obj)
elements, as_array = schema_element_definition(obj.class)
vars = {}
node.each do |name, value|
@@ -217,13 +286,13 @@ private
child = klass.new(nil).data
end
else
- child = soapele2obj(value, klass)
+ child = any2obj(value, klass)
end
else
- raise MappingError.new("Unknown class: #{class_name}")
+ raise MappingError.new("unknown class: #{class_name}")
end
else # untyped element is treated as anyType.
- child = anytype2obj(value)
+ child = any2obj(value)
end
if as_array.include?(class_name)
(vars[name] ||= []) << child
@@ -231,48 +300,92 @@ private
vars[name] = child
end
end
- Mapping.set_instance_vars(obj, vars)
+ Mapping.set_attributes(obj, vars)
end
- def add_attributes2obj(node, obj)
- Mapping.set_instance_vars(obj, {'__soap_attribute' => {}})
- vars = {}
- attributes = schema_attribute_definition(obj.class)
- attributes.each do |attrname, class_name|
- attr = node.extraattr[::XSD::QName.new(nil, attrname)]
- next if attr.nil? or attr.empty?
- klass = Mapping.class_from_name(class_name)
- if klass.ancestors.include?(::SOAP::SOAPBasetype)
- child = klass.new(attr).data
- else
- child = attr
+ def add_attributes2stubobj(node, obj)
+ if attributes = schema_attribute_definition(obj.class)
+ define_xmlattr(obj)
+ attributes.each do |qname, class_name|
+ attr = node.extraattr[qname]
+ next if attr.nil? or attr.empty?
+ klass = Mapping.class_from_name(class_name)
+ if klass.ancestors.include?(::SOAP::SOAPBasetype)
+ child = klass.new(attr).data
+ else
+ child = attr
+ end
+ obj.__xmlattr[qname] = child
+ define_xmlattr_accessor(obj, qname)
end
- vars['attr_' + attrname] = child
end
- Mapping.set_instance_vars(obj, vars)
end
- # it caches @@schema_element. this means that @@schema_element must not be
- # changed while a lifetime of a WSDLLiteralRegistry.
- def schema_element_definition(klass)
- if @schema_element_cache.key?(klass)
- return @schema_element_cache[klass]
+ def add_elements2plainobj(node, obj)
+ node.each do |name, value|
+ obj.__add_xmlele_value(XSD::QName.new(nil, name), any2obj(value))
+ end
+ end
+
+ def add_attributes2plainobj(node, obj)
+ return if node.extraattr.empty?
+ define_xmlattr(obj)
+ node.extraattr.each do |qname, value|
+ obj.__xmlattr[qname] = value
+ define_xmlattr_accessor(obj, qname)
+ end
+ end
+
+ if RUBY_VERSION > "1.7.0"
+ def define_xmlattr_accessor(obj, qname)
+ name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
+ Mapping.define_attr_accessor(obj, 'xmlattr_' + name,
+ proc { @__xmlattr[qname] },
+ proc { |value| @__xmlattr[qname] = value })
+ end
+ else
+ def define_xmlattr_accessor(obj, qname)
+ name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
+ obj.instance_eval <<-EOS
+ def #{name}
+ @__xmlattr[#{qname.dump}]
+ end
+
+ def #{name}=(value)
+ @__xmlattr[#{qname.dump}] = value
+ end
+ EOS
+ end
+ end
+
+ if RUBY_VERSION > "1.7.0"
+ def define_xmlattr(obj)
+ obj.instance_variable_set('@__xmlattr', {})
+ unless obj.respond_to?(:__xmlattr)
+ Mapping.define_attr_accessor(obj, :__xmlattr, proc { @__xmlattr })
+ end
end
- elements = {}
- as_array = []
- klass.class_eval('@@schema_element').each do |name, class_name|
- if /\[\]$/ =~ class_name
- class_name = class_name.sub(/\[\]$/, '')
- as_array << class_name
+ else
+ def define_xmlattr(obj)
+ obj.instance_variable_set('@__xmlattr', {})
+ unless obj.respond_to?(:__xmlattr)
+ obj.instance_eval <<-EOS
+ def __xmlattr
+ @__xmlattr
+ end
+ EOS
end
- elements[name] = class_name
end
- @schema_element_cache[klass] = [elements, as_array]
- return @schema_element_cache[klass]
+ end
+
+ # it caches @@schema_element. this means that @@schema_element must not be
+ # changed while a lifetime of a WSDLLiteralRegistry.
+ def schema_element_definition(klass)
+ @schema_element_cache[klass] ||= Mapping.schema_element_definition(klass)
end
def schema_attribute_definition(klass)
- attributes = klass.class_eval('@@schema_attribute')
+ @schema_attribute_cache[klass] ||= Mapping.schema_attribute_definition(klass)
end
end
diff --git a/lib/soap/marshal.rb b/lib/soap/marshal.rb
index 7202a6aba8..1c3d5b01db 100644
--- a/lib/soap/marshal.rb
+++ b/lib/soap/marshal.rb
@@ -14,8 +14,9 @@ module SOAP
module Marshal
- # Trying xsd:dateTime data to be recovered as aTime. aDateTime if it fails.
- MarshalMappingRegistry = Mapping::Registry.new(:allow_original_mapping => true)
+ # Trying xsd:dateTime data to be recovered as aTime.
+ MarshalMappingRegistry = Mapping::Registry.new(
+ :allow_original_mapping => true)
MarshalMappingRegistry.add(
Time,
::SOAP::SOAPDateTime,
diff --git a/lib/soap/netHttpClient.rb b/lib/soap/netHttpClient.rb
index 5b16a5b443..10d68e2a4c 100644
--- a/lib/soap/netHttpClient.rb
+++ b/lib/soap/netHttpClient.rb
@@ -43,17 +43,22 @@ class NetHttpClient
raise NotImplementedError.new("not supported for now")
end
- def proxy=(proxy_str)
- if proxy_str.nil?
+ def proxy=(proxy)
+ if proxy.nil?
@proxy = nil
else
- @proxy = URI.parse(proxy_str)
+ if proxy.is_a?(URI)
+ @proxy = proxy
+ else
+ @proxy = URI.parse(proxy)
+ end
if @proxy.scheme == nil or @proxy.scheme.downcase != 'http' or
@proxy.host == nil or @proxy.port == nil
- raise ArgumentError.new("unsupported proxy `#{proxy_str}'")
+ raise ArgumentError.new("unsupported proxy `#{proxy}'")
end
- @proxy
end
+ reset_all
+ @proxy
end
def set_basic_auth(uri, user_id, passwd)
@@ -79,7 +84,9 @@ class NetHttpClient
end
def post(url, req_body, header = {})
- url = URI.parse(url)
+ unless url.is_a?(URI)
+ url = URI.parse(url)
+ end
extra = header.dup
extra['User-Agent'] = @agent if @agent
res = start(url) { |http|
@@ -89,7 +96,9 @@ class NetHttpClient
end
def get_content(url, header = {})
- url = URI.parse(url)
+ unless url.is_a?(URI)
+ url = URI.parse(url)
+ end
extra = header.dup
extra['User-Agent'] = @agent if @agent
res = start(url) { |http|
diff --git a/lib/soap/rpc/cgistub.rb b/lib/soap/rpc/cgistub.rb
index e545d53c42..487f05a9bf 100644
--- a/lib/soap/rpc/cgistub.rb
+++ b/lib/soap/rpc/cgistub.rb
@@ -1,5 +1,5 @@
-# SOAP4R - CGI stub library
-# Copyright (C) 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# SOAP4R - CGI/mod_ruby stub library
+# Copyright (C) 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -10,7 +10,7 @@ require 'soap/streamHandler'
require 'webrick/httpresponse'
require 'webrick/httpstatus'
require 'logger'
-require 'soap/rpc/router'
+require 'soap/rpc/soaplet'
module SOAP
@@ -26,57 +26,51 @@ module RPC
#
class CGIStub < Logger::Application
include SOAP
+ include WEBrick
- # There is a client which does not accept the media-type which is defined in
- # SOAP spec.
- attr_accessor :mediatype
+ class SOAPRequest
+ attr_reader :body
- class CGIError < Error; end
+ def [](var); end
- class SOAPRequest
- ALLOWED_LENGTH = 1024 * 1024
-
- def initialize(stream = $stdin)
- @method = ENV['REQUEST_METHOD']
- @size = ENV['CONTENT_LENGTH'].to_i || 0
- @contenttype = ENV['CONTENT_TYPE']
- @soapaction = ENV['HTTP_SOAPAction']
- @source = stream
- @body = nil
- end
+ def meta_vars; end
+ end
- def init
- validate
- @body = @source.read(@size)
- self
- end
+ class SOAPStdinRequest < SOAPRequest
+ attr_reader :body
- def dump
- @body.dup
+ def initialize(stream)
+ size = ENV['CONTENT_LENGTH'].to_i || 0
+ @body = stream.read(size)
end
- def soapaction
- @soapaction
+ def [](var)
+ ENV[var.gsub(/-/, '_').upcase]
end
- def contenttype
- @contenttype
+ def meta_vars
+ {
+ 'HTTP_SOAPACTION' => ENV['HTTP_SOAPAction']
+ }
end
+ end
- def to_s
- "method: #{ @method }, size: #{ @size }"
- end
+ class SOAPFCGIRequest < SOAPRequest
+ attr_reader :body
- private
+ def initialize(request)
+ @request = request
+ @body = @request.in.read
+ end
- def validate # raise CGIError
- if @method != 'POST'
- raise CGIError.new("Method '#{ @method }' not allowed.")
- end
+ def [](var)
+ @request.env[var.gsub(/-/, '_').upcase]
+ end
- if @size > ALLOWED_LENGTH
- raise CGIError.new("Content-length too long.")
- end
+ def meta_vars
+ {
+ 'HTTP_SOAPACTION' => @request.env['HTTP_SOAPAction']
+ }
end
end
@@ -85,33 +79,14 @@ class CGIStub < Logger::Application
set_log(STDERR)
self.level = ERROR
@default_namespace = default_namespace
- @router = SOAP::RPC::Router.new(appname)
- @remote_user = ENV['REMOTE_USER'] || 'anonymous'
@remote_host = ENV['REMOTE_HOST'] || ENV['REMOTE_ADDR'] || 'unknown'
- @request = nil
- @response = nil
- @mediatype = MediaType
+ @router = ::SOAP::RPC::Router.new(self.class.name)
+ @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
on_init
end
- def add_rpc_servant(obj, namespace = @default_namespace, soapaction = nil)
- RPC.defined_methods(obj).each do |name|
- qname = XSD::QName.new(namespace, name)
- param_size = obj.method(name).arity.abs
- params = (1..param_size).collect { |i| "p#{i}" }
- param_def = SOAP::RPC::SOAPMethod.create_param_def(params)
- @router.add_method(obj, qname, soapaction, name, param_def)
- end
- end
- alias add_servant add_rpc_servant
-
- def add_rpc_headerhandler(obj)
- @router.headerhandler << obj
- end
- alias add_headerhandler add_rpc_headerhandler
-
def on_init
- # Override this method in derived class to call 'add_method' to add methods.
+ # do extra initialization in a derived class if needed.
end
def mapping_registry
@@ -122,83 +97,108 @@ class CGIStub < Logger::Application
@router.mapping_registry = value
end
- def add_method(receiver, name, *param)
- add_method_with_namespace_as(@default_namespace, receiver,
- name, name, *param)
+ def generate_explicit_type
+ @router.generate_explicit_type
end
- def add_method_as(receiver, name, name_as, *param)
- add_method_with_namespace_as(@default_namespace, receiver,
- name, name_as, *param)
+ def generate_explicit_type=(generate_explicit_type)
+ @router.generate_explicit_type = generate_explicit_type
end
- def add_method_with_namespace(namespace, receiver, name, *param)
- add_method_with_namespace_as(namespace, receiver, name, name, *param)
+ # servant entry interface
+
+ def add_rpc_servant(obj, namespace = @default_namespace)
+ @router.add_rpc_servant(obj, namespace)
end
+ alias add_servant add_rpc_servant
- def add_method_with_namespace_as(namespace, receiver, name, name_as, *param)
- param_def = if param.size == 1 and param[0].is_a?(Array)
- param[0]
- else
- SOAP::RPC::SOAPMethod.create_param_def(param)
- end
+ def add_headerhandler(obj)
+ @router.add_headerhandler(obj)
+ end
+ alias add_rpc_headerhandler add_headerhandler
+
+ # method entry interface
+
+ def add_rpc_method(obj, name, *param)
+ add_rpc_method_with_namespace_as(@default_namespace, obj, name, name, *param)
+ end
+ alias add_method add_rpc_method
+
+ def add_rpc_method_as(obj, name, name_as, *param)
+ add_rpc_method_with_namespace_as(@default_namespace, obj, name, name_as, *param)
+ end
+ alias add_method_as add_rpc_method_as
+
+ def add_rpc_method_with_namespace(namespace, obj, name, *param)
+ add_rpc_method_with_namespace_as(namespace, obj, name, name, *param)
+ end
+ alias add_method_with_namespace add_rpc_method_with_namespace
+
+ def add_rpc_method_with_namespace_as(namespace, obj, name, name_as, *param)
qname = XSD::QName.new(namespace, name_as)
- @router.add_method(receiver, qname, nil, name, param_def)
+ soapaction = nil
+ param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
end
+ alias add_method_with_namespace_as add_rpc_method_with_namespace_as
- def route(conn_data)
- @router.route(conn_data)
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
end
- def create_fault_response(e)
- @router.create_fault_response(e)
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ @router.add_document_operation(receiver, soapaction, name, param_def, opt)
+ end
+
+ def set_fcgi_request(request)
+ @fcgi = request
end
private
-
- def run
- prologue
- httpversion = WEBrick::HTTPVersion.new('1.0')
- @response = WEBrick::HTTPResponse.new({:HTTPVersion => httpversion})
- conn_data = nil
+ HTTPVersion = WEBrick::HTTPVersion.new('1.0') # dummy; ignored
+
+ def run
+ res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion})
begin
- @log.info { "Received a request from '#{ @remote_user }@#{ @remote_host }'." }
- # SOAP request parsing.
- @request = SOAPRequest.new.init
- @response['Status'] = 200
- conn_data = ::SOAP::StreamHandler::ConnectionData.new
- conn_data.receive_string = @request.dump
- conn_data.receive_contenttype = @request.contenttype
- @log.debug { "XML Request: #{conn_data.receive_string}" }
- conn_data = route(conn_data)
- @log.debug { "XML Response: #{conn_data.send_string}" }
- if conn_data.is_fault
- @response['Status'] = 500
+ @log.info { "received a request from '#{ @remote_host }'" }
+ if @fcgi
+ req = SOAPFCGIRequest.new(@fcgi)
+ else
+ req = SOAPStdinRequest.new($stdin)
end
- @response['Cache-Control'] = 'private'
- @response.body = conn_data.send_string
- @response['content-type'] = conn_data.send_contenttype
- rescue Exception
- conn_data = create_fault_response($!)
- @response['Cache-Control'] = 'private'
- @response['Status'] = 500
- @response.body = conn_data.send_string
- @response['content-type'] = conn_data.send_contenttype || @mediatype
+ @soaplet.do_POST(req, res)
+ rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
+ res.set_error(ex)
+ rescue HTTPStatus::Error => ex
+ res.set_error(ex)
+ rescue HTTPStatus::Status => ex
+ res.status = ex.code
+ rescue StandardError, NameError => ex # for Ruby 1.6
+ res.set_error(ex, true)
ensure
- buf = ''
- @response.send_response(buf)
- buf.sub!(/^[^\r]+\r\n/, '') # Trim status line.
+ if defined?(MOD_RUBY)
+ r = Apache.request
+ r.status = res.status
+ r.content_type = res.content_type
+ r.send_http_header
+ buf = res.body
+ else
+ buf = ''
+ res.send_response(buf)
+ buf.sub!(/^[^\r]+\r\n/, '') # Trim status line.
+ end
@log.debug { "SOAP CGI Response:\n#{ buf }" }
- print buf
- epilogue
+ if @fcgi
+ @fcgi.out.print buf
+ @fcgi.finish
+ @fcgi = nil
+ else
+ print buf
+ end
end
-
0
end
-
- def prologue; end
- def epilogue; end
end
diff --git a/lib/soap/rpc/driver.rb b/lib/soap/rpc/driver.rb
index 5fd755c51a..cb10ed92b5 100644
--- a/lib/soap/rpc/driver.rb
+++ b/lib/soap/rpc/driver.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP RPC driver
-# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -22,32 +22,55 @@ module RPC
class Driver
- class EmptyResponseError < Error; end
-
class << self
- def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- self.__send__(:define_method, name, proc {
- @servant.__send__(name)
- })
- if assignable
- self.__send__(:define_method, name + '=', proc { |rhs|
- @servant.__send__(name + '=', rhs)
+ if RUBY_VERSION >= "1.7.0"
+ def __attr_proxy(symbol, assignable = false)
+ name = symbol.to_s
+ self.__send__(:define_method, name, proc {
+ @proxy.__send__(name)
})
+ if assignable
+ self.__send__(:define_method, name + '=', proc { |rhs|
+ @proxy.__send__(name + '=', rhs)
+ })
+ end
+ end
+ else
+ def __attr_proxy(symbol, assignable = false)
+ name = symbol.to_s
+ module_eval <<-EOS
+ def #{name}
+ @proxy.#{name}
+ end
+ EOS
+ if assignable
+ module_eval <<-EOS
+ def #{name}=(value)
+ @proxy.#{name} = value
+ end
+ EOS
+ end
end
end
end
- __attr_proxy :options
- __attr_proxy :headerhandler
- __attr_proxy :streamhandler
- __attr_proxy :test_loopback_response
__attr_proxy :endpoint_url, true
__attr_proxy :mapping_registry, true
- __attr_proxy :soapaction, true
__attr_proxy :default_encodingstyle, true
__attr_proxy :generate_explicit_type, true
__attr_proxy :allow_unqualified_element, true
+ __attr_proxy :headerhandler
+ __attr_proxy :streamhandler
+ __attr_proxy :test_loopback_response
+ __attr_proxy :reset_stream
+
+ attr_reader :proxy
+ attr_reader :options
+ attr_accessor :soapaction
+
+ def inspect
+ "#<#{self.class}:#{@proxy.inspect}>"
+ end
def httpproxy
options["protocol.http.proxy"]
@@ -81,10 +104,12 @@ class Driver
options["protocol.wiredump_file_base"] = wiredump_file_base
end
- def initialize(endpoint_url, namespace, soapaction = nil)
- @servant = Servant__.new(self, endpoint_url, namespace)
- @servant.soapaction = soapaction
- @proxy = @servant.proxy
+ def initialize(endpoint_url, namespace = nil, soapaction = nil)
+ @namespace = namespace
+ @soapaction = soapaction
+ @options = setup_options
+ @wiredump_file_base = nil
+ @proxy = Proxy.new(endpoint_url, @soapaction, @options)
end
def loadproperty(propertyname)
@@ -93,28 +118,23 @@ class Driver
end
end
- def inspect
- "#<#{self.class}:#{@servant.inspect}>"
- end
-
def add_rpc_method(name, *params)
- param_def = create_rpc_param_def(params)
- @servant.add_rpc_method(name, @servant.soapaction, name, param_def)
+ add_rpc_method_with_soapaction_as(name, name, @soapaction, *params)
end
def add_rpc_method_as(name, name_as, *params)
- param_def = create_rpc_param_def(params)
- @servant.add_rpc_method(name_as, @servant.soapaction, name, param_def)
+ add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params)
end
def add_rpc_method_with_soapaction(name, soapaction, *params)
- param_def = create_rpc_param_def(params)
- @servant.add_rpc_method(name, soapaction, name, param_def)
+ add_rpc_method_with_soapaction_as(name, name, soapaction, *params)
end
def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
- param_def = create_rpc_param_def(params)
- @servant.add_rpc_method(name_as, soapaction, name, param_def)
+ param_def = SOAPMethod.create_rpc_param_def(params)
+ qname = XSD::QName.new(@namespace, name_as)
+ @proxy.add_rpc_method(qname, soapaction, name, param_def)
+ add_rpc_method_interface(name, param_def)
end
# add_method is for shortcut of typical rpc/encoded method definition.
@@ -123,226 +143,107 @@ class Driver
alias add_method_with_soapaction add_rpc_method_with_soapaction
alias add_method_with_soapaction_as add_rpc_method_with_soapaction_as
- def add_document_method(name, req_qname, res_qname)
- param_def = create_document_param_def(name, req_qname, res_qname)
- @servant.add_document_method(name, @servant.soapaction, name, param_def)
- end
-
- def add_document_method_as(name, name_as, req_qname, res_qname)
- param_def = create_document_param_def(name, req_qname, res_qname)
- @servant.add_document_method(name_as, @servant.soapaction, name, param_def)
- end
-
- def add_document_method_with_soapaction(name, soapaction, req_qname,
- res_qname)
- param_def = create_document_param_def(name, req_qname, res_qname)
- @servant.add_document_method(name, soapaction, name, param_def)
+ def add_document_method(name, soapaction, req_qname, res_qname)
+ param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
+ @proxy.add_document_method(soapaction, name, param_def)
+ add_document_method_interface(name, param_def)
end
- def add_document_method_with_soapaction_as(name, name_as, soapaction,
- req_qname, res_qname)
- param_def = create_document_param_def(name, req_qname, res_qname)
- @servant.add_document_method(name_as, soapaction, name, param_def)
+ def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
+ @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt)
+ add_rpc_method_interface(name, param_def)
end
- def reset_stream
- @servant.reset_stream
+ def add_document_operation(soapaction, name, param_def, opt = {})
+ @proxy.add_document_operation(soapaction, name, param_def, opt)
+ add_document_method_interface(name, param_def)
end
def invoke(headers, body)
- @servant.invoke(headers, body)
+ if headers and !headers.is_a?(SOAPHeader)
+ headers = create_header(headers)
+ end
+ set_wiredump_file_base(body.elename.name)
+ env = @proxy.invoke(headers, body)
+ if env.nil?
+ return nil, nil
+ else
+ return env.header, env.body
+ end
end
def call(name, *params)
- @servant.call(name, *params)
+ set_wiredump_file_base(name)
+ @proxy.call(name, *params)
end
private
- def create_rpc_param_def(params)
- if params.size == 1 and params[0].is_a?(Array)
- params[0]
- else
- SOAPMethod.create_param_def(params)
+ def set_wiredump_file_base(name)
+ if @wiredump_file_base
+ @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}")
end
end
- def create_document_param_def(name, req_qname, res_qname)
- [
- ['input', name, [nil, req_qname.namespace, req_qname.name]],
- ['output', name, [nil, res_qname.namespace, res_qname.name]]
- ]
- end
-
- def add_rpc_method_interface(name, param_def)
- @servant.add_rpc_method_interface(name, param_def)
- end
-
- def add_document_method_interface(name, paramname)
- @servant.add_document_method_interface(name, paramname)
- end
-
- class Servant__
- attr_reader :proxy
- attr_reader :options
- attr_accessor :soapaction
-
- def initialize(host, endpoint_url, namespace)
- @host = host
- @namespace = namespace
- @soapaction = nil
- @options = setup_options
- @wiredump_file_base = nil
- @endpoint_url = endpoint_url
- @proxy = Proxy.new(endpoint_url, @soapaction, @options)
- end
-
- def inspect
- "#<#{self.class}:#{@proxy.inspect}>"
- end
-
- def endpoint_url
- @proxy.endpoint_url
- end
-
- def endpoint_url=(endpoint_url)
- @proxy.endpoint_url = endpoint_url
- end
-
- def mapping_registry
- @proxy.mapping_registry
- end
-
- def mapping_registry=(mapping_registry)
- @proxy.mapping_registry = mapping_registry
- end
-
- def default_encodingstyle
- @proxy.default_encodingstyle
- end
-
- def default_encodingstyle=(encodingstyle)
- @proxy.default_encodingstyle = encodingstyle
- end
-
- def generate_explicit_type
- @proxy.generate_explicit_type
- end
-
- def generate_explicit_type=(generate_explicit_type)
- @proxy.generate_explicit_type = generate_explicit_type
- end
-
- def allow_unqualified_element
- @proxy.allow_unqualified_element
- end
-
- def allow_unqualified_element=(allow_unqualified_element)
- @proxy.allow_unqualified_element = allow_unqualified_element
- end
-
- def headerhandler
- @proxy.headerhandler
- end
-
- def streamhandler
- @proxy.streamhandler
- end
-
- def test_loopback_response
- @proxy.test_loopback_response
+ def create_header(headers)
+ header = SOAPHeader.new()
+ headers.each do |content, mustunderstand, encodingstyle|
+ header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
end
+ header
+ end
- def reset_stream
- @proxy.reset_stream
+ def setup_options
+ if opt = Property.loadproperty(::SOAP::PropertyName)
+ opt = opt["client"]
end
-
- def invoke(headers, body)
- if headers and !headers.is_a?(SOAPHeader)
- headers = create_header(headers)
- end
- set_wiredump_file_base(body.elename.name)
- env = @proxy.invoke(headers, body)
- if env.nil?
- return nil, nil
- else
- return env.header, env.body
- end
+ opt ||= Property.new
+ opt.add_hook("protocol.mandatorycharset") do |key, value|
+ @proxy.mandatorycharset = value
end
-
- def call(name, *params)
- set_wiredump_file_base(name)
- @proxy.call(name, *params)
+ opt.add_hook("protocol.wiredump_file_base") do |key, value|
+ @wiredump_file_base = value
end
+ opt["protocol.http.charset"] ||= XSD::Charset.encoding_label
+ opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
+ opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
+ opt
+ end
- def add_rpc_method(name_as, soapaction, name, param_def)
- qname = XSD::QName.new(@namespace, name_as)
- @proxy.add_rpc_method(qname, soapaction, name, param_def)
- add_rpc_method_interface(name, param_def)
- end
+ def add_rpc_method_interface(name, param_def)
+ param_count = RPC::SOAPMethod.param_count(param_def,
+ RPC::SOAPMethod::IN, RPC::SOAPMethod::INOUT)
+ add_method_interface(name, param_count)
+ end
- def add_document_method(name_as, soapaction, name, param_def)
- qname = XSD::QName.new(@namespace, name_as)
- @proxy.add_document_method(qname, soapaction, name, param_def)
- add_document_method_interface(name, param_def)
- end
+ def add_document_method_interface(name, param_def)
+ param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN)
+ add_method_interface(name, param_count)
+ end
- def add_rpc_method_interface(name, param_def)
- param_count = 0
- @proxy.operation[name].each_param_name(RPC::SOAPMethod::IN,
- RPC::SOAPMethod::INOUT) do |param_name|
- param_count += 1
- end
- sclass = class << @host; self; end
- sclass.__send__(:define_method, name, proc { |*arg|
+ if RUBY_VERSION > "1.7.0"
+ def add_method_interface(name, param_count)
+ ::SOAP::Mapping.define_singleton_method(self, name) do |*arg|
unless arg.size == param_count
raise ArgumentError.new(
- "wrong number of arguments (#{arg.size} for #{param_count})")
+ "wrong number of arguments (#{arg.size} for #{param_count})")
end
- @servant.call(name, *arg)
- })
- @host.method(name)
- end
-
- def add_document_method_interface(name, paramname)
- sclass = class << @host; self; end
- sclass.__send__(:define_method, name, proc { |param|
- @servant.call(name, param)
- })
- @host.method(name)
- end
-
- private
-
- def set_wiredump_file_base(name)
- if @wiredump_file_base
- @proxy.set_wiredump_file_base(@wiredump_file_base + "_#{ name }")
- end
- end
-
- def create_header(headers)
- header = SOAPHeader.new()
- headers.each do |content, mustunderstand, encodingstyle|
- header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
- end
- header
- end
-
- def setup_options
- if opt = Property.loadproperty(::SOAP::PropertyName)
- opt = opt["client"]
- end
- opt ||= Property.new
- opt.add_hook("protocol.mandatorycharset") do |key, value|
- @proxy.mandatorycharset = value
+ call(name, *arg)
end
- opt.add_hook("protocol.wiredump_file_base") do |key, value|
- @wiredump_file_base = value
- end
- opt["protocol.http.charset"] ||= XSD::Charset.encoding_label
- opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
- opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
- opt
+ self.method(name)
+ end
+ else
+ def add_method_interface(name, param_count)
+ instance_eval <<-EOS
+ def #{name}(*arg)
+ unless arg.size == #{param_count}
+ raise ArgumentError.new(
+ "wrong number of arguments (\#{arg.size} for #{param_count})")
+ end
+ call(#{name.dump}, *arg)
+ end
+ EOS
+ self.method(name)
end
end
end
diff --git a/lib/soap/rpc/element.rb b/lib/soap/rpc/element.rb
index 8a2f319293..e6cae2f7e0 100644
--- a/lib/soap/rpc/element.rb
+++ b/lib/soap/rpc/element.rb
@@ -1,5 +1,5 @@
# SOAP4R - RPC element definition.
-# Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2001, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -77,6 +77,8 @@ class SOAPMethod < SOAPStruct
attr_reader :param_def
attr_reader :inparam
attr_reader :outparam
+ attr_reader :retval_name
+ attr_reader :retval_class_name
def initialize(qname, param_def = nil)
super(nil)
@@ -93,6 +95,7 @@ class SOAPMethod < SOAPStruct
@inparam = {}
@outparam = {}
@retval_name = nil
+ @retval_class_name = nil
init_param(@param_def) if @param_def
end
@@ -101,12 +104,12 @@ class SOAPMethod < SOAPStruct
@outparam_names.size > 0
end
- def each_param_name(*type)
- @signature.each do |io_type, name, param_type|
- if type.include?(io_type)
- yield(name)
- end
- end
+ def input_params
+ collect_params(IN, INOUT)
+ end
+
+ def output_params
+ collect_params(OUT, INOUT)
end
def set_param(params)
@@ -124,7 +127,30 @@ class SOAPMethod < SOAPStruct
end
end
- def SOAPMethod.create_param_def(param_names)
+ def SOAPMethod.param_count(param_def, *type)
+ count = 0
+ param_def.each do |io_type, name, param_type|
+ if type.include?(io_type)
+ count += 1
+ end
+ end
+ count
+ end
+
+ def SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ if param.size == 1 and param[0].is_a?(Array)
+ return param[0]
+ end
+ if param.empty?
+ method = obj.method(name)
+ param_names = (1..method.arity.abs).collect { |i| "p#{i}" }
+ else
+ param_names = param
+ end
+ create_rpc_param_def(param_names)
+ end
+
+ def SOAPMethod.create_rpc_param_def(param_names)
param_def = []
param_names.each do |param_name|
param_def.push([IN, param_name, nil])
@@ -133,8 +159,29 @@ class SOAPMethod < SOAPStruct
param_def
end
+ def SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
+ req_qnames = [req_qnames] if req_qnames.is_a?(XSD::QName)
+ res_qnames = [res_qnames] if res_qnames.is_a?(XSD::QName)
+ param_def = []
+ req_qnames.each do |qname|
+ param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ res_qnames.each do |qname|
+ param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
+ end
+ param_def
+ end
+
private
+ def collect_params(*type)
+ names = []
+ @signature.each do |io_type, name, param_type|
+ names << name if type.include?(io_type)
+ end
+ names
+ end
+
def init_param(param_def)
param_def.each do |io_type, name, param_type|
case io_type
@@ -148,12 +195,20 @@ private
@signature.push([INOUT, name, param_type])
@inoutparam_names.push(name)
when RETVAL
- if (@retval_name)
- raise MethodDefinitionError.new('Duplicated retval')
+ if @retval_name
+ raise MethodDefinitionError.new('duplicated retval')
end
@retval_name = name
+ @retval_class_name = nil
+ if param_type
+ if param_type[0].is_a?(String)
+ @retval_class_name = Mapping.class_from_name(param_type[0])
+ else
+ @retval_class_name = param_type[0]
+ end
+ end
else
- raise MethodDefinitionError.new("Unknown type: #{ io_type }")
+ raise MethodDefinitionError.new("unknown type: #{io_type}")
end
end
end
@@ -168,7 +223,7 @@ class SOAPMethodRequest < SOAPMethod
param_value = []
i = 0
params.each do |param|
- param_name = "p#{ i }"
+ param_name = "p#{i}"
i += 1
param_def << [IN, param_name, nil]
param_value << [param_name, param]
@@ -186,9 +241,9 @@ class SOAPMethodRequest < SOAPMethod
end
def each
- each_param_name(IN, INOUT) do |name|
+ input_params.each do |name|
unless @inparam[name]
- raise ParameterError.new("Parameter: #{ name } was not given.")
+ raise ParameterError.new("parameter: #{name} was not given")
end
yield(name, @inparam[name])
end
@@ -200,10 +255,10 @@ class SOAPMethodRequest < SOAPMethod
req
end
- def create_method_response
- SOAPMethodResponse.new(
- XSD::QName.new(@elename.namespace, @elename.name + 'Response'),
- @param_def)
+ def create_method_response(response_name = nil)
+ response_name ||=
+ XSD::QName.new(@elename.namespace, @elename.name + 'Response')
+ SOAPMethodResponse.new(response_name, @param_def)
end
private
@@ -211,7 +266,7 @@ private
def check_elename(qname)
# NCName & ruby's method name
unless /\A[\w_][\w\d_\-]*\z/ =~ qname.name
- raise MethodDefinitionError.new("Element name '#{qname.name}' not allowed")
+ raise MethodDefinitionError.new("element name '#{qname.name}' not allowed")
end
end
end
@@ -236,11 +291,11 @@ class SOAPMethodResponse < SOAPMethod
yield(@retval_name, @retval)
end
- each_param_name(OUT, INOUT) do |param_name|
- unless @outparam[param_name]
- raise ParameterError.new("Parameter: #{ param_name } was not given.")
+ output_params.each do |name|
+ unless @outparam[name]
+ raise ParameterError.new("parameter: #{name} was not given")
end
- yield(param_name, @outparam[param_name])
+ yield(name, @outparam[name])
end
end
end
diff --git a/lib/soap/rpc/httpserver.rb b/lib/soap/rpc/httpserver.rb
index dccf950480..6d2a72ebe3 100644
--- a/lib/soap/rpc/httpserver.rb
+++ b/lib/soap/rpc/httpserver.rb
@@ -24,55 +24,62 @@ class HTTPServer < Logger::Application
super(config[:SOAPHTTPServerApplicationName] || self.class.name)
@default_namespace = config[:SOAPDefaultNamespace]
@webrick_config = config.dup
+ self.level = Logger::Severity::ERROR # keep silent by default
@webrick_config[:Logger] ||= @log
- @server = nil
- @soaplet = ::SOAP::RPC::SOAPlet.new
- self.level = Logger::Severity::INFO
+ @log = @webrick_config[:Logger] # sync logger of App and HTTPServer
+ @router = ::SOAP::RPC::Router.new(self.class.name)
+ @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
on_init
+ @server = WEBrick::HTTPServer.new(@webrick_config)
+ @server.mount('/', @soaplet)
end
def on_init
- # define extra methods in derived class.
+ # do extra initialization in a derived class if needed.
end
def status
- if @server
- @server.status
- else
- nil
- end
+ @server.status if @server
end
def shutdown
@server.shutdown if @server
end
-
+
def mapping_registry
- @soaplet.app_scope_router.mapping_registry
+ @router.mapping_registry
end
def mapping_registry=(mapping_registry)
- @soaplet.app_scope_router.mapping_registry = mapping_registry
+ @router.mapping_registry = mapping_registry
+ end
+
+ def generate_explicit_type
+ @router.generate_explicit_type
+ end
+
+ def generate_explicit_type=(generate_explicit_type)
+ @router.generate_explicit_type = generate_explicit_type
end
# servant entry interface
- def add_rpc_request_servant(factory, namespace = @default_namespace,
- mapping_registry = nil)
- @soaplet.add_rpc_request_servant(factory, namespace, mapping_registry)
+ def add_rpc_request_servant(factory, namespace = @default_namespace)
+ @router.add_rpc_request_servant(factory, namespace)
end
def add_rpc_servant(obj, namespace = @default_namespace)
- @soaplet.add_rpc_servant(obj, namespace)
+ @router.add_rpc_servant(obj, namespace)
end
- def add_rpc_request_headerhandler(factory)
- @soaplet.add_rpc_request_headerhandler(factory)
+ def add_request_headerhandler(factory)
+ @router.add_request_headerhandler(factory)
end
- def add_rpc_headerhandler(obj)
- @soaplet.add_rpc_headerhandler(obj)
+ def add_headerhandler(obj)
+ @router.add_headerhandler(obj)
end
+ alias add_rpc_headerhandler add_headerhandler
# method entry interface
@@ -81,52 +88,38 @@ class HTTPServer < Logger::Application
end
alias add_method add_rpc_method
- def add_document_method(obj, name, req_qname, res_qname)
- opt = {}
- opt[:request_style] = opt[:response_style] = :document
- opt[:request_use] = opt[:response_use] = :literal
- param_def = [
- ['input', req_qname.name, [nil, req_qname.namespace, req_qname.name]],
- ['output', req_qname.name, [nil, res_qname.namespace, res_qname.name]]
- ]
- @soaplet.app_scope_router.add_operation(req_qname, nil, obj, name,
- param_def, opt)
- end
-
def add_rpc_method_as(obj, name, name_as, *param)
qname = XSD::QName.new(@default_namespace, name_as)
soapaction = nil
- param_def = create_param_def(obj, name, param)
- add_operation(qname, soapaction, obj, name, param_def)
+ param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
+ @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
end
alias add_method_as add_rpc_method_as
- def add_operation(qname, soapaction, obj, name, param_def, opt = {})
- opt[:request_style] ||= :rpc
- opt[:response_style] ||= :rpc
- opt[:request_use] ||= :encoded
- opt[:response_use] ||= :encoded
- @soaplet.app_scope_router.add_operation(qname, soapaction, obj, name,
- param_def, opt)
+ def add_document_method(obj, soapaction, name, req_qnames, res_qnames)
+ param_def = SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
+ @router.add_document_operation(obj, soapaction, name, param_def)
+ end
+
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
+ end
+
+ def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
+ @router.add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt)
end
- def create_param_def(obj, name, param = nil)
- if param.nil? or param.empty?
- method = obj.method(name)
- ::SOAP::RPC::SOAPMethod.create_param_def(
- (1..method.arity.abs).collect { |i| "p#{i}" })
- elsif param.size == 1 and param[0].is_a?(Array)
- param[0]
- else
- ::SOAP::RPC::SOAPMethod.create_param_def(param)
- end
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ @router.add_document_operation(receiver, soapaction, name, param_def, opt)
+ end
+
+ def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
+ @router.add_document_request_operation(factory, soapaction, name, param_def, opt)
end
private
def run
- @server = WEBrick::HTTPServer.new(@webrick_config)
- @server.mount('/', @soaplet)
@server.start
end
end
diff --git a/lib/soap/rpc/proxy.rb b/lib/soap/rpc/proxy.rb
index ca110664f9..b9d80541af 100644
--- a/lib/soap/rpc/proxy.rb
+++ b/lib/soap/rpc/proxy.rb
@@ -1,5 +1,5 @@
# SOAP4R - RPC Proxy library.
-# Copyright (C) 2000, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -78,66 +78,77 @@ public
@streamhandler.test_loopback_response
end
- def add_rpc_method(qname, soapaction, name, param_def, opt = {})
+ def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
+ opt[:request_qname] = qname
opt[:request_style] ||= :rpc
opt[:response_style] ||= :rpc
opt[:request_use] ||= :encoded
opt[:response_use] ||= :encoded
- @operation[name] = Operation.new(qname, soapaction, name, param_def, opt)
+ @operation[name] = Operation.new(soapaction, param_def, opt)
end
- def add_document_method(qname, soapaction, name, param_def, opt = {})
+ def add_document_operation(soapaction, name, param_def, opt = {})
opt[:request_style] ||= :document
opt[:response_style] ||= :document
opt[:request_use] ||= :literal
opt[:response_use] ||= :literal
- @operation[name] = Operation.new(qname, soapaction, name, param_def, opt)
+ @operation[name] = Operation.new(soapaction, param_def, opt)
end
# add_method is for shortcut of typical rpc/encoded method definition.
- alias add_method add_rpc_method
+ alias add_method add_rpc_operation
+ alias add_rpc_method add_rpc_operation
+ alias add_document_method add_document_operation
- def invoke(req_header, req_body, opt = create_options)
- req_env = SOAPEnvelope.new(req_header, req_body)
- opt[:external_content] = nil
- conn_data = marshal(req_env, opt)
- if ext = opt[:external_content]
- mime = MIMEMessage.new
- ext.each do |k, v|
- mime.add_attachment(v.data)
- end
- mime.add_part(conn_data.send_string + "\r\n")
- mime.close
- conn_data.send_string = mime.content_str
- conn_data.send_contenttype = mime.headers['content-type'].str
- end
- conn_data = @streamhandler.send(@endpoint_url, conn_data, opt[:soapaction])
- if conn_data.receive_string.empty?
- return nil
- end
- unmarshal(conn_data, opt)
+ def invoke(req_header, req_body, opt = nil)
+ opt ||= create_options
+ route(req_header, req_body, opt, opt)
end
def call(name, *params)
unless op_info = @operation[name]
- raise MethodDefinitionError, "Method: #{name} not defined."
+ raise MethodDefinitionError, "method: #{name} not defined"
end
req_header = create_request_header
- req_body = op_info.create_request_body(params, @mapping_registry,
- @literal_mapping_registry)
- opt = create_options({
+ req_body = SOAPBody.new(
+ op_info.request_body(params, @mapping_registry, @literal_mapping_registry)
+ )
+ reqopt = create_options({
:soapaction => op_info.soapaction || @soapaction,
+ :default_encodingstyle => op_info.request_default_encodingstyle})
+ resopt = create_options({
:default_encodingstyle => op_info.response_default_encodingstyle})
- env = invoke(req_header, req_body, opt)
+ env = route(req_header, req_body, reqopt, resopt)
+ raise EmptyResponseError unless env
receive_headers(env.header)
- raise EmptyResponseError.new("Empty response.") unless env
begin
check_fault(env.body)
rescue ::SOAP::FaultError => e
- Mapping.fault2exception(e)
+ op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
end
- op_info.create_response_obj(env, @mapping_registry,
- @literal_mapping_registry)
+ op_info.response_obj(env.body, @mapping_registry, @literal_mapping_registry)
+ end
+
+ def route(req_header, req_body, reqopt, resopt)
+ req_env = SOAPEnvelope.new(req_header, req_body)
+ reqopt[:external_content] = nil
+ conn_data = marshal(req_env, reqopt)
+ if ext = reqopt[:external_content]
+ mime = MIMEMessage.new
+ ext.each do |k, v|
+ mime.add_attachment(v.data)
+ end
+ mime.add_part(conn_data.send_string + "\r\n")
+ mime.close
+ conn_data.send_string = mime.content_str
+ conn_data.send_contenttype = mime.headers['content-type'].str
+ end
+ conn_data = @streamhandler.send(@endpoint_url, conn_data,
+ reqopt[:soapaction])
+ if conn_data.receive_string.empty?
+ return nil
+ end
+ unmarshal(conn_data, resopt)
end
def check_fault(body)
@@ -217,97 +228,202 @@ private
attr_reader :request_use
attr_reader :response_use
- def initialize(qname, soapaction, name, param_def, opt)
+ def initialize(soapaction, param_def, opt)
@soapaction = soapaction
@request_style = opt[:request_style]
@response_style = opt[:response_style]
@request_use = opt[:request_use]
@response_use = opt[:response_use]
- @rpc_method_factory = @document_method_name = nil
check_style(@request_style)
check_style(@response_style)
+ check_use(@request_use)
+ check_use(@response_use)
if @request_style == :rpc
- @rpc_method_factory = SOAPMethodRequest.new(qname, param_def,
- @soapaction)
+ @rpc_request_qname = opt[:request_qname]
+ if @rpc_request_qname.nil?
+ raise MethodDefinitionError.new("rpc_request_qname must be given")
+ end
+ @rpc_method_factory =
+ RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
else
- @document_method_name = {}
+ @doc_request_qnames = []
+ @doc_response_qnames = []
param_def.each do |inout, paramname, typeinfo|
- klass, namespace, name = typeinfo
- case inout.to_s
- when "input"
- @document_method_name[:input] = ::XSD::QName.new(namespace, name)
- when "output"
- @document_method_name[:output] = ::XSD::QName.new(namespace, name)
+ klass_not_used, nsdef, namedef = typeinfo
+ if namedef.nil?
+ raise MethodDefinitionError.new("qname must be given")
+ end
+ case inout
+ when SOAPMethod::IN
+ @doc_request_qnames << XSD::QName.new(nsdef, namedef)
+ when SOAPMethod::OUT
+ @doc_response_qnames << XSD::QName.new(nsdef, namedef)
else
- raise MethodDefinitionError, "unknown type: " + inout
+ raise MethodDefinitionError.new(
+ "illegal inout definition for document style: #{inout}")
end
end
end
end
def request_default_encodingstyle
- (@request_style == :rpc) ? EncodingNamespace : LiteralNamespace
+ (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
end
def response_default_encodingstyle
- (@response_style == :rpc) ? EncodingNamespace : LiteralNamespace
+ (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
end
- # for rpc
- def each_param_name(*target)
+ def request_body(values, mapping_registry, literal_mapping_registry)
if @request_style == :rpc
- @rpc_method_factory.each_param_name(*target) do |name|
- yield(name)
- end
+ request_rpc(values, mapping_registry, literal_mapping_registry)
else
- yield(@document_method_name[:input].name)
+ request_doc(values, mapping_registry, literal_mapping_registry)
end
end
- def create_request_body(values, mapping_registry, literal_mapping_registry)
- if @request_style == :rpc
- values = Mapping.obj2soap(values, mapping_registry).to_a
- method = @rpc_method_factory.dup
- params = {}
- idx = 0
- method.each_param_name(::SOAP::RPC::SOAPMethod::IN,
- ::SOAP::RPC::SOAPMethod::INOUT) do |name|
- params[name] = values[idx] || SOAPNil.new
- idx += 1
- end
- method.set_param(params)
- SOAPBody.new(method)
+ def response_obj(body, mapping_registry, literal_mapping_registry)
+ if @response_style == :rpc
+ response_rpc(body, mapping_registry, literal_mapping_registry)
else
- name = @document_method_name[:input]
- document = literal_mapping_registry.obj2soap(values[0], name)
- SOAPBody.new(document)
+ response_doc(body, mapping_registry, literal_mapping_registry)
end
end
- def create_response_obj(env, mapping_registry, literal_mapping_registry)
+ def raise_fault(e, mapping_registry, literal_mapping_registry)
if @response_style == :rpc
- ret = env.body.response ?
- Mapping.soap2obj(env.body.response, mapping_registry) : nil
- if env.body.outparams
- outparams = env.body.outparams.collect { |outparam|
- Mapping.soap2obj(outparam)
- }
- [ret].concat(outparams)
- else
- ret
- end
+ Mapping.fault2exception(e, mapping_registry)
else
- Mapping.soap2obj(env.body.root_node, literal_mapping_registry)
+ Mapping.fault2exception(e, literal_mapping_registry)
end
end
private
- ALLOWED_STYLE = [:rpc, :document]
def check_style(style)
- unless ALLOWED_STYLE.include?(style)
- raise MethodDefinitionError, "unknown style: " + style
+ unless [:rpc, :document].include?(style)
+ raise MethodDefinitionError.new("unknown style: #{style}")
+ end
+ end
+
+ def check_use(use)
+ unless [:encoded, :literal].include?(use)
+ raise MethodDefinitionError.new("unknown use: #{use}")
+ end
+ end
+
+ def request_rpc(values, mapping_registry, literal_mapping_registry)
+ if @request_use == :encoded
+ request_rpc_enc(values, mapping_registry)
+ else
+ request_rpc_lit(values, literal_mapping_registry)
+ end
+ end
+
+ def request_doc(values, mapping_registry, literal_mapping_registry)
+ if @request_use == :encoded
+ request_doc_enc(values, mapping_registry)
+ else
+ request_doc_lit(values, literal_mapping_registry)
+ end
+ end
+
+ def request_rpc_enc(values, mapping_registry)
+ method = @rpc_method_factory.dup
+ names = method.input_params
+ obj = create_request_obj(names, values)
+ soap = Mapping.obj2soap(obj, mapping_registry, @rpc_request_qname)
+ method.set_param(soap)
+ method
+ end
+
+ def request_rpc_lit(values, mapping_registry)
+ method = @rpc_method_factory.dup
+ params = {}
+ idx = 0
+ method.input_params.each do |name|
+ params[name] = Mapping.obj2soap(values[idx], mapping_registry,
+ XSD::QName.new(nil, name))
+ idx += 1
+ end
+ method.set_param(params)
+ method
+ end
+
+ def request_doc_enc(values, mapping_registry)
+ (0...values.size).collect { |idx|
+ ele = Mapping.obj2soap(values[idx], mapping_registry)
+ ele.elename = @doc_request_qnames[idx]
+ ele
+ }
+ end
+
+ def request_doc_lit(values, mapping_registry)
+ (0...values.size).collect { |idx|
+ ele = Mapping.obj2soap(values[idx], mapping_registry,
+ @doc_request_qnames[idx])
+ ele.encodingstyle = LiteralNamespace
+ ele
+ }
+ end
+
+ def response_rpc(body, mapping_registry, literal_mapping_registry)
+ if @response_use == :encoded
+ response_rpc_enc(body, mapping_registry)
+ else
+ response_rpc_lit(body, literal_mapping_registry)
+ end
+ end
+
+ def response_doc(body, mapping_registry, literal_mapping_registry)
+ if @response_use == :encoded
+ return *response_doc_enc(body, mapping_registry)
+ else
+ return *response_doc_lit(body, literal_mapping_registry)
+ end
+ end
+
+ def response_rpc_enc(body, mapping_registry)
+ ret = nil
+ if body.response
+ ret = Mapping.soap2obj(body.response, mapping_registry,
+ @rpc_method_factory.retval_class_name)
+ end
+ if body.outparams
+ outparams = body.outparams.collect { |outparam|
+ Mapping.soap2obj(outparam, mapping_regisry)
+ }
+ [ret].concat(outparams)
+ else
+ ret
+ end
+ end
+
+ def response_rpc_lit(body, mapping_registry)
+ body.root_node.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry,
+ @rpc_method_factory.retval_class_name)
+ }
+ end
+
+ def response_doc_enc(body, mapping_registry)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
+ end
+
+ def response_doc_lit(body, mapping_registry)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
+ end
+
+ def create_request_obj(names, params)
+ o = Object.new
+ for idx in 0 ... params.length
+ o.instance_variable_set('@' + names[idx], params[idx])
end
+ o
end
end
end
diff --git a/lib/soap/rpc/router.rb b/lib/soap/rpc/router.rb
index e9147af13a..1d11bc17dc 100644
--- a/lib/soap/rpc/router.rb
+++ b/lib/soap/rpc/router.rb
@@ -1,5 +1,5 @@
# SOAP4R - RPC Routing library
-# Copyright (C) 2001, 2002 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2001, 2002, 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -25,101 +25,229 @@ class Router
include SOAP
attr_reader :actor
- attr_accessor :allow_unqualified_element
- attr_accessor :default_encodingstyle
attr_accessor :mapping_registry
attr_accessor :literal_mapping_registry
- attr_reader :headerhandler
+ attr_accessor :generate_explicit_type
def initialize(actor)
@actor = actor
- @allow_unqualified_element = false
- @default_encodingstyle = nil
@mapping_registry = nil
@headerhandler = Header::HandlerSet.new
@literal_mapping_registry = ::SOAP::Mapping::WSDLLiteralRegistry.new
- @operation = {}
+ @generate_explicit_type = true
+ @operation_by_soapaction = {}
+ @operation_by_qname = {}
+ @headerhandlerfactory = []
end
- def add_rpc_method(receiver, qname, soapaction, name, param_def, opt = {})
- opt[:request_style] ||= :rpc
- opt[:response_style] ||= :rpc
- opt[:request_use] ||= :encoded
- opt[:response_use] ||= :encoded
- add_operation(qname, soapaction, receiver, name, param_def, opt)
+ ###
+ ## header handler interface
+ #
+ def add_request_headerhandler(factory)
+ unless factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ @headerhandlerfactory << factory
end
- def add_document_method(receiver, qname, soapaction, name, param_def, opt = {})
- opt[:request_style] ||= :document
- opt[:response_style] ||= :document
- opt[:request_use] ||= :encoded
- opt[:response_use] ||= :encoded
- if opt[:request_style] == :document
- inputdef = param_def.find { |inout, paramname, typeinfo| inout == "input" }
- klass, nsdef, namedef = inputdef[2]
- qname = ::XSD::QName.new(nsdef, namedef)
- end
- add_operation(qname, soapaction, receiver, name, param_def, opt)
+ def add_headerhandler(handler)
+ @headerhandler.add(handler)
end
- def add_operation(qname, soapaction, receiver, name, param_def, opt)
- @operation[fqname(qname)] = Operation.new(qname, soapaction, receiver,
- name, param_def, opt)
+ ###
+ ## servant definition interface
+ #
+ def add_rpc_request_servant(factory, namespace)
+ unless factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ obj = factory.create # a dummy instance for introspection
+ ::SOAP::RPC.defined_methods(obj).each do |name|
+ begin
+ qname = XSD::QName.new(namespace, name)
+ param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
+ opt = create_styleuse_option(:rpc, :encoded)
+ add_rpc_request_operation(factory, qname, nil, name, param_def, opt)
+ rescue SOAP::RPC::MethodDefinitionError => e
+ p e if $DEBUG
+ end
+ end
+ end
+
+ def add_rpc_servant(obj, namespace)
+ ::SOAP::RPC.defined_methods(obj).each do |name|
+ begin
+ qname = XSD::QName.new(namespace, name)
+ param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
+ opt = create_styleuse_option(:rpc, :encoded)
+ add_rpc_operation(obj, qname, nil, name, param_def, opt)
+ rescue SOAP::RPC::MethodDefinitionError => e
+ p e if $DEBUG
+ end
+ end
+ end
+ alias add_servant add_rpc_servant
+
+ ###
+ ## operation definition interface
+ #
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :rpc, :encoded)
+ opt[:request_qname] = qname
+ op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
+ opt)
+ if opt[:request_style] != :rpc
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, qname, op)
+ end
+ alias add_method add_rpc_operation
+ alias add_rpc_method add_rpc_operation
+
+ def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
+ ensure_styleuse_option(opt, :rpc, :encoded)
+ opt[:request_qname] = qname
+ op = RequestScopeOperation.new(soapaction, factory, name, param_def, opt)
+ if opt[:request_style] != :rpc
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, qname, op)
end
- # add_method is for shortcut of typical use="encoded" method definition.
- alias add_method add_rpc_method
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
+ #
+ # adopt workaround for doc/lit wrapper method
+ # (you should consider to simply use rpc/lit service)
+ #
+ #unless soapaction
+ # raise RPCRoutingError.new("soapaction is a must for document method")
+ #end
+ ensure_styleuse_option(opt, :document, :literal)
+ op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
+ opt)
+ if opt[:request_style] != :document
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, first_input_part_qname(param_def), op)
+ end
+ alias add_document_method add_document_operation
+
+ def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
+ #
+ # adopt workaround for doc/lit wrapper method
+ # (you should consider to simply use rpc/lit service)
+ #
+ #unless soapaction
+ # raise RPCRoutingError.new("soapaction is a must for document method")
+ #end
+ ensure_styleuse_option(opt, :document, :literal)
+ op = RequestScopeOperation.new(soapaction, receiver, name, param_def, opt)
+ if opt[:request_style] != :document
+ raise RPCRoutingError.new("illegal request_style given")
+ end
+ assign_operation(soapaction, first_input_part_qname(param_def), op)
+ end
def route(conn_data)
- soap_response = nil
+ # we cannot set request_default_encodingsyle before parsing the content.
+ env = unmarshal(conn_data)
+ if env.nil?
+ raise ArgumentError.new("illegal SOAP marshal format")
+ end
+ op = lookup_operation(conn_data.soapaction, env.body)
+ headerhandler = @headerhandler.dup
+ @headerhandlerfactory.each do |f|
+ headerhandler.add(f.create)
+ end
+ receive_headers(headerhandler, env.header)
+ soap_response = default_encodingstyle = nil
begin
- env = unmarshal(conn_data)
- if env.nil?
- raise ArgumentError.new("Illegal SOAP marshal format.")
- end
- receive_headers(env.header)
- request = env.body.request
- op = @operation[fqname(request.elename)]
- unless op
- raise RPCRoutingError.new("Method: #{request.elename} not supported.")
- end
- soap_response = op.call(request, @mapping_registry, @literal_mapping_registry)
+ soap_response =
+ op.call(env.body, @mapping_registry, @literal_mapping_registry)
+ default_encodingstyle = op.response_default_encodingstyle
rescue Exception
soap_response = fault($!)
- conn_data.is_fault = true
+ default_encodingstyle = nil
end
- marshal(conn_data, op, soap_response)
- conn_data
+ conn_data.is_fault = true if soap_response.is_a?(SOAPFault)
+ header = call_headers(headerhandler)
+ body = SOAPBody.new(soap_response)
+ env = SOAPEnvelope.new(header, body)
+ marshal(conn_data, env, default_encodingstyle)
end
# Create fault response string.
- def create_fault_response(e, charset = nil)
- header = SOAPHeader.new
- body = SOAPBody.new(fault(e))
- env = SOAPEnvelope.new(header, body)
- opt = options
+ def create_fault_response(e)
+ env = SOAPEnvelope.new(SOAPHeader.new, SOAPBody.new(fault(e)))
+ opt = {}
opt[:external_content] = nil
- opt[:charset] = charset
response_string = Processor.marshal(env, opt)
conn_data = StreamHandler::ConnectionData.new(response_string)
conn_data.is_fault = true
if ext = opt[:external_content]
- mime = MIMEMessage.new
- ext.each do |k, v|
- mime.add_attachment(v.data)
- end
- mime.add_part(conn_data.send_string + "\r\n")
- mime.close
- conn_data.send_string = mime.content_str
- conn_data.send_contenttype = mime.headers['content-type'].str
+ mimeize(conn_data, ext)
end
conn_data
end
private
- def call_headers
- headers = @headerhandler.on_outbound
+ def first_input_part_qname(param_def)
+ param_def.each do |inout, paramname, typeinfo|
+ if inout == SOAPMethod::IN
+ klass, nsdef, namedef = typeinfo
+ return XSD::QName.new(nsdef, namedef)
+ end
+ end
+ nil
+ end
+
+ def create_styleuse_option(style, use)
+ opt = {}
+ opt[:request_style] = opt[:response_style] = style
+ opt[:request_use] = opt[:response_use] = use
+ opt
+ end
+
+ def ensure_styleuse_option(opt, style, use)
+ opt[:request_style] ||= style
+ opt[:response_style] ||= style
+ opt[:request_use] ||= use
+ opt[:response_use] ||= use
+ end
+
+ def assign_operation(soapaction, qname, op)
+ assigned = false
+ if soapaction and !soapaction.empty?
+ @operation_by_soapaction[soapaction] = op
+ assigned = true
+ end
+ if qname
+ @operation_by_qname[qname] = op
+ assigned = true
+ end
+ unless assigned
+ raise RPCRoutingError.new("cannot assign operation")
+ end
+ end
+
+ def lookup_operation(soapaction, body)
+ if op = @operation_by_soapaction[soapaction]
+ return op
+ end
+ qname = body.root_node.elename
+ if op = @operation_by_qname[qname]
+ return op
+ end
+ if soapaction
+ raise RPCRoutingError.new("operation: #{soapaction} not supported")
+ else
+ raise RPCRoutingError.new("operation: #{qname} not supported")
+ end
+ end
+
+ def call_headers(headerhandler)
+ headers = headerhandler.on_outbound
if headers.empty?
nil
else
@@ -131,17 +259,17 @@ private
end
end
- def receive_headers(headers)
- @headerhandler.on_inbound(headers) if headers
+ def receive_headers(headerhandler, headers)
+ headerhandler.on_inbound(headers) if headers
end
def unmarshal(conn_data)
- opt = options
+ opt = {}
contenttype = conn_data.receive_contenttype
if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
opt[:external_content] = {}
mime = MIMEMessage.parse("Content-Type: " + contenttype,
- conn_data.receive_string)
+ conn_data.receive_string)
mime.parts.each do |part|
value = Attachment.new(part.content)
value.contentid = part.contentid
@@ -160,28 +288,29 @@ private
env
end
- def marshal(conn_data, op, soap_response)
- response_opt = options
- response_opt[:external_content] = nil
- if op and !conn_data.is_fault and op.response_use == :document
- response_opt[:default_encodingstyle] =
- ::SOAP::EncodingStyle::ASPDotNetHandler::Namespace
- end
- header = call_headers
- body = SOAPBody.new(soap_response)
- env = SOAPEnvelope.new(header, body)
- response_string = Processor.marshal(env, response_opt)
+ def marshal(conn_data, env, default_encodingstyle = nil)
+ opt = {}
+ opt[:external_content] = nil
+ opt[:default_encodingstyle] = default_encodingstyle
+ opt[:generate_explicit_type] = @generate_explicit_type
+ response_string = Processor.marshal(env, opt)
conn_data.send_string = response_string
- if ext = response_opt[:external_content]
- mime = MIMEMessage.new
- ext.each do |k, v|
- mime.add_attachment(v.data)
- end
- mime.add_part(conn_data.send_string + "\r\n")
- mime.close
- conn_data.send_string = mime.content_str
- conn_data.send_contenttype = mime.headers['content-type'].str
+ if ext = opt[:external_content]
+ mimeize(conn_data, ext)
end
+ conn_data
+ end
+
+ def mimeize(conn_data, ext)
+ mime = MIMEMessage.new
+ ext.each do |k, v|
+ mime.add_attachment(v.data)
+ end
+ mime.add_part(conn_data.send_string + "\r\n")
+ mime.close
+ conn_data.send_string = mime.content_str
+ conn_data.send_contenttype = mime.headers['content-type'].str
+ conn_data
end
# Create fault response.
@@ -194,84 +323,156 @@ private
Mapping.obj2soap(detail, @mapping_registry))
end
- def fqname(qname)
- "#{ qname.namespace }:#{ qname.name }"
- end
-
- def options
- opt = {}
- opt[:default_encodingstyle] = @default_encodingstyle
- if @allow_unqualified_element
- opt[:allow_unqualified_element] = true
- end
- opt
- end
-
class Operation
- attr_reader :receiver
attr_reader :name
attr_reader :soapaction
attr_reader :request_style
attr_reader :response_style
attr_reader :request_use
attr_reader :response_use
-
- def initialize(qname, soapaction, receiver, name, param_def, opt)
+
+ def initialize(soapaction, name, param_def, opt)
@soapaction = soapaction
- @receiver = receiver
@name = name
@request_style = opt[:request_style]
@response_style = opt[:response_style]
@request_use = opt[:request_use]
@response_use = opt[:response_use]
+ check_style(@request_style)
+ check_style(@response_style)
+ check_use(@request_use)
+ check_use(@response_use)
if @response_style == :rpc
- @rpc_response_factory =
- RPC::SOAPMethodRequest.new(qname, param_def, @soapaction)
+ request_qname = opt[:request_qname] or raise
+ @rpc_method_factory =
+ RPC::SOAPMethodRequest.new(request_qname, param_def, @soapaction)
+ @rpc_response_qname = opt[:response_qname]
else
- outputdef = param_def.find { |inout, paramname, typeinfo| inout == "output" }
- klass, nsdef, namedef = outputdef[2]
- @document_response_qname = ::XSD::QName.new(nsdef, namedef)
+ @doc_request_qnames = []
+ @doc_response_qnames = []
+ param_def.each do |inout, paramname, typeinfo|
+ klass, nsdef, namedef = typeinfo
+ case inout
+ when SOAPMethod::IN
+ @doc_request_qnames << XSD::QName.new(nsdef, namedef)
+ when SOAPMethod::OUT
+ @doc_response_qnames << XSD::QName.new(nsdef, namedef)
+ else
+ raise ArgumentError.new(
+ "illegal inout definition for document style: #{inout}")
+ end
+ end
end
end
- def call(request, mapping_registry, literal_mapping_registry)
+ def request_default_encodingstyle
+ (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def response_default_encodingstyle
+ (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
+ end
+
+ def call(body, mapping_registry, literal_mapping_registry)
if @request_style == :rpc
- param = Mapping.soap2obj(request, mapping_registry)
- result = rpc_call(request, param)
+ values = request_rpc(body, mapping_registry, literal_mapping_registry)
else
- param = Mapping.soap2obj(request, literal_mapping_registry)
- result = document_call(request, param)
+ values = request_document(body, mapping_registry, literal_mapping_registry)
end
+ result = receiver.method(@name.intern).call(*values)
+ return result if result.is_a?(SOAPFault)
if @response_style == :rpc
- rpc_response(result, mapping_registry)
+ response_rpc(result, mapping_registry, literal_mapping_registry)
else
- document_response(result, literal_mapping_registry)
+ response_doc(result, mapping_registry, literal_mapping_registry)
end
end
private
- def rpc_call(request, param)
+ def receiver
+ raise NotImplementedError.new('must be defined in derived class')
+ end
+
+ def request_rpc(body, mapping_registry, literal_mapping_registry)
+ request = body.request
unless request.is_a?(SOAPStruct)
- raise RPCRoutingError.new("Not an RPC style.")
+ raise RPCRoutingError.new("not an RPC style")
end
- values = request.collect { |key, value| param[key] }
- @receiver.method(@name.intern).call(*values)
+ if @request_use == :encoded
+ request_rpc_enc(request, mapping_registry)
+ else
+ request_rpc_lit(request, literal_mapping_registry)
+ end
+ end
+
+ def request_document(body, mapping_registry, literal_mapping_registry)
+ # ToDo: compare names with @doc_request_qnames
+ if @request_use == :encoded
+ request_doc_enc(body, mapping_registry)
+ else
+ request_doc_lit(body, literal_mapping_registry)
+ end
+ end
+
+ def request_rpc_enc(request, mapping_registry)
+ param = Mapping.soap2obj(request, mapping_registry)
+ request.collect { |key, value|
+ param[key]
+ }
end
- def document_call(request, param)
- @receiver.method(@name.intern).call(param)
+ def request_rpc_lit(request, mapping_registry)
+ request.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
end
- def rpc_response(result, mapping_registry)
- soap_response = @rpc_response_factory.create_method_response
+ def request_doc_enc(body, mapping_registry)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
+ end
+
+ def request_doc_lit(body, mapping_registry)
+ body.collect { |key, value|
+ Mapping.soap2obj(value, mapping_registry)
+ }
+ end
+
+ def response_rpc(result, mapping_registry, literal_mapping_registry)
+ if @response_use == :encoded
+ response_rpc_enc(result, mapping_registry)
+ else
+ response_rpc_lit(result, literal_mapping_registry)
+ end
+ end
+
+ def response_doc(result, mapping_registry, literal_mapping_registry)
+ if @doc_response_qnames.size == 1 and !result.is_a?(Array)
+ result = [result]
+ end
+ if result.size != @doc_response_qnames.size
+ raise "required #{@doc_response_qnames.size} responses " +
+ "but #{result.size} given"
+ end
+ if @response_use == :encoded
+ response_doc_enc(result, mapping_registry)
+ else
+ response_doc_lit(result, literal_mapping_registry)
+ end
+ end
+
+ def response_rpc_enc(result, mapping_registry)
+ soap_response =
+ @rpc_method_factory.create_method_response(@rpc_response_qname)
if soap_response.have_outparam?
unless result.is_a?(Array)
- raise RPCRoutingError.new("Out parameter was not returned.")
+ raise RPCRoutingError.new("out parameter was not returned")
end
outparams = {}
i = 1
- soap_response.each_param_name('out', 'inout') do |outparam|
+ soap_response.output_params.each do |outparam|
outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry)
i += 1
end
@@ -283,8 +484,83 @@ private
soap_response
end
- def document_response(result, literal_mapping_registry)
- literal_mapping_registry.obj2soap(result, @document_response_qname)
+ def response_rpc_lit(result, mapping_registry)
+ soap_response =
+ @rpc_method_factory.create_method_response(@rpc_response_qname)
+ if soap_response.have_outparam?
+ unless result.is_a?(Array)
+ raise RPCRoutingError.new("out parameter was not returned")
+ end
+ outparams = {}
+ i = 1
+ soap_response.output_params.each do |outparam|
+ outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry,
+ XSD::QName.new(nil, outparam))
+ i += 1
+ end
+ soap_response.set_outparam(outparams)
+ soap_response.retval = Mapping.obj2soap(result[0], mapping_registry,
+ XSD::QName.new(nil, soap_response.elename))
+ else
+ soap_response.retval = Mapping.obj2soap(result, mapping_registry,
+ XSD::QName.new(nil, soap_response.elename))
+ end
+ soap_response
+ end
+
+ def response_doc_enc(result, mapping_registry)
+ (0...result.size).collect { |idx|
+ ele = Mapping.obj2soap(result[idx], mapping_registry)
+ ele.elename = @doc_response_qnames[idx]
+ ele
+ }
+ end
+
+ def response_doc_lit(result, mapping_registry)
+ (0...result.size).collect { |idx|
+ mapping_registry.obj2soap(result[idx], @doc_response_qnames[idx])
+ }
+ end
+
+ def check_style(style)
+ unless [:rpc, :document].include?(style)
+ raise ArgumentError.new("unknown style: #{style}")
+ end
+ end
+
+ def check_use(use)
+ unless [:encoded, :literal].include?(use)
+ raise ArgumentError.new("unknown use: #{use}")
+ end
+ end
+ end
+
+ class ApplicationScopeOperation < Operation
+ def initialize(soapaction, receiver, name, param_def, opt)
+ super(soapaction, name, param_def, opt)
+ @receiver = receiver
+ end
+
+ private
+
+ def receiver
+ @receiver
+ end
+ end
+
+ class RequestScopeOperation < Operation
+ def initialize(soapaction, receiver_factory, name, param_def, opt)
+ super(soapaction, name, param_def, opt)
+ unless receiver_factory.respond_to?(:create)
+ raise TypeError.new("factory must respond to 'create'")
+ end
+ @receiver_factory = receiver_factory
+ end
+
+ private
+
+ def receiver
+ @receiver_factory.create
end
end
end
diff --git a/lib/soap/rpc/soaplet.rb b/lib/soap/rpc/soaplet.rb
index 8f18c53d3a..4d2538f0b3 100644
--- a/lib/soap/rpc/soaplet.rb
+++ b/lib/soap/rpc/soaplet.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP handler servlet for WEBrick
-# Copyright (C) 2001, 2002, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2001-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -14,7 +14,23 @@ begin
require 'stringio'
require 'zlib'
rescue LoadError
- STDERR.puts "Loading stringio or zlib failed. No gzipped response support." if $DEBUG
+ warn("Loading stringio or zlib failed. No gzipped response supported.") if $DEBUG
+end
+
+
+warn("Overriding WEBrick::Log#debug") if $DEBUG
+require 'webrick/log'
+module WEBrick
+ class Log < BasicLog
+ alias __debug debug
+ def debug(msg = nil)
+ if block_given? and msg.nil?
+ __debug(yield)
+ else
+ __debug(msg)
+ end
+ end
+ end
end
@@ -24,60 +40,27 @@ module RPC
class SOAPlet < WEBrick::HTTPServlet::AbstractServlet
public
- attr_reader :app_scope_router
attr_reader :options
- def initialize
- @rpc_router_map = {}
- @app_scope_router = ::SOAP::RPC::Router.new(self.class.name)
- @headerhandlerfactory = []
- @app_scope_headerhandler = nil
+ def initialize(router = nil)
+ @router = router || ::SOAP::RPC::Router.new(self.class.name)
@options = {}
+ @config = {}
end
- def allow_content_encoding_gzip=(allow)
- @options[:allow_content_encoding_gzip] = allow
- end
-
- # Add servant factory whose object has request scope. A servant object is
- # instanciated for each request.
- #
- # Bear in mind that servant factories are distinguished by HTTP SOAPAction
- # header in request. Client which calls request-scoped servant must have a
- # SOAPAction header which is a namespace of the servant factory.
- # I mean, use Driver#add_method_with_soapaction instead of Driver#add_method
- # at client side.
- #
- # A factory must respond to :create.
- #
- def add_rpc_request_servant(factory, namespace, mapping_registry = nil)
- unless factory.respond_to?(:create)
- raise TypeError.new("factory must respond to 'create'")
- end
- router = setup_rpc_request_router(namespace)
- router.factory = factory
- router.mapping_registry = mapping_registry
- end
-
- # Add servant object which has application scope.
- def add_rpc_servant(obj, namespace)
- router = @app_scope_router
- SOAPlet.add_rpc_servant_to_router(router, obj, namespace)
- add_rpc_router(namespace, router)
+ # for backward compatibility
+ def app_scope_router
+ @router
end
- alias add_servant add_rpc_servant
- def add_rpc_request_headerhandler(factory)
- unless factory.respond_to?(:create)
- raise TypeError.new("factory must respond to 'create'")
- end
- @headerhandlerfactory << factory
+ # for backward compatibility
+ def add_servant(obj, namespace)
+ @router.add_rpc_servant(obj, namespace)
end
- def add_rpc_headerhandler(obj)
- @app_scope_headerhandler = obj
+ def allow_content_encoding_gzip=(allow)
+ @options[:allow_content_encoding_gzip] = allow
end
- alias add_headerhandler add_rpc_headerhandler
###
## Servlet interfaces for WEBrick.
@@ -93,111 +76,63 @@ public
def do_GET(req, res)
res.header['Allow'] = 'POST'
- raise WEBrick::HTTPStatus::MethodNotAllowed, "GET request not allowed."
+ raise WEBrick::HTTPStatus::MethodNotAllowed, "GET request not allowed"
end
def do_POST(req, res)
- @config[:Logger].debug { "SOAP request: " + req.body }
- soapaction = parse_soapaction(req.meta_vars['HTTP_SOAPACTION'])
- router = lookup_router(soapaction)
- with_headerhandler(router) do |router|
- begin
- conn_data = ::SOAP::StreamHandler::ConnectionData.new
- conn_data.receive_string = req.body
- conn_data.receive_contenttype = req['content-type']
- conn_data = router.route(conn_data)
- res['content-type'] = conn_data.send_contenttype
- if conn_data.is_fault
- res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
- end
- if outstring = encode_gzip(req, conn_data.send_string)
- res['content-encoding'] = 'gzip'
- res['content-length'] = outstring.size
- res.body = outstring
- else
- res.body = conn_data.send_string
- end
- rescue Exception => e
- conn_data = router.create_fault_response(e)
- res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
- res.body = conn_data.send_string
- res['content-type'] = conn_data.send_contenttype || "text/xml"
- end
+ logger.debug { "SOAP request: " + req.body } if logger
+ begin
+ conn_data = ::SOAP::StreamHandler::ConnectionData.new
+ setup_req(conn_data, req)
+ conn_data = @router.route(conn_data)
+ setup_res(conn_data, req, res)
+ rescue Exception => e
+ conn_data = @router.create_fault_response(e)
+ res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
+ res.body = conn_data.send_string
+ res['content-type'] = conn_data.send_contenttype || "text/xml"
end
-
if res.body.is_a?(IO)
res.chunked = true
- @config[:Logger].debug { "SOAP response: (chunked response not logged)" }
+ logger.debug { "SOAP response: (chunked response not logged)" } if logger
else
- @config[:Logger].debug { "SOAP response: " + res.body }
+ logger.debug { "SOAP response: " + res.body } if logger
end
end
private
- class RequestRouter < ::SOAP::RPC::Router
- attr_accessor :factory
-
- def initialize(style = :rpc, namespace = nil)
- super(namespace)
- @style = style
- @namespace = namespace
- @factory = nil
- end
-
- def route(soap_string)
- obj = @factory.create
- namespace = self.actor
- router = ::SOAP::RPC::Router.new(@namespace)
- if @style == :rpc
- SOAPlet.add_rpc_servant_to_router(router, obj, namespace)
- else
- raise RuntimeError.new("'document' style not supported.")
- end
- router.route(soap_string)
- end
- end
-
- def setup_rpc_request_router(namespace)
- router = @rpc_router_map[namespace] || RequestRouter.new(:rpc, namespace)
- add_rpc_router(namespace, router)
- router
+ def logger
+ @config[:Logger]
end
- def add_rpc_router(namespace, router)
- @rpc_router_map[namespace] = router
+ def setup_req(conn_data, req)
+ conn_data.receive_string = req.body
+ conn_data.receive_contenttype = req['content-type']
+ conn_data.soapaction = parse_soapaction(req.meta_vars['HTTP_SOAPACTION'])
end
- def parse_soapaction(soapaction)
- if /^"(.*)"$/ =~ soapaction
- soapaction = $1
- end
- if soapaction.empty?
- return nil
+ def setup_res(conn_data, req, res)
+ res['content-type'] = conn_data.send_contenttype
+ if conn_data.is_fault
+ res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
end
- soapaction
- end
-
- def lookup_router(namespace)
- if namespace
- @rpc_router_map[namespace] || @app_scope_router
+ if outstring = encode_gzip(req, conn_data.send_string)
+ res['content-encoding'] = 'gzip'
+ res['content-length'] = outstring.size
+ res.body = outstring
else
- @app_scope_router
+ res.body = conn_data.send_string
end
end
- def with_headerhandler(router)
- if @app_scope_headerhandler and
- !router.headerhandler.include?(@app_scope_headerhandler)
- router.headerhandler.add(@app_scope_headerhandler)
- end
- handlers = @headerhandlerfactory.collect { |f| f.create }
- begin
- handlers.each { |h| router.headerhandler.add(h) }
- yield(router)
- ensure
- handlers.each { |h| router.headerhandler.delete(h) }
+ def parse_soapaction(soapaction)
+ if !soapaction.nil? and !soapaction.empty?
+ if /^"(.+)"$/ =~ soapaction
+ return $1
+ end
end
+ nil
end
def encode_gzip(req, outstring)
@@ -219,32 +154,6 @@ private
req['accept-encoding'] and
req['accept-encoding'].split(/,\s*/).include?('gzip')
end
-
- class << self
- public
- def add_rpc_servant_to_router(router, obj, namespace)
- ::SOAP::RPC.defined_methods(obj).each do |name|
- begin
- add_rpc_servant_method_to_router(router, obj, namespace, name)
- rescue SOAP::RPC::MethodDefinitionError => e
- p e if $DEBUG
- end
- end
- end
-
- def add_rpc_servant_method_to_router(router, obj, namespace, name,
- style = :rpc, use = :encoded)
- qname = XSD::QName.new(namespace, name)
- soapaction = nil
- method = obj.method(name)
- param_def = ::SOAP::RPC::SOAPMethod.create_param_def(
- (1..method.arity.abs).collect { |i| "p#{ i }" })
- opt = {}
- opt[:request_style] = opt[:response_style] = style
- opt[:request_use] = opt[:response_use] = use
- router.add_operation(qname, soapaction, obj, name, param_def, opt)
- end
- end
end
diff --git a/lib/soap/soap.rb b/lib/soap/soap.rb
index 66ef1454a3..0072a8dcf0 100644
--- a/lib/soap/soap.rb
+++ b/lib/soap/soap.rb
@@ -13,7 +13,7 @@ require 'xsd/charset'
module SOAP
-Version = '1.5.3-ruby1.8.2'
+VERSION = Version = '1.5.4'
PropertyName = 'soap/property'
EnvelopeNamespace = 'http://schemas.xmlsoap.org/soap/envelope/'
@@ -75,6 +75,7 @@ class ArrayIndexOutOfBoundsError < Error; end
class ArrayStoreError < Error; end
class RPCRoutingError < Error; end
+class EmptyResponseError < Error; end
class UnhandledMustUnderstandHeaderError < Error; end
@@ -101,6 +102,7 @@ class FaultError < Error
end
end
+
module Env
def self.getenv(name)
ENV[name.downcase] || ENV[name.upcase]
@@ -113,3 +115,25 @@ end
end
+
+
+unless Object.respond_to?(:instance_variable_get)
+ class Object
+ def instance_variable_get(ivarname)
+ instance_eval(ivarname)
+ end
+
+ def instance_variable_set(ivarname, value)
+ instance_eval("#{ivarname} = value")
+ end
+ end
+end
+
+
+unless Kernel.respond_to?(:warn)
+ module Kernel
+ def warn(msg)
+ STDERR.puts(msg + "\n") unless $VERBOSE.nil?
+ end
+ end
+end
diff --git a/lib/soap/streamHandler.rb b/lib/soap/streamHandler.rb
index ac2f54d5c9..3890ac263f 100644
--- a/lib/soap/streamHandler.rb
+++ b/lib/soap/streamHandler.rb
@@ -7,12 +7,12 @@
require 'soap/soap'
-require 'soap/property'
+require 'soap/httpconfigloader'
begin
require 'stringio'
require 'zlib'
rescue LoadError
- STDERR.puts "Loading stringio or zlib failed. No gzipped response support." if $DEBUG
+ warn("Loading stringio or zlib failed. No gzipped response support.") if $DEBUG
end
@@ -27,7 +27,7 @@ class StreamHandler
end
HTTPAccess2::Client
rescue LoadError
- STDERR.puts "Loading http-access2 failed. Net/http is used." if $DEBUG
+ warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
require 'soap/netHttpClient'
SOAP::NetHttpClient
end
@@ -40,6 +40,7 @@ class StreamHandler
attr_accessor :receive_string
attr_accessor :receive_contenttype
attr_accessor :is_fault
+ attr_accessor :soapaction
def initialize(send_string = nil)
@send_string = send_string
@@ -47,6 +48,7 @@ class StreamHandler
@receive_string = nil
@receive_contenttype = nil
@is_fault = false
+ @soapaction = nil
end
end
@@ -79,7 +81,7 @@ public
super()
@client = Client.new(nil, "SOAP4R/#{ Version }")
@wiredump_file_base = nil
- @charset = @wiredump_dev = @nil
+ @charset = @wiredump_dev = nil
@options = options
set_options
@client.debug_dev = @wiredump_dev
@@ -100,7 +102,8 @@ public
end
def send(endpoint_url, conn_data, soapaction = nil, charset = @charset)
- send_post(endpoint_url, conn_data, soapaction, charset)
+ conn_data.soapaction ||= soapaction # for backward conpatibility
+ send_post(endpoint_url, conn_data, charset)
end
def reset(endpoint_url = nil)
@@ -115,24 +118,7 @@ public
private
def set_options
- @client.proxy = @options["proxy"]
- @options.add_hook("proxy") do |key, value|
- @client.proxy = value
- end
- @client.no_proxy = @options["no_proxy"]
- @options.add_hook("no_proxy") do |key, value|
- @client.no_proxy = value
- end
- if @client.respond_to?(:protocol_version=)
- @client.protocol_version = @options["protocol_version"]
- @options.add_hook("protocol_version") do |key, value|
- @client.protocol_version = value
- end
- end
- set_cookie_store_file(@options["cookie_store_file"])
- @options.add_hook("cookie_store_file") do |key, value|
- set_cookie_store_file(value)
- end
+ HTTPConfigLoader.set_options(@client, @options)
@charset = @options["charset"] || XSD::Charset.charset_label($KCODE)
@options.add_hook("charset") do |key, value|
@charset = value
@@ -142,96 +128,23 @@ private
@wiredump_dev = value
@client.debug_dev = @wiredump_dev
end
- ssl_config = @options["ssl_config"] ||= ::SOAP::Property.new
- set_ssl_config(ssl_config)
- ssl_config.add_hook(true) do |key, value|
- set_ssl_config(ssl_config)
- end
- basic_auth = @options["basic_auth"] ||= ::SOAP::Property.new
- set_basic_auth(basic_auth)
- basic_auth.add_hook do |key, value|
- set_basic_auth(basic_auth)
- end
- @options.add_hook("connect_timeout") do |key, value|
- @client.connect_timeout = value
- end
- @options.add_hook("send_timeout") do |key, value|
- @client.send_timeout = value
- end
- @options.add_hook("receive_timeout") do |key, value|
- @client.receive_timeout = value
+ set_cookie_store_file(@options["cookie_store_file"])
+ @options.add_hook("cookie_store_file") do |key, value|
+ set_cookie_store_file(value)
end
+ ssl_config = @options["ssl_config"]
+ basic_auth = @options["basic_auth"]
@options.lock(true)
ssl_config.unlock
basic_auth.unlock
end
- def set_basic_auth(basic_auth)
- basic_auth.values.each do |url, userid, passwd|
- @client.set_basic_auth(url, userid, passwd)
- end
- end
-
def set_cookie_store_file(value)
@cookie_store = value
@client.set_cookie_store(@cookie_store) if @cookie_store
end
- def set_ssl_config(ssl_config)
- ssl_config.each do |key, value|
- cfg = @client.ssl_config
- case key
- when 'client_cert'
- cfg.client_cert = cert_from_file(value)
- when 'client_key'
- cfg.client_key = key_from_file(value)
- when 'client_ca'
- cfg.client_ca = value
- when 'ca_path'
- cfg.set_trust_ca(value)
- when 'ca_file'
- cfg.set_trust_ca(value)
- when 'crl'
- cfg.set_crl(value)
- when 'verify_mode'
- cfg.verify_mode = ssl_config_int(value)
- when 'verify_depth'
- cfg.verify_depth = ssl_config_int(value)
- when 'options'
- cfg.options = value
- when 'ciphers'
- cfg.ciphers = value
- when 'verify_callback'
- cfg.verify_callback = value
- when 'cert_store'
- cfg.cert_store = value
- else
- raise ArgumentError.new("unknown ssl_config property #{key}")
- end
- end
- end
-
- def ssl_config_int(value)
- if value.nil? or value.empty?
- nil
- else
- begin
- Integer(value)
- rescue ArgumentError
- ::SOAP::Property::Util.const_from_name(value)
- end
- end
- end
-
- def cert_from_file(filename)
- OpenSSL::X509::Certificate.new(File.open(filename) { |f| f.read })
- end
-
- def key_from_file(filename)
- OpenSSL::PKey::RSA.new(File.open(filename) { |f| f.read })
- end
-
- def send_post(endpoint_url, conn_data, soapaction, charset)
+ def send_post(endpoint_url, conn_data, charset)
conn_data.send_contenttype ||= StreamHandler.create_media_type(charset)
if @wiredump_file_base
@@ -243,7 +156,7 @@ private
extra = {}
extra['Content-Type'] = conn_data.send_contenttype
- extra['SOAPAction'] = "\"#{ soapaction }\""
+ extra['SOAPAction'] = "\"#{ conn_data.soapaction }\""
extra['Accept-Encoding'] = 'gzip' if send_accept_encoding_gzip?
send_string = conn_data.send_string
@wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
diff --git a/lib/soap/wsdlDriver.rb b/lib/soap/wsdlDriver.rb
index f13aa94f94..3431d5d673 100644
--- a/lib/soap/wsdlDriver.rb
+++ b/lib/soap/wsdlDriver.rb
@@ -1,5 +1,5 @@
# SOAP4R - SOAP WSDL driver
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -9,19 +9,11 @@
require 'wsdl/parser'
require 'wsdl/importer'
require 'xsd/qname'
-require 'soap/element'
-require 'soap/baseData'
-require 'soap/streamHandler'
-require 'soap/mimemessage'
-require 'soap/mapping'
+require 'xsd/codegen/gensupport'
require 'soap/mapping/wsdlencodedregistry'
require 'soap/mapping/wsdlliteralregistry'
-require 'soap/rpc/rpc'
-require 'soap/rpc/element'
-require 'soap/rpc/proxy'
-require 'soap/processor'
-require 'soap/header/handlerset'
-require 'xsd/codegen/gensupport'
+require 'soap/rpc/driver'
+require 'wsdl/soap/methodDefCreator'
module SOAP
@@ -32,60 +24,165 @@ class WSDLDriverFactory
attr_reader :wsdl
- def initialize(wsdl, logdev = nil)
- @logdev = logdev
+ def initialize(wsdl)
@wsdl = import(wsdl)
+ @methoddefcreator = WSDL::SOAP::MethodDefCreator.new(@wsdl)
end
def inspect
"#<#{self.class}:#{@wsdl.name}>"
end
+ def create_rpc_driver(servicename = nil, portname = nil)
+ port = find_port(servicename, portname)
+ drv = SOAP::RPC::Driver.new(port.soap_address.location)
+ init_driver(drv, port)
+ add_operation(drv, port)
+ drv
+ end
+
+ # depricated old interface
def create_driver(servicename = nil, portname = nil)
- service = if servicename
- @wsdl.service(XSD::QName.new(@wsdl.targetnamespace, servicename))
- else
- @wsdl.services[0]
- end
+ warn("WSDLDriverFactory#create_driver is depricated. Use create_rpc_driver instead.")
+ port = find_port(servicename, portname)
+ WSDLDriver.new(@wsdl, port, @logdev)
+ end
+
+ # Backward compatibility.
+ alias createDriver create_driver
+
+private
+
+ def find_port(servicename = nil, portname = nil)
+ service = port = nil
+ if servicename
+ service = @wsdl.service(
+ XSD::QName.new(@wsdl.targetnamespace, servicename))
+ else
+ service = @wsdl.services[0]
+ end
if service.nil?
- raise FactoryError.new("Service #{ servicename } not found in WSDL.")
+ raise FactoryError.new("service #{servicename} not found in WSDL")
+ end
+ if portname
+ port = service.ports[XSD::QName.new(@wsdl.targetnamespace, portname)]
+ else
+ port = service.ports[0]
end
- port = if portname
- service.ports[XSD::QName.new(@wsdl.targetnamespace, portname)]
- else
- service.ports[0]
- end
if port.nil?
- raise FactoryError.new("Port #{ portname } not found in WSDL.")
+ raise FactoryError.new("port #{portname} not found in WSDL")
end
if port.soap_address.nil?
- raise FactoryError.new("soap:address element not found in WSDL.")
+ raise FactoryError.new("soap:address element not found in WSDL")
end
- WSDLDriver.new(@wsdl, port, @logdev)
+ port
end
- # Backward compatibility.
- alias createDriver create_driver
+ def init_driver(drv, port)
+ wsdl_elements = @wsdl.collect_elements
+ wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
+ rpc_decode_typemap = wsdl_types +
+ @wsdl.soap_rpc_complextypes(port.find_binding)
+ drv.proxy.mapping_registry =
+ Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap)
+ drv.proxy.literal_mapping_registry =
+ Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements)
+ end
+
+ def add_operation(drv, port)
+ port.find_binding.operations.each do |op_bind|
+ op_name = op_bind.soapoperation_name
+ soapaction = op_bind.soapaction || ''
+ orgname = op_name.name
+ name = XSD::CodeGen::GenSupport.safemethodname(orgname)
+ param_def = create_param_def(op_bind)
+ opt = {}
+ opt[:request_style] = opt[:response_style] = op_bind.soapoperation_style
+ opt[:request_use] = (op_bind.input.soapbody.use || 'literal').intern
+ opt[:response_use] = (op_bind.output.soapbody.use || 'literal').intern
+ if op_bind.soapoperation_style == :rpc
+ drv.add_rpc_operation(op_name, soapaction, name, param_def, opt)
+ else
+ drv.add_document_operation(soapaction, name, param_def, opt)
+ end
+ if orgname != name and orgname.capitalize == name.capitalize
+ ::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg|
+ __send__(name, *arg)
+ end
+ end
+ end
+ end
-private
-
def import(location)
WSDL::Importer.import(location)
end
+
+ def create_param_def(op_bind)
+ op = op_bind.find_operation
+ if op_bind.soapoperation_style == :rpc
+ param_def = @methoddefcreator.collect_rpcparameter(op)
+ else
+ param_def = @methoddefcreator.collect_documentparameter(op)
+ end
+ # the first element of typedef in param_def is a String like
+ # "::SOAP::SOAPStruct". turn this String to a class.
+ param_def.collect { |io, typedef, name|
+ typedef[0] = Mapping.class_from_name(typedef[0])
+ [io, name, typedef]
+ }
+ end
+
+ def partqname(part)
+ if part.type
+ part.type
+ else
+ part.element
+ end
+ end
+
+ def param_def(type, name, klass, partqname)
+ [type, name, [klass, partqname.namespace, partqname.name]]
+ end
+
+ def filter_parts(partsdef, partssource)
+ parts = partsdef.split(/\s+/)
+ partssource.find_all { |part| parts.include?(part.name) }
+ end
end
class WSDLDriver
class << self
def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- self.__send__(:define_method, name, proc {
- @servant.__send__(name)
- })
- if assignable
- self.__send__(:define_method, name + '=', proc { |rhs|
- @servant.__send__(name + '=', rhs)
+ end
+
+ if RUBY_VERSION >= "1.7.0"
+ def __attr_proxy(symbol, assignable = false)
+ name = symbol.to_s
+ self.__send__(:define_method, name, proc {
+ @servant.__send__(name)
})
+ if assignable
+ self.__send__(:define_method, name + '=', proc { |rhs|
+ @servant.__send__(name + '=', rhs)
+ })
+ end
+ end
+ else
+ def __attr_proxy(symbol, assignable = false)
+ name = symbol.to_s
+ module_eval <<-EOS
+ def #{name}
+ @servant.#{name}
+ end
+ EOS
+ if assignable
+ module_eval <<-EOS
+ def #{name}=(value)
+ @servant.#{name} = value
+ end
+ EOS
+ end
end
end
end
@@ -179,8 +276,10 @@ class WSDLDriver
@wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
@rpc_decode_typemap = @wsdl_types +
@wsdl.soap_rpc_complextypes(port.find_binding)
- @wsdl_mapping_registry = Mapping::WSDLEncodedRegistry.new(@rpc_decode_typemap)
- @doc_mapper = Mapping::WSDLLiteralRegistry.new(@wsdl_elements, @wsdl_types)
+ @wsdl_mapping_registry = Mapping::WSDLEncodedRegistry.new(
+ @rpc_decode_typemap)
+ @doc_mapper = Mapping::WSDLLiteralRegistry.new(
+ @wsdl_types, @wsdl_elements)
endpoint_url = @port.soap_address.location
# Convert a map which key is QName, to a Hash which key is String.
@operation = {}
@@ -222,15 +321,16 @@ class WSDLDriver
def rpc_call(name, *values)
set_wiredump_file_base(name)
unless op_info = @operation[name]
- raise MethodDefinitionError, "Method: #{name} not defined."
+ raise RuntimeError, "method: #{name} not defined"
end
req_header = create_request_header
req_body = create_request_body(op_info, *values)
- opt = create_options({
- :soapaction => op_info.soapaction || @soapaction,
+ reqopt = create_options({
+ :soapaction => op_info.soapaction || @soapaction})
+ resopt = create_options({
:decode_typemap => @rpc_decode_typemap})
- env = @proxy.invoke(req_header, req_body, opt)
- raise EmptyResponseError.new("Empty response.") unless env
+ env = @proxy.route(req_header, req_body, reqopt, resopt)
+ raise EmptyResponseError unless env
receive_headers(env.header)
begin
@proxy.check_fault(env.body)
@@ -249,21 +349,6 @@ class WSDLDriver
end
end
- def document_call(name, param)
- set_wiredump_file_base(name)
- op_info = @operation[name]
- req_header = header_from_obj(header_obj, op_info)
- req_body = body_from_obj(body_obj, op_info)
- env = @proxy.invoke(req_header, req_body, op_info.soapaction || @soapaction, @wsdl_types)
- raise EmptyResponseError.new("Empty response.") unless env
- if env.body.fault
- raise ::SOAP::FaultError.new(env.body.fault)
- end
- res_body_obj = env.body.response ?
- Mapping.soap2obj(env.body.response, @mapping_registry) : nil
- return env.header, res_body_obj
- end
-
# req_header: [[element, mustunderstand, encodingstyle(QName/String)], ...]
# req_body: SOAPBasetype/SOAPCompoundtype
def document_send(name, header_obj, body_obj)
@@ -275,7 +360,7 @@ class WSDLDriver
:soapaction => op_info.soapaction || @soapaction,
:decode_typemap => @wsdl_types})
env = @proxy.invoke(req_header, req_body, opt)
- raise EmptyResponseError.new("Empty response.") unless env
+ raise EmptyResponseError unless env
if env.body.fault
raise ::SOAP::FaultError.new(env.body.fault)
end
@@ -297,7 +382,7 @@ class WSDLDriver
def set_wiredump_file_base(name)
if @wiredump_file_base
- @proxy.set_wiredump_file_base(@wiredump_file_base + "_#{ name }")
+ @proxy.set_wiredump_file_base(@wiredump_file_base + "_#{name}")
end
end
@@ -326,7 +411,7 @@ class WSDLDriver
def create_method_struct(op_info, *params)
parts_names = op_info.bodyparts.collect { |part| part.name }
obj = create_method_obj(parts_names, params)
- method = Mapping.obj2soap(obj, @wsdl_mapping_registry, op_info.optype_name)
+ method = Mapping.obj2soap(obj, @wsdl_mapping_registry, op_info.op_name)
if method.members.size != parts_names.size
new_method = SOAPStruct.new
method.each do |key, value|
@@ -356,7 +441,7 @@ class WSDLDriver
if obj.nil?
nil
else
- raise RuntimeError.new("No header definition in schema.")
+ raise RuntimeError.new("no header definition in schema: #{obj}")
end
elsif op_info.headerparts.size == 1
part = op_info.headerparts[0]
@@ -366,7 +451,7 @@ class WSDLDriver
else
header = SOAPHeader.new()
op_info.headerparts.each do |part|
- child = Mapping.find_attribute(obj, part.name)
+ child = Mapping.get_attribute(obj, part.name)
ele = headeritem_from_obj(child, part.element || part.eletype)
header.add(part.name, ele)
end
@@ -391,7 +476,7 @@ class WSDLDriver
if obj.nil?
nil
else
- raise RuntimeError.new("No body found in schema.")
+ raise RuntimeError.new("no body found in schema")
end
elsif op_info.bodyparts.size == 1
part = op_info.bodyparts[0]
@@ -400,7 +485,7 @@ class WSDLDriver
else
body = SOAPBody.new
op_info.bodyparts.each do |part|
- child = Mapping.find_attribute(obj, part.name)
+ child = Mapping.get_attribute(obj, part.name)
ele = bodyitem_from_obj(child, part.element || part.type)
body.add(ele.elename.name, ele)
end
@@ -419,39 +504,40 @@ class WSDLDriver
end
def add_method_interface(op_info)
- name = ::XSD::CodeGen::GenSupport.safemethodname(op_info.op_name.name)
+ name = XSD::CodeGen::GenSupport.safemethodname(op_info.op_name.name)
+ orgname = op_info.op_name.name
+ parts_names = op_info.bodyparts.collect { |part| part.name }
case op_info.style
when :document
- add_document_method_interface(name)
+ if orgname != name and orgname.capitalize == name.capitalize
+ add_document_method_interface(orgname, parts_names)
+ end
+ add_document_method_interface(name, parts_names)
when :rpc
- parts_names = op_info.bodyparts.collect { |part| part.name }
- orgname = op_info.op_name.name
if orgname != name and orgname.capitalize == name.capitalize
add_rpc_method_interface(orgname, parts_names)
end
add_rpc_method_interface(name, parts_names)
else
- raise RuntimeError.new("Unknown style: #{op_info.style}")
+ raise RuntimeError.new("unknown style: #{op_info.style}")
end
end
def add_rpc_method_interface(name, parts_names)
- sclass = class << @host; self; end
- sclass.__send__(:define_method, name, proc { |*arg|
+ ::SOAP::Mapping.define_singleton_method(@host, name) do |*arg|
unless arg.size == parts_names.size
raise ArgumentError.new(
"wrong number of arguments (#{arg.size} for #{parts_names.size})")
end
@servant.rpc_call(name, *arg)
- })
+ end
@host.method(name)
end
- def add_document_method_interface(name)
- sclass = class << @host; self; end
- sclass.__send__(:define_method, name, proc { |h, b|
+ def add_document_method_interface(name, parts_names)
+ ::SOAP::Mapping.define_singleton_method(@host, name) do |*arg|
@servant.document_send(name, h, b)
- })
+ end
@host.method(name)
end
@@ -476,5 +562,3 @@ end
end
-
-
diff --git a/lib/wsdl/definitions.rb b/lib/wsdl/definitions.rb
index a7c71f2a93..5235037cfe 100644
--- a/lib/wsdl/definitions.rb
+++ b/lib/wsdl/definitions.rb
@@ -18,19 +18,16 @@ class Definitions < Info
attr_reader :targetnamespace
attr_reader :imports
- # Overrides Info#root
- def root
- @root
- end
-
- def root=(root)
- @root = root
- end
+ attr_accessor :location
+ attr_reader :importedschema
def initialize
super
@name = nil
@targetnamespace = nil
+ @location = nil
+ @importedschema = {}
+
@types = nil
@imports = []
@messages = XSD::NamedElements.new
@@ -53,6 +50,19 @@ class Definitions < Info
end
end
+ def collect_attributes
+ result = XSD::NamedElements.new
+ if @types
+ @types.schemas.each do |schema|
+ result.concat(schema.collect_attributes)
+ end
+ end
+ @imports.each do |import|
+ result.concat(import.content.collect_attributes)
+ end
+ result
+ end
+
def collect_elements
result = XSD::NamedElements.new
if @types
diff --git a/lib/wsdl/import.rb b/lib/wsdl/import.rb
index 706cb95fe2..faf60871a5 100644
--- a/lib/wsdl/import.rb
+++ b/lib/wsdl/import.rb
@@ -45,13 +45,23 @@ class Import < Info
end
@namespace
when LocationAttrName
- @location = value.source
- @content = import(@location)
- if @content.is_a?(Definitions)
- @content.root = root
- if @namespace
- @content.targetnamespace = @namespace
- end
+ @location = URI.parse(value.source)
+ if @location.relative? and !parent.location.nil? and
+ !parent.location.relative?
+ @location = parent.location + @location
+ end
+ if root.importedschema.key?(@location)
+ @content = root.importedschema[@location]
+ else
+ root.importedschema[@location] = nil # placeholder
+ @content = import(@location)
+ if @content.is_a?(Definitions)
+ @content.root = root
+ if @namespace
+ @content.targetnamespace = @namespace
+ end
+ end
+ root.importedschema[@location] = @content
end
@location
else
@@ -62,7 +72,7 @@ class Import < Info
private
def import(location)
- Importer.import(location)
+ Importer.import(location, root)
end
end
diff --git a/lib/wsdl/importer.rb b/lib/wsdl/importer.rb
index 873be710b5..481bd81b25 100644
--- a/lib/wsdl/importer.rb
+++ b/lib/wsdl/importer.rb
@@ -1,69 +1,37 @@
# WSDL4R - WSDL importer library.
-# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.
-require 'wsdl/info'
+require 'wsdl/xmlSchema/importer'
require 'wsdl/parser'
-require 'soap/soap'
-require 'soap/property'
module WSDL
-class Importer
- def self.import(location)
- new.import(location)
+class Importer < WSDL::XMLSchema::Importer
+ def self.import(location, originalroot = nil)
+ new.import(location, originalroot)
end
- def initialize
- @web_client = nil
- end
+private
- def import(location)
- STDERR.puts("importing: #{location}") if $DEBUG
- content = nil
- if FileTest.exist?(location)
- content = File.open(location).read
- else
- client = web_client.new(nil, "WSDL4R")
- if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName)
- client.proxy = opt["client.protocol.http.proxy"]
- client.no_proxy = opt["client.protocol.http.no_proxy"]
- end
- client.proxy ||= ::SOAP::Env::HTTP_PROXY
- client.no_proxy ||= ::SOAP::Env::NO_PROXY
- content = client.get_content(location)
- end
- opt = {}
+ def parse(content, location, originalroot)
+ opt = {
+ :location => location,
+ :originalroot => originalroot
+ }
begin
WSDL::Parser.new(opt).parse(content)
- rescue WSDL::Parser::ParseError => orgexcn
- require 'wsdl/xmlSchema/parser'
- WSDL::XMLSchema::Parser.new(opt).parse(content)
+ rescue WSDL::Parser::ParseError
+ super(content, location, originalroot)
end
end
-private
-
- def web_client
- @web_client ||= begin
- require 'http-access2'
- if HTTPAccess2::VERSION < "2.0"
- raise LoadError.new("http-access/2.0 or later is required.")
- end
- HTTPAccess2::Client
- rescue LoadError
- STDERR.puts "Loading http-access2 failed. Net/http is used." if $DEBUG
- require 'soap/netHttpClient'
- ::SOAP::NetHttpClient
- end
- @web_client
- end
end
diff --git a/lib/wsdl/info.rb b/lib/wsdl/info.rb
index 657ff5863a..ffd90390a4 100644
--- a/lib/wsdl/info.rb
+++ b/lib/wsdl/info.rb
@@ -10,16 +10,22 @@ module WSDL
class Info
+ attr_accessor :root
attr_accessor :parent
attr_accessor :id
def initialize
+ @root = nil
@parent = nil
@id = nil
end
- def root
- @parent.root
+ def inspect
+ if self.respond_to?(:name)
+ sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.name)
+ else
+ sprintf("#<%s:0x%x>", self.class.name, __id__)
+ end
end
def parse_element(element); end # abstract
diff --git a/lib/wsdl/operation.rb b/lib/wsdl/operation.rb
index 3c1f66859f..727bb9a56c 100644
--- a/lib/wsdl/operation.rb
+++ b/lib/wsdl/operation.rb
@@ -46,21 +46,23 @@ class Operation < Info
end
def input_info
- op_name = @name
- optype_name = XSD::QName.new(targetnamespace, input.name ? input.name.name : @name.name)
- NameInfo.new(op_name, optype_name, inputparts)
+ typename = input.find_message.name
+ NameInfo.new(@name, typename, inputparts)
end
def output_info
- op_name = @name
- optype_name = XSD::QName.new(targetnamespace, output.name ? output.name.name : @name.name)
- NameInfo.new(op_name, optype_name, outputparts)
+ typename = output.find_message.name
+ NameInfo.new(@name, typename, outputparts)
end
def inputparts
sort_parts(input.find_message.parts)
end
+ def inputname
+ XSD::QName.new(targetnamespace, input.name ? input.name.name : @name.name)
+ end
+
def outputparts
sort_parts(output.find_message.parts)
end
diff --git a/lib/wsdl/operationBinding.rb b/lib/wsdl/operationBinding.rb
index fb44eb9660..c2b8cd6591 100644
--- a/lib/wsdl/operationBinding.rb
+++ b/lib/wsdl/operationBinding.rb
@@ -37,7 +37,35 @@ class OperationBinding < Info
end
def find_operation
- porttype.operations[@name]
+ porttype.operations[@name] or raise RuntimeError.new("#{@name} not found")
+ end
+
+ def soapoperation_name
+ if @soapoperation
+ @soapoperation.input_info.op_name
+ else
+ find_operation.name
+ end
+ end
+
+ def soapoperation_style
+ style = nil
+ if @soapoperation
+ style = @soapoperation.operation_style
+ elsif parent.soapbinding
+ style = parent.soapbinding.style
+ else
+ raise TypeError.new("operation style definition not found")
+ end
+ style || :document
+ end
+
+ def soapaction
+ if @soapoperation
+ @soapoperation.soapaction
+ else
+ nil
+ end
end
def parse_element(element)
diff --git a/lib/wsdl/param.rb b/lib/wsdl/param.rb
index 581ecbd8d3..08ba07ee9b 100644
--- a/lib/wsdl/param.rb
+++ b/lib/wsdl/param.rb
@@ -33,7 +33,7 @@ class Param < Info
end
def find_message
- root.message(@message)
+ root.message(@message) or raise RuntimeError.new("#{@message} not found")
end
def parse_element(element)
@@ -61,6 +61,9 @@ class Param < Info
def parse_attr(attr, value)
case attr
when MessageAttrName
+ if value.namespace.nil?
+ value = XSD::QName.new(targetnamespace, value.source)
+ end
@message = value
when NameAttrName
@name = XSD::QName.new(targetnamespace, value.source)
diff --git a/lib/wsdl/parser.rb b/lib/wsdl/parser.rb
index 417ea20b47..f96e96ee2a 100644
--- a/lib/wsdl/parser.rb
+++ b/lib/wsdl/parser.rb
@@ -1,5 +1,5 @@
# WSDL4R - WSDL XML Instance parser library.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -53,6 +53,9 @@ public
@parser = XSD::XMLParser.create_parser(self, opt)
@parsestack = nil
@lastnode = nil
+ @ignored = {}
+ @location = opt[:location]
+ @originalroot = opt[:originalroot]
end
def parse(string_or_readable)
@@ -96,7 +99,7 @@ public
def end_element(name)
lastframe = @parsestack.pop
unless name == lastframe.name
- raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.")
+ raise UnexpectedElementError.new("closing element name '#{name}' does not match with opening element '#{lastframe.name}'")
end
decode_tag_end(lastframe.ns, lastframe.node)
@lastnode = lastframe.node
@@ -106,20 +109,31 @@ private
def decode_tag(ns, name, attrs, parent)
o = nil
- element = ns.parse(name)
+ elename = ns.parse(name)
if !parent
- if element == DefinitionsName
- o = Definitions.parse_element(element)
+ if elename == DefinitionsName
+ o = Definitions.parse_element(elename)
+ o.location = @location
else
- raise UnknownElementError.new("Unknown element #{ element }.")
+ raise UnknownElementError.new("unknown element: #{elename}")
end
+ o.root = @originalroot if @originalroot # o.root = o otherwise
else
- o = parent.parse_element(element)
+ if elename == XMLSchema::AnnotationName
+ # only the first annotation element is allowed for each xsd element.
+ o = XMLSchema::Annotation.new
+ else
+ o = parent.parse_element(elename)
+ end
unless o
- STDERR.puts("Unknown element #{ element }.")
+ unless @ignored.key?(elename)
+ warn("ignored element: #{elename}")
+ @ignored[elename] = elename
+ end
o = Documentation.new # which accepts any element.
end
# node could be a pseudo element. pseudo element has its own parent.
+ o.root = parent.root
o.parent = parent if o.parent.nil?
end
attrs.each do |key, value|
@@ -127,7 +141,10 @@ private
value_ele = ns.parse(value, true)
value_ele.source = value # for recovery; value may not be a QName
unless o.parse_attr(attr_ele, value_ele)
- STDERR.puts("Unknown attr #{ attr_ele }.")
+ unless @ignored.key?(attr_ele)
+ warn("ignored attr: #{attr_ele}")
+ @ignored[attr_ele] = attr_ele
+ end
end
end
o
diff --git a/lib/wsdl/port.rb b/lib/wsdl/port.rb
index 15ba86ad7c..883cc3232d 100644
--- a/lib/wsdl/port.rb
+++ b/lib/wsdl/port.rb
@@ -33,7 +33,7 @@ class Port < Info
end
def find_binding
- root.binding(@binding)
+ root.binding(@binding) or raise RuntimeError.new("#{@binding} not found")
end
def inputoperation_map
diff --git a/lib/wsdl/portType.rb b/lib/wsdl/portType.rb
index 86893ba039..03e37690a8 100644
--- a/lib/wsdl/portType.rb
+++ b/lib/wsdl/portType.rb
@@ -28,7 +28,8 @@ class PortType < Info
end
def find_binding
- root.bindings.find { |item| item.type == @name }
+ root.bindings.find { |item| item.type == @name } or
+ raise RuntimeError.new("#{@name} not found")
end
def locations
diff --git a/lib/wsdl/soap/cgiStubCreator.rb b/lib/wsdl/soap/cgiStubCreator.rb
index 68ecfaf0a4..0a76dc43a1 100644
--- a/lib/wsdl/soap/cgiStubCreator.rb
+++ b/lib/wsdl/soap/cgiStubCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating CGI stub code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -26,9 +26,7 @@ class CGIStubCreator
end
def dump(service_name)
- STDERR.puts "!!! IMPORTANT !!!"
- STDERR.puts "- CGI stub can only 1 port. Creating stub for the first port... Rests are ignored."
- STDERR.puts "!!! IMPORTANT !!!"
+ warn("CGI stub can have only 1 port. Creating stub for the first port... Rests are ignored.")
port = @definitions.service(service_name).ports[0]
dump_porttype(port.porttype.name)
end
@@ -39,28 +37,28 @@ private
class_name = create_class_name(name)
methoddef, types = MethodDefCreator.new(@definitions).dump(name)
mr_creator = MappingRegistryCreator.new(@definitions)
- c1 = ::XSD::CodeGen::ClassDef.new(class_name)
+ c1 = XSD::CodeGen::ClassDef.new(class_name)
c1.def_require("soap/rpc/cgistub")
c1.def_require("soap/mapping/registry")
c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
c1.def_code(mr_creator.dump(types))
c1.def_code <<-EOD
Methods = [
-#{ methoddef.gsub(/^/, " ") }
+#{methoddef.gsub(/^/, " ")}
]
EOD
- c2 = ::XSD::CodeGen::ClassDef.new(class_name + "App",
+ c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
"::SOAP::RPC::CGIStub")
c2.def_method("initialize", "*arg") do
<<-EOD
super(*arg)
servant = #{class_name}.new
#{class_name}::Methods.each do |name_as, name, param_def, soapaction, namespace, style|
- qname = XSD::QName.new(namespace, name_as)
if style == :document
- @router.add_document_method(servant, qname, soapaction, name, param_def)
+ @router.add_document_operation(servant, soapaction, name, param_def)
else
- @router.add_rpc_method(servant, qname, soapaction, name, param_def)
+ qname = XSD::QName.new(namespace, name_as)
+ @router.add_rpc_operation(servant, qname, soapaction, name, param_def)
end
end
self.mapping_registry = #{class_name}::MappingRegistry
diff --git a/lib/wsdl/soap/classDefCreator.rb b/lib/wsdl/soap/classDefCreator.rb
index 13f7802b72..deda4f131f 100644
--- a/lib/wsdl/soap/classDefCreator.rb
+++ b/lib/wsdl/soap/classDefCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating class definition from WSDL
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -22,13 +22,16 @@ class ClassDefCreator
@elements = definitions.collect_elements
@simpletypes = definitions.collect_simpletypes
@complextypes = definitions.collect_complextypes
- @faulttypes = definitions.collect_faulttypes if definitions.respond_to?(:collect_faulttypes)
+ @faulttypes = nil
+ if definitions.respond_to?(:collect_faulttypes)
+ @faulttypes = definitions.collect_faulttypes
+ end
end
- def dump(class_name = nil)
- result = ''
- if class_name
- result = dump_classdef(class_name)
+ def dump(type = nil)
+ result = "require 'xsd/qname'\n"
+ if type
+ result = dump_classdef(type.name, type)
else
str = dump_element
unless str.empty?
@@ -53,117 +56,129 @@ private
def dump_element
@elements.collect { |ele|
- ele.local_complextype ? dump_classdef(ele) : ''
- }.join("\n")
+ if ele.local_complextype
+ dump_classdef(ele.name, ele.local_complextype)
+ elsif ele.local_simpletype
+ dump_simpletypedef(ele.name, ele.local_simpletype)
+ else
+ nil
+ end
+ }.compact.join("\n")
end
def dump_simpletype
@simpletypes.collect { |type|
- dump_simpletypedef(type)
- }.join("\n")
+ dump_simpletypedef(type.name, type)
+ }.compact.join("\n")
end
def dump_complextype
@complextypes.collect { |type|
case type.compoundtype
- when :TYPE_STRUCT
- dump_classdef(type)
+ when :TYPE_STRUCT, :TYPE_EMPTY
+ dump_classdef(type.name, type)
when :TYPE_ARRAY
dump_arraydef(type)
when :TYPE_SIMPLE
- STDERR.puts("not implemented: ToDo")
+ dump_simpleclassdef(type)
+ when :TYPE_MAP
+ # mapped as a general Hash
+ nil
else
raise RuntimeError.new(
- "Unknown kind of complexContent: #{type.compoundtype}")
+ "unknown kind of complexContent: #{type.compoundtype}")
end
- }.join("\n")
+ }.compact.join("\n")
end
- def dump_simpletypedef(simpletype)
- qname = simpletype.name
- if simpletype.restriction.enumeration.empty?
- STDERR.puts("#{qname}: simpleType which is not enum type not supported.")
- return ''
+ def dump_simpletypedef(qname, simpletype)
+ if !simpletype.restriction or simpletype.restriction.enumeration.empty?
+ return nil
end
c = XSD::CodeGen::ModuleDef.new(create_class_name(qname))
- c.comment = "#{ qname.namespace }"
+ c.comment = "#{qname}"
+ const = {}
simpletype.restriction.enumeration.each do |value|
- c.def_const(safeconstname(value), value.dump)
+ constname = safeconstname(value)
+ const[constname] ||= 0
+ if (const[constname] += 1) > 1
+ constname += "_#{const[constname]}"
+ end
+ c.def_const(constname, ndq(value))
end
c.dump
end
- def dump_classdef(type_or_element)
+ def dump_simpleclassdef(type_or_element)
qname = type_or_element.name
+ base = create_class_name(type_or_element.simplecontent.base)
+ c = XSD::CodeGen::ClassDef.new(create_class_name(qname), base)
+ c.comment = "#{qname}"
+ c.dump
+ end
+
+ def dump_classdef(qname, typedef)
if @faulttypes and @faulttypes.index(qname)
c = XSD::CodeGen::ClassDef.new(create_class_name(qname),
'::StandardError')
else
c = XSD::CodeGen::ClassDef.new(create_class_name(qname))
end
- c.comment = "#{ qname.namespace }"
- c.def_classvar('schema_type', qname.name.dump)
- c.def_classvar('schema_ns', qname.namespace.dump)
- schema_attribute = []
+ c.comment = "#{qname}"
+ c.def_classvar('schema_type', ndq(qname.name))
+ c.def_classvar('schema_ns', ndq(qname.namespace))
schema_element = []
init_lines = ''
params = []
- type_or_element.each_element do |element|
- next unless element.name
- name = element.name.name
+ typedef.each_element do |element|
if element.type == XSD::AnyTypeName
type = nil
- elsif basetype = basetype_class(element.type)
- type = basetype.name
- else
+ elsif klass = element_basetype(element)
+ type = klass.name
+ elsif element.type
type = create_class_name(element.type)
+ else
+ type = nil # means anyType.
+ # do we define a class for local complexType from it's name?
+ # type = create_class_name(element.name)
+ # <element>
+ # <complexType>
+ # <seq...>
+ # </complexType>
+ # </element>
end
+ name = name_element(element).name
attrname = safemethodname?(name) ? name : safemethodname(name)
varname = safevarname(name)
c.def_attr(attrname, true, varname)
- init_lines << "@#{ varname } = #{ varname }\n"
+ init_lines << "@#{varname} = #{varname}\n"
if element.map_as_array?
- params << "#{ varname } = []"
- type << '[]'
+ params << "#{varname} = []"
+ type << '[]' if type
else
- params << "#{ varname } = nil"
+ params << "#{varname} = nil"
end
- schema_element << [name, type]
+ eleqname = (varname == name) ? nil : element.name
+ schema_element << [varname, eleqname, type]
end
- unless type_or_element.attributes.empty?
- type_or_element.attributes.each do |attribute|
- name = attribute.name.name
- if basetype = basetype_class(attribute.type)
- type = basetype_class(attribute.type).name
- else
- type = nil
- end
- varname = safevarname('attr_' + name)
- c.def_method(varname) do <<-__EOD__
- @__soap_attribute[#{name.dump}]
- __EOD__
- end
- c.def_method(varname + '=', 'value') do <<-__EOD__
- @__soap_attribute[#{name.dump}] = value
- __EOD__
- end
- schema_attribute << [name, type]
- end
- init_lines << "@__soap_attribute = {}\n"
+ unless typedef.attributes.empty?
+ define_attribute(c, typedef.attributes)
+ init_lines << "@__xmlattr = {}\n"
end
- c.def_classvar('schema_attribute',
- '{' +
- schema_attribute.collect { |name, type|
- name.dump + ' => ' + ndq(type)
- }.join(', ') +
- '}'
- )
c.def_classvar('schema_element',
- '{' +
- schema_element.collect { |name, type|
- name.dump + ' => ' + ndq(type)
+ '[' +
+ schema_element.collect { |varname, name, type|
+ '[' +
+ (
+ if name
+ varname.dump + ', [' + ndq(type) + ', ' + dqname(name) + ']'
+ else
+ varname.dump + ', ' + ndq(type)
+ end
+ ) +
+ ']'
}.join(', ') +
- '}'
+ ']'
)
c.def_method('initialize', *params) do
init_lines
@@ -171,20 +186,83 @@ private
c.dump
end
+ def element_basetype(ele)
+ if klass = basetype_class(ele.type)
+ klass
+ elsif ele.local_simpletype
+ basetype_class(ele.local_simpletype.base)
+ else
+ nil
+ end
+ end
+
+ def attribute_basetype(attr)
+ if klass = basetype_class(attr.type)
+ klass
+ elsif attr.local_simpletype
+ basetype_class(attr.local_simpletype.base)
+ else
+ nil
+ end
+ end
+
def basetype_class(type)
- if @simpletypes[type]
- basetype_mapped_class(@simpletypes[type].base)
+ return nil if type.nil?
+ if simpletype = @simpletypes[type]
+ basetype_mapped_class(simpletype.base)
else
basetype_mapped_class(type)
end
end
+ def define_attribute(c, attributes)
+ schema_attribute = []
+ attributes.each do |attribute|
+ name = name_attribute(attribute)
+ if klass = attribute_basetype(attribute)
+ type = klass.name
+ else
+ type = nil
+ end
+ methodname = safemethodname('xmlattr_' + name.name)
+ c.def_method(methodname) do <<-__EOD__
+ (@__xmlattr ||= {})[#{dqname(name)}]
+ __EOD__
+ end
+ c.def_method(methodname + '=', 'value') do <<-__EOD__
+ (@__xmlattr ||= {})[#{dqname(name)}] = value
+ __EOD__
+ end
+ schema_attribute << [name, type]
+ end
+ c.def_classvar('schema_attribute',
+ '{' +
+ schema_attribute.collect { |name, type|
+ dqname(name) + ' => ' + ndq(type)
+ }.join(', ') +
+ '}'
+ )
+ end
+
+ def name_element(element)
+ return element.name if element.name
+ return element.ref if element.ref
+ raise RuntimeError.new("cannot define name of #{element}")
+ end
+
+ def name_attribute(attribute)
+ return attribute.name if attribute.name
+ return attribute.ref if attribute.ref
+ raise RuntimeError.new("cannot define name of #{attribute}")
+ end
+
def dump_arraydef(complextype)
qname = complextype.name
c = XSD::CodeGen::ClassDef.new(create_class_name(qname), '::Array')
- c.comment = "#{ qname.namespace }"
- c.def_classvar('schema_type', qname.name.dump)
- c.def_classvar('schema_ns', qname.namespace.dump)
+ c.comment = "#{qname}"
+ type = complextype.child_type
+ c.def_classvar('schema_type', ndq(type.name))
+ c.def_classvar('schema_ns', ndq(type.namespace))
c.dump
end
end
diff --git a/lib/wsdl/soap/classDefCreatorSupport.rb b/lib/wsdl/soap/classDefCreatorSupport.rb
index 706c00d4f6..8f335653c8 100644
--- a/lib/wsdl/soap/classDefCreatorSupport.rb
+++ b/lib/wsdl/soap/classDefCreatorSupport.rb
@@ -21,7 +21,7 @@ module ClassDefCreatorSupport
def create_class_name(qname)
if klass = basetype_mapped_class(qname)
- ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass.name)
+ ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass).name
else
safeconstname(qname.name)
end
@@ -71,6 +71,10 @@ __EOD__
':' + ele
end
+ def dqname(qname)
+ qname.dump
+ end
+
private
def dump_inout_type(param)
diff --git a/lib/wsdl/soap/complexType.rb b/lib/wsdl/soap/complexType.rb
index 1bed059f7e..bba50fd153 100644
--- a/lib/wsdl/soap/complexType.rb
+++ b/lib/wsdl/soap/complexType.rb
@@ -31,42 +31,44 @@ class ComplexType < Info
else
:TYPE_STRUCT
end
- elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName
- :TYPE_ARRAY
+ elsif complexcontent
+ if complexcontent.base == ::SOAP::ValueArrayName
+ :TYPE_ARRAY
+ else
+ complexcontent.basetype.check_type
+ end
elsif simplecontent
:TYPE_SIMPLE
elsif !attributes.empty?
:TYPE_STRUCT
- else
- raise NotImplementedError.new("Unknown kind of complexType.")
+ else # empty complexType definition (seen in partner.wsdl of salesforce)
+ :TYPE_EMPTY
end
end
def child_type(name = nil)
- type = nil
case compoundtype
when :TYPE_STRUCT
if ele = find_element(name)
- type = ele.type
+ ele.type
elsif ele = find_element_by_name(name.name)
- type = ele.type
+ ele.type
end
when :TYPE_ARRAY
- type = @contenttype ||= content_arytype
+ @contenttype ||= content_arytype
when :TYPE_MAP
item_ele = find_element_by_name("item") or
raise RuntimeError.new("'item' element not found in Map definition.")
content = item_ele.local_complextype or
raise RuntimeError.new("No complexType definition for 'item'.")
if ele = content.find_element(name)
- type = ele.type
+ ele.type
elsif ele = content.find_element_by_name(name.name)
- type = ele.type
+ ele.type
end
else
raise NotImplementedError.new("Unknown kind of complexType.")
end
- type
end
def child_defined_complextype(name)
@@ -103,16 +105,21 @@ class ComplexType < Info
return attribute.arytype
end
end
- elsif content.elements.size == 1 and content.elements[0].maxoccurs != '1'
+ if check_array_content(complexcontent.content)
+ return complexcontent.content.elements[0].type
+ end
+ elsif check_array_content(content)
return content.elements[0].type
- else
- raise RuntimeError.new("Assert: Unknown array definition.")
end
- nil
+ raise RuntimeError.new("Assert: Unknown array definition.")
end
private
+ def check_array_content(content)
+ content.elements.size == 1 and content.elements[0].maxoccurs != '1'
+ end
+
def content_arytype
if arytype = find_arytype
ns = arytype.namespace
diff --git a/lib/wsdl/soap/definitions.rb b/lib/wsdl/soap/definitions.rb
index 2f6e7e19f0..b014d5af6b 100644
--- a/lib/wsdl/soap/definitions.rb
+++ b/lib/wsdl/soap/definitions.rb
@@ -1,5 +1,5 @@
# WSDL4R - WSDL additional definitions for SOAP.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -77,13 +77,13 @@ class Definitions < Info
def collect_faulttypes
result = []
- collect_fault_messages.each do |message|
- parts = message(message).parts
- if parts.size != 1
- raise RuntimeError.new("Expecting fault message to have only 1 part.")
+ collect_fault_messages.each do |name|
+ faultparts = message(name).parts
+ if faultparts.size != 1
+ raise RuntimeError.new("expecting fault message to have only 1 part")
end
- if result.index(parts[0].type).nil?
- result << parts[0].type
+ if result.index(faultparts[0].type).nil?
+ result << faultparts[0].type
end
end
result
@@ -111,13 +111,13 @@ private
if op_bind_rpc?(op_bind)
operation = op_bind.find_operation
if op_bind.input
- type = XMLSchema::ComplexType.new(operation_input_name(operation))
+ type = XMLSchema::ComplexType.new(op_bind.soapoperation_name)
message = messages[operation.input.message]
type.sequence_elements = elements_from_message(message)
types << type
end
if op_bind.output
- type = XMLSchema::ComplexType.new(operation_output_name(operation))
+ type = XMLSchema::ComplexType.new(operation.outputname)
message = messages[operation.output.message]
type.sequence_elements = elements_from_message(message)
types << type
@@ -127,23 +127,20 @@ private
types
end
- def operation_input_name(operation)
- operation.input.name || operation.name
- end
-
- def operation_output_name(operation)
- operation.output.name ||
- XSD::QName.new(operation.name.namespace, operation.name.name + "Response")
- end
-
def op_bind_rpc?(op_bind)
- op_bind.soapoperation and op_bind.soapoperation.operation_style == :rpc
+ op_bind.soapoperation_style == :rpc
end
def elements_from_message(message)
message.parts.collect { |part|
- qname = XSD::QName.new(nil, part.name)
- XMLSchema::Element.new(qname, part.type)
+ if part.element
+ collect_elements[part.element]
+ elsif part.name.nil? or part.type.nil?
+ raise RuntimeError.new("part of a message must be an element or typed")
+ else
+ qname = XSD::QName.new(nil, part.name)
+ XMLSchema::Element.new(qname, part.type)
+ end
}
end
end
diff --git a/lib/wsdl/soap/driverCreator.rb b/lib/wsdl/soap/driverCreator.rb
index b752ee336d..dd504210f1 100644
--- a/lib/wsdl/soap/driverCreator.rb
+++ b/lib/wsdl/soap/driverCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating driver code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -46,16 +46,17 @@ private
methoddef, types = MethodDefCreator.new(@definitions).dump(name)
mr_creator = MappingRegistryCreator.new(@definitions)
binding = @definitions.bindings.find { |item| item.type == name }
- addresses = @definitions.porttype(name).locations
+ return '' unless binding.soapbinding # not a SOAP binding
+ address = @definitions.porttype(name).locations[0]
- c = ::XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver")
+ c = XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver")
c.def_require("soap/rpc/driver")
c.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
- c.def_const("DefaultEndpointUrl", addresses[0].dump)
+ c.def_const("DefaultEndpointUrl", ndq(address))
c.def_code(mr_creator.dump(types))
c.def_code <<-EOD
Methods = [
-#{ methoddef.gsub(/^/, " ") }
+#{methoddef.gsub(/^/, " ")}
]
EOD
c.def_method("initialize", "endpoint_url = nil") do
@@ -69,14 +70,19 @@ Methods = [
c.def_privatemethod("init_methods") do
<<-EOD
Methods.each do |name_as, name, params, soapaction, namespace, style|
- qname = ::XSD::QName.new(namespace, name_as)
+ qname = XSD::QName.new(namespace, name_as)
if style == :document
- @proxy.add_document_method(qname, soapaction, name, params)
- add_document_method_interface(name, name_as)
+ @proxy.add_document_method(soapaction, name, params)
+ add_document_method_interface(name, params)
else
@proxy.add_rpc_method(qname, soapaction, name, params)
add_rpc_method_interface(name, params)
end
+ if name_as != name and name_as.capitalize == name.capitalize
+ ::SOAP::Mapping.define_singleton_method(self, name_as) do |*arg|
+ __send__(name, *arg)
+ end
+ end
end
EOD
end
diff --git a/lib/wsdl/soap/element.rb b/lib/wsdl/soap/element.rb
index c39a00d25a..0fa6017c5b 100644
--- a/lib/wsdl/soap/element.rb
+++ b/lib/wsdl/soap/element.rb
@@ -21,12 +21,6 @@ class Element < Info
def attributes
@local_complextype.attributes
end
-
- def each_element
- @local_complextype.each_element do |element|
- yield(element)
- end
- end
end
diff --git a/lib/wsdl/soap/fault.rb b/lib/wsdl/soap/fault.rb
index 019c881f97..2862b659ab 100644
--- a/lib/wsdl/soap/fault.rb
+++ b/lib/wsdl/soap/fault.rb
@@ -27,6 +27,10 @@ class Fault < Info
@namespace = nil
end
+ def targetnamespace
+ parent.targetnamespace
+ end
+
def parse_element(element)
nil
end
diff --git a/lib/wsdl/soap/header.rb b/lib/wsdl/soap/header.rb
index 247531a76d..8d7c4e9d70 100644
--- a/lib/wsdl/soap/header.rb
+++ b/lib/wsdl/soap/header.rb
@@ -32,8 +32,12 @@ class Header < Info
@headerfault = nil
end
+ def targetnamespace
+ parent.targetnamespace
+ end
+
def find_message
- root.message(@message)
+ root.message(@message) or raise RuntimeError.new("#{@message} not found")
end
def find_part
@@ -42,7 +46,7 @@ class Header < Info
return part
end
end
- nil
+ raise RuntimeError.new("#{@part} not found")
end
def parse_element(element)
@@ -59,7 +63,10 @@ class Header < Info
def parse_attr(attr, value)
case attr
when MessageAttrName
- @message = XSD::QName.new(targetnamespace, value.source)
+ if value.namespace.nil?
+ value = XSD::QName.new(targetnamespace, value.source)
+ end
+ @message = value
when PartAttrName
@part = value.source
when UseAttrName
diff --git a/lib/wsdl/soap/mappingRegistryCreator.rb b/lib/wsdl/soap/mappingRegistryCreator.rb
index d3b28f47e0..8669339ce4 100644
--- a/lib/wsdl/soap/mappingRegistryCreator.rb
+++ b/lib/wsdl/soap/mappingRegistryCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating MappingRegistry code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -38,7 +38,7 @@ class MappingRegistryCreator
end
end
end
- end
+ end
return map
end
@@ -51,8 +51,10 @@ private
dump_struct_typemap(definedtype)
when :TYPE_ARRAY
dump_array_typemap(definedtype)
+ when :TYPE_MAP, :TYPE_EMPTY
+ nil
else
- raise NotImplementedError.new("Must not reach here.")
+ raise NotImplementedError.new("must not reach here")
end
end
end
@@ -61,10 +63,10 @@ private
ele = definedtype.name
return <<__EOD__
MappingRegistry.set(
- #{ create_class_name(ele) },
+ #{create_class_name(ele)},
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => ::XSD::QName.new("#{ ele.namespace }", "#{ ele.name }") }
+ { :type => #{dqname(ele)} }
)
__EOD__
end
@@ -76,10 +78,10 @@ __EOD__
@types << type
return <<__EOD__
MappingRegistry.set(
- #{ create_class_name(ele) },
+ #{create_class_name(ele)},
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => ::XSD::QName.new("#{ type.namespace }", "#{ type.name }") }
+ { :type => #{dqname(type)} }
)
__EOD__
end
diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb
index 59b8ee4253..f256b42451 100644
--- a/lib/wsdl/soap/methodDefCreator.rb
+++ b/lib/wsdl/soap/methodDefCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating driver code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -8,6 +8,7 @@
require 'wsdl/info'
require 'wsdl/soap/classDefCreatorSupport'
+require 'soap/rpc/element'
module WSDL
@@ -24,75 +25,80 @@ class MethodDefCreator
@simpletypes = @definitions.collect_simpletypes
@complextypes = @definitions.collect_complextypes
@elements = @definitions.collect_elements
- @types = nil
+ @types = []
end
def dump(porttype)
- @types = []
+ @types.clear
result = ""
operations = @definitions.porttype(porttype).operations
binding = @definitions.porttype_binding(porttype)
operations.each do |operation|
op_bind = binding.operations[operation.name]
+ next unless op_bind # no binding is defined
+ next unless op_bind.soapoperation # not a SOAP operation binding
result << ",\n" unless result.empty?
result << dump_method(operation, op_bind).chomp
end
return result, @types
end
-private
-
- def dump_method(operation, binding)
- name = safemethodname(operation.name.name)
- name_as = operation.name.name
- stylestr = binding.soapoperation.operation_style.id2name
- if binding.soapoperation.operation_style == :rpc
- soapaction = binding.soapoperation.soapaction
- namespace = binding.input.soapbody.namespace
- params = collect_rpcparameter(operation)
- else
- soapaction = namespace = nil
- params = collect_documentparameter(operation)
- end
- paramstr = param2str(params)
- if paramstr.empty?
- paramstr = '[]'
- else
- paramstr = "[\n" << paramstr.gsub(/^/, ' ') << "\n ]"
- end
- return <<__EOD__
-[#{ dq(name_as) }, #{ dq(name) },
- #{ paramstr },
- #{ ndq(soapaction) }, #{ ndq(namespace) }, #{ sym(stylestr) }
-]
-__EOD__
- end
-
def collect_rpcparameter(operation)
result = operation.inputparts.collect { |part|
collect_type(part.type)
- param_set('in', rpcdefinedtype(part), part.name)
+ param_set(::SOAP::RPC::SOAPMethod::IN, rpcdefinedtype(part), part.name)
}
outparts = operation.outputparts
if outparts.size > 0
retval = outparts[0]
collect_type(retval.type)
- result << param_set('retval', rpcdefinedtype(retval), retval.name)
+ result << param_set(::SOAP::RPC::SOAPMethod::RETVAL,
+ rpcdefinedtype(retval), retval.name)
cdr(outparts).each { |part|
collect_type(part.type)
- result << param_set('out', rpcdefinedtype(part), part.name)
+ result << param_set(::SOAP::RPC::SOAPMethod::OUT, rpcdefinedtype(part),
+ part.name)
}
end
result
end
def collect_documentparameter(operation)
- input = operation.inputparts[0]
- output = operation.outputparts[0]
- [
- param_set('input', documentdefinedtype(input), input.name),
- param_set('output', documentdefinedtype(output), output.name)
- ]
+ param = []
+ operation.inputparts.each do |input|
+ param << param_set(::SOAP::RPC::SOAPMethod::IN,
+ documentdefinedtype(input), input.name)
+ end
+ operation.outputparts.each do |output|
+ param << param_set(::SOAP::RPC::SOAPMethod::OUT,
+ documentdefinedtype(output), output.name)
+ end
+ param
+ end
+
+private
+
+ def dump_method(operation, binding)
+ name = safemethodname(operation.name.name)
+ name_as = operation.name.name
+ style = binding.soapoperation_style
+ namespace = binding.input.soapbody.namespace
+ if style == :rpc
+ paramstr = param2str(collect_rpcparameter(operation))
+ else
+ paramstr = param2str(collect_documentparameter(operation))
+ end
+ if paramstr.empty?
+ paramstr = '[]'
+ else
+ paramstr = "[\n" << paramstr.gsub(/^/, ' ') << "\n ]"
+ end
+ return <<__EOD__
+[#{dq(name_as)}, #{dq(name)},
+ #{paramstr},
+ #{ndq(binding.soapaction)}, #{ndq(namespace)}, #{sym(style.id2name)}
+]
+__EOD__
end
def rpcdefinedtype(part)
@@ -101,33 +107,40 @@ __EOD__
elsif definedtype = @simpletypes[part.type]
['::' + basetype_mapped_class(definedtype.base).name]
elsif definedtype = @elements[part.element]
- ['::SOAP::SOAPStruct', part.element.namespace, part.element.name]
+ #['::SOAP::SOAPStruct', part.element.namespace, part.element.name]
+ ['nil', part.element.namespace, part.element.name]
elsif definedtype = @complextypes[part.type]
case definedtype.compoundtype
- when :TYPE_STRUCT
- ['::SOAP::SOAPStruct', part.type.namespace, part.type.name]
+ when :TYPE_STRUCT, :TYPE_EMPTY # ToDo: empty should be treated as void.
+ type = create_class_name(part.type)
+ [type, part.type.namespace, part.type.name]
+ when :TYPE_MAP
+ [Hash.name, part.type.namespace, part.type.name]
when :TYPE_ARRAY
arytype = definedtype.find_arytype || XSD::AnyTypeName
ns = arytype.namespace
name = arytype.name.sub(/\[(?:,)*\]$/, '')
- ['::SOAP::SOAPArray', ns, name]
+ type = create_class_name(XSD::QName.new(ns, name))
+ [type + '[]', ns, name]
else
- raise NotImplementedError.new("Must not reach here.")
+ raise NotImplementedError.new("must not reach here")
end
else
- raise RuntimeError.new("Part: #{part.name} cannot be resolved.")
+ raise RuntimeError.new("part: #{part.name} cannot be resolved")
end
end
def documentdefinedtype(part)
- if definedtype = @simpletypes[part.type]
+ if mapped = basetype_mapped_class(part.type)
+ ['::' + mapped.name, nil, part.name]
+ elsif definedtype = @simpletypes[part.type]
['::' + basetype_mapped_class(definedtype.base).name, nil, part.name]
elsif definedtype = @elements[part.element]
['::SOAP::SOAPElement', part.element.namespace, part.element.name]
elsif definedtype = @complextypes[part.type]
['::SOAP::SOAPElement', part.type.namespace, part.type.name]
else
- raise RuntimeError.new("Part: #{part.name} cannot be resolved.")
+ raise RuntimeError.new("part: #{part.name} cannot be resolved")
end
end
@@ -138,6 +151,7 @@ __EOD__
def collect_type(type)
# ignore inline type definition.
return if type.nil?
+ return if @types.include?(type)
@types << type
return unless @complextypes[type]
@complextypes[type].each_element do |element|
@@ -147,15 +161,15 @@ __EOD__
def param2str(params)
params.collect { |param|
- "[#{ dq(param[0]) }, #{ dq(param[2]) }, #{ type2str(param[1]) }]"
+ "[#{dq(param[0])}, #{dq(param[2])}, #{type2str(param[1])}]"
}.join(",\n")
end
def type2str(type)
if type.size == 1
- "[#{ type[0] }]"
+ "[#{dq(type[0])}]"
else
- "[#{ type[0] }, #{ ndq(type[1]) }, #{ dq(type[2]) }]"
+ "[#{dq(type[0])}, #{ndq(type[1])}, #{dq(type[2])}]"
end
end
diff --git a/lib/wsdl/soap/operation.rb b/lib/wsdl/soap/operation.rb
index 51bb2e9403..502d34a07d 100644
--- a/lib/wsdl/soap/operation.rb
+++ b/lib/wsdl/soap/operation.rb
@@ -101,8 +101,7 @@ private
"EncodingStyle '#{ soapbody.encodingstyle }' not supported.")
end
if soapbody.namespace
- op_name = op_name.dup
- op_name.namespace = soapbody.namespace
+ op_name = XSD::QName.new(soapbody.namespace, op_name.name)
end
if soapbody.parts
target = soapbody.parts.split(/\s+/)
@@ -114,8 +113,7 @@ private
end
faultpart = nil
- soapaction = parent.soapoperation.soapaction
- OperationInfo.new(operation_style, op_name, optype_name, headerparts, bodyparts, faultpart, soapaction)
+ OperationInfo.new(operation_style, op_name, optype_name, headerparts, bodyparts, faultpart, parent.soapaction)
end
end
diff --git a/lib/wsdl/soap/servantSkeltonCreator.rb b/lib/wsdl/soap/servantSkeltonCreator.rb
index 12761ab5b4..88294ffed8 100644
--- a/lib/wsdl/soap/servantSkeltonCreator.rb
+++ b/lib/wsdl/soap/servantSkeltonCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating servant skelton code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -17,7 +17,7 @@ module SOAP
class ServantSkeltonCreator
include ClassDefCreatorSupport
- include ::XSD::CodeGen::GenSupport
+ include XSD::CodeGen::GenSupport
attr_reader :definitions
@@ -42,7 +42,7 @@ private
def dump_porttype(name)
class_name = create_class_name(name)
- c = ::XSD::CodeGen::ClassDef.new(class_name)
+ c = XSD::CodeGen::ClassDef.new(class_name)
operations = @definitions.porttype(name).operations
operations.each do |operation|
name = safemethodname(operation.name.name)
@@ -50,7 +50,7 @@ private
params = input.find_message.parts.collect { |part|
safevarname(part.name)
}
- m = ::XSD::CodeGen::MethodDef.new(name, params) do <<-EOD
+ m = XSD::CodeGen::MethodDef.new(name, params) do <<-EOD
p [#{params.join(", ")}]
raise NotImplementedError.new
EOD
diff --git a/lib/wsdl/soap/standaloneServerStubCreator.rb b/lib/wsdl/soap/standaloneServerStubCreator.rb
index 779139a5f4..243ac12216 100644
--- a/lib/wsdl/soap/standaloneServerStubCreator.rb
+++ b/lib/wsdl/soap/standaloneServerStubCreator.rb
@@ -1,5 +1,5 @@
# WSDL4R - Creating standalone server stub code from WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -26,10 +26,8 @@ class StandaloneServerStubCreator
end
def dump(service_name)
- STDERR.puts "!!! IMPORTANT !!!"
- STDERR.puts "- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored."
- STDERR.puts "- Standalone server stub ignores port location defined in WSDL. Location is http://localhost:10080/ by default. Generated client from WSDL must be configured to point this endpoint by hand."
- STDERR.puts "!!! IMPORTANT !!!"
+ warn("- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored.")
+ warn("- Standalone server stub ignores port location defined in WSDL. Location is http://localhost:10080/ by default. Generated client from WSDL must be configured to point this endpoint manually.")
port = @definitions.service(service_name).ports[0]
dump_porttype(port.porttype.name)
end
@@ -41,28 +39,28 @@ private
methoddef, types = MethodDefCreator.new(@definitions).dump(name)
mr_creator = MappingRegistryCreator.new(@definitions)
- c1 = ::XSD::CodeGen::ClassDef.new(class_name)
+ c1 = XSD::CodeGen::ClassDef.new(class_name)
c1.def_require("soap/rpc/standaloneServer")
c1.def_require("soap/mapping/registry")
c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
c1.def_code(mr_creator.dump(types))
c1.def_code <<-EOD
Methods = [
-#{ methoddef.gsub(/^/, " ") }
+#{methoddef.gsub(/^/, " ")}
]
EOD
- c2 = ::XSD::CodeGen::ClassDef.new(class_name + "App",
+ c2 = XSD::CodeGen::ClassDef.new(class_name + "App",
"::SOAP::RPC::StandaloneServer")
c2.def_method("initialize", "*arg") do
<<-EOD
super(*arg)
servant = #{class_name}.new
#{class_name}::Methods.each do |name_as, name, param_def, soapaction, namespace, style|
- qname = XSD::QName.new(namespace, name_as)
if style == :document
- @soaplet.app_scope_router.add_document_method(servant, qname, soapaction, name, param_def)
+ @router.add_document_operation(servant, soapaction, name, param_def)
else
- @soaplet.app_scope_router.add_rpc_method(servant, qname, soapaction, name, param_def)
+ qname = XSD::QName.new(namespace, name_as)
+ @router.add_rpc_operation(servant, qname, soapaction, name, param_def)
end
end
self.mapping_registry = #{class_name}::MappingRegistry
diff --git a/lib/wsdl/xmlSchema/attribute.rb b/lib/wsdl/xmlSchema/attribute.rb
index 6861fc171e..cfd4c68422 100644
--- a/lib/wsdl/xmlSchema/attribute.rb
+++ b/lib/wsdl/xmlSchema/attribute.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema attribute definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -14,34 +14,74 @@ module XMLSchema
class Attribute < Info
- attr_accessor :ref
- attr_accessor :use
- attr_accessor :form
- attr_accessor :name
- attr_accessor :type
- attr_accessor :default
- attr_accessor :fixed
+ class << self
+ if RUBY_VERSION > "1.7.0"
+ def attr_reader_ref(symbol)
+ name = symbol.to_s
+ self.__send__(:define_method, name, proc {
+ instance_variable_get("@#{name}") ||
+ (refelement ? refelement.__send__(name) : nil)
+ })
+ end
+ else
+ def attr_reader_ref(symbol)
+ name = symbol.to_s
+ module_eval <<-EOS
+ def #{name}
+ @#{name} || (refelement ? refelement.#{name} : nil)
+ end
+ EOS
+ end
+ end
+ end
+
+ attr_writer :use
+ attr_writer :form
+ attr_writer :name
+ attr_writer :type
+ attr_writer :local_simpletype
+ attr_writer :default
+ attr_writer :fixed
+
+ attr_reader_ref :use
+ attr_reader_ref :form
+ attr_reader_ref :name
+ attr_reader_ref :type
+ attr_reader_ref :local_simpletype
+ attr_reader_ref :default
+ attr_reader_ref :fixed
+ attr_accessor :ref
attr_accessor :arytype
def initialize
super
- @ref = nil
@use = nil
@form = nil
@name = nil
@type = nil
+ @local_simpletype = nil
@default = nil
@fixed = nil
+ @ref = nil
+ @refelement = nil
@arytype = nil
end
+ def refelement
+ @refelement ||= root.collect_attributes[@ref]
+ end
+
def targetnamespace
parent.targetnamespace
end
def parse_element(element)
- nil
+ case element
+ when SimpleTypeName
+ @local_simpletype = SimpleType.new
+ @local_simpletype
+ end
end
def parse_attr(attr, value)
diff --git a/lib/wsdl/xmlSchema/complexContent.rb b/lib/wsdl/xmlSchema/complexContent.rb
index 66ad9e251d..eddb52f5ef 100644
--- a/lib/wsdl/xmlSchema/complexContent.rb
+++ b/lib/wsdl/xmlSchema/complexContent.rb
@@ -26,12 +26,17 @@ class ComplexContent < Info
@derivetype = nil
@content = nil
@attributes = XSD::NamedElements.new
+ @basetype = nil
end
def targetnamespace
parent.targetnamespace
end
+ def basetype
+ @basetype ||= root.collect_complextypes[@base]
+ end
+
def parse_element(element)
case element
when RestrictionName, ExtensionName
diff --git a/lib/wsdl/xmlSchema/data.rb b/lib/wsdl/xmlSchema/data.rb
index 10bc343adb..23ab1adf0b 100644
--- a/lib/wsdl/xmlSchema/data.rb
+++ b/lib/wsdl/xmlSchema/data.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema data definitions.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -7,10 +7,13 @@
require 'xsd/datatypes'
+require 'wsdl/xmlSchema/annotation'
require 'wsdl/xmlSchema/schema'
require 'wsdl/xmlSchema/import'
+require 'wsdl/xmlSchema/include'
require 'wsdl/xmlSchema/simpleType'
require 'wsdl/xmlSchema/simpleRestriction'
+require 'wsdl/xmlSchema/simpleExtension'
require 'wsdl/xmlSchema/complexType'
require 'wsdl/xmlSchema/complexContent'
require 'wsdl/xmlSchema/simpleContent'
@@ -22,12 +25,15 @@ require 'wsdl/xmlSchema/sequence'
require 'wsdl/xmlSchema/attribute'
require 'wsdl/xmlSchema/unique'
require 'wsdl/xmlSchema/enumeration'
+require 'wsdl/xmlSchema/length'
+require 'wsdl/xmlSchema/pattern'
module WSDL
module XMLSchema
AllName = XSD::QName.new(XSD::Namespace, 'all')
+AnnotationName = XSD::QName.new(XSD::Namespace, 'annotation')
AnyName = XSD::QName.new(XSD::Namespace, 'any')
AttributeName = XSD::QName.new(XSD::Namespace, 'attribute')
ChoiceName = XSD::QName.new(XSD::Namespace, 'choice')
@@ -37,6 +43,9 @@ ElementName = XSD::QName.new(XSD::Namespace, 'element')
EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration')
ExtensionName = XSD::QName.new(XSD::Namespace, 'extension')
ImportName = XSD::QName.new(XSD::Namespace, 'import')
+IncludeName = XSD::QName.new(XSD::Namespace, 'include')
+LengthName = XSD::QName.new(XSD::Namespace, 'length')
+PatternName = XSD::QName.new(XSD::Namespace, 'pattern')
RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction')
SequenceName = XSD::QName.new(XSD::Namespace, 'sequence')
SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
diff --git a/lib/wsdl/xmlSchema/element.rb b/lib/wsdl/xmlSchema/element.rb
index cc9d4e9ed8..584afe9dc6 100644
--- a/lib/wsdl/xmlSchema/element.rb
+++ b/lib/wsdl/xmlSchema/element.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema element definition for WSDL.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -14,23 +14,62 @@ module XMLSchema
class Element < Info
- attr_accessor :name # required
- attr_accessor :type
- attr_accessor :local_complextype
- attr_accessor :constraint
- attr_accessor :maxoccurs
- attr_accessor :minoccurs
- attr_accessor :nillable
-
- def initialize(name = nil, type = XSD::AnyTypeName)
+ class << self
+ if RUBY_VERSION > "1.7.0"
+ def attr_reader_ref(symbol)
+ name = symbol.to_s
+ self.__send__(:define_method, name, proc {
+ instance_variable_get("@#{name}") ||
+ (refelement ? refelement.__send__(name) : nil)
+ })
+ end
+ else
+ def attr_reader_ref(symbol)
+ name = symbol.to_s
+ module_eval <<-EOS
+ def #{name}
+ @#{name} || (refelement ? refelement.#{name} : nil)
+ end
+ EOS
+ end
+ end
+ end
+
+ attr_writer :name # required
+ attr_writer :type
+ attr_writer :local_simpletype
+ attr_writer :local_complextype
+ attr_writer :constraint
+ attr_writer :maxoccurs
+ attr_writer :minoccurs
+ attr_writer :nillable
+
+ attr_reader_ref :name
+ attr_reader_ref :type
+ attr_reader_ref :local_simpletype
+ attr_reader_ref :local_complextype
+ attr_reader_ref :constraint
+ attr_reader_ref :maxoccurs
+ attr_reader_ref :minoccurs
+ attr_reader_ref :nillable
+
+ attr_accessor :ref
+
+ def initialize(name = nil, type = nil)
super()
@name = name
@type = type
- @local_complextype = nil
+ @local_simpletype = @local_complextype = nil
@constraint = nil
@maxoccurs = '1'
@minoccurs = '1'
@nillable = nil
+ @ref = nil
+ @refelement = nil
+ end
+
+ def refelement
+ @refelement ||= root.collect_elements[@ref]
end
def targetnamespace
@@ -44,6 +83,9 @@ class Element < Info
def parse_element(element)
case element
+ when SimpleTypeName
+ @local_simpletype = SimpleType.new
+ @local_simpletype
when ComplexTypeName
@type = nil
@local_complextype = ComplexType.new
@@ -62,19 +104,19 @@ class Element < Info
@name = XSD::QName.new(targetnamespace, value.source)
when TypeAttrName
@type = value
+ when RefAttrName
+ @ref = value
when MaxOccursAttrName
if parent.is_a?(All)
if value.source != '1'
- raise Parser::AttrConstraintError.new(
- "Cannot parse #{ value } for #{ attr }.")
+ raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}")
end
end
@maxoccurs = value.source
when MinOccursAttrName
if parent.is_a?(All)
unless ['0', '1'].include?(value.source)
- raise Parser::AttrConstraintError.new(
- "Cannot parse #{ value } for #{ attr }.")
+ raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}")
end
end
@minoccurs = value.source
diff --git a/lib/wsdl/xmlSchema/import.rb b/lib/wsdl/xmlSchema/import.rb
index e65641330d..d3487af934 100644
--- a/lib/wsdl/xmlSchema/import.rb
+++ b/lib/wsdl/xmlSchema/import.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema import definition.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -7,6 +7,7 @@
require 'wsdl/info'
+require 'wsdl/xmlSchema/importer'
module WSDL
@@ -16,11 +17,13 @@ module XMLSchema
class Import < Info
attr_reader :namespace
attr_reader :schemalocation
+ attr_reader :content
def initialize
super
@namespace = nil
@schemalocation = nil
+ @content = nil
end
def parse_element(element)
@@ -32,11 +35,29 @@ class Import < Info
when NamespaceAttrName
@namespace = value.source
when SchemaLocationAttrName
- @schemalocation = value.source
+ @schemalocation = URI.parse(value.source)
+ if @schemalocation.relative? and !parent.location.nil? and
+ !parent.location.relative?
+ @schemalocation = parent.location + @schemalocation
+ end
+ if root.importedschema.key?(@schemalocation)
+ @content = root.importedschema[@schemalocation]
+ else
+ root.importedschema[@schemalocation] = nil # placeholder
+ @content = import(@schemalocation)
+ root.importedschema[@schemalocation] = @content
+ end
+ @schemalocation
else
nil
end
end
+
+private
+
+ def import(location)
+ Importer.import(location, root)
+ end
end
diff --git a/lib/wsdl/xmlSchema/parser.rb b/lib/wsdl/xmlSchema/parser.rb
index a7f1c29fd4..057d9d9b70 100644
--- a/lib/wsdl/xmlSchema/parser.rb
+++ b/lib/wsdl/xmlSchema/parser.rb
@@ -1,5 +1,5 @@
# WSDL4R - WSDL XML Instance parser library.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -51,6 +51,9 @@ public
@parser = XSD::XMLParser.create_parser(self, opt)
@parsestack = nil
@lastnode = nil
+ @ignored = {}
+ @location = opt[:location]
+ @originalroot = opt[:originalroot]
end
def parse(string_or_readable)
@@ -94,7 +97,7 @@ public
def end_element(name)
lastframe = @parsestack.pop
unless name == lastframe.name
- raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.")
+ raise UnexpectedElementError.new("closing element name '#{name}' does not match with opening element '#{lastframe.name}'")
end
decode_tag_end(lastframe.ns, lastframe.node)
@lastnode = lastframe.node
@@ -104,20 +107,31 @@ private
def decode_tag(ns, name, attrs, parent)
o = nil
- element = ns.parse(name)
+ elename = ns.parse(name)
if !parent
- if element == SchemaName
- o = Schema.parse_element(element)
+ if elename == SchemaName
+ o = Schema.parse_element(elename)
+ o.location = @location
else
- raise UnknownElementError.new("Unknown element #{ element }.")
+ raise UnknownElementError.new("unknown element: #{elename}")
end
+ o.root = @originalroot if @originalroot # o.root = o otherwise
else
- o = parent.parse_element(element)
+ if elename == AnnotationName
+ # only the first annotation element is allowed for each element.
+ o = Annotation.new
+ else
+ o = parent.parse_element(elename)
+ end
unless o
- STDERR.puts("Unknown element #{ element }.")
+ unless @ignored.key?(elename)
+ warn("ignored element: #{elename} of #{parent.class}")
+ @ignored[elename] = elename
+ end
o = Documentation.new # which accepts any element.
end
# node could be a pseudo element. pseudo element has its own parent.
+ o.root = parent.root
o.parent = parent if o.parent.nil?
end
attrs.each do |key, value|
@@ -127,9 +141,12 @@ private
if attr_ele == IdAttrName
o.id = value_ele
else
- unless o.parse_attr(attr_ele, value_ele)
- STDERR.puts("Unknown attr #{ attr_ele }.")
- end
+ unless o.parse_attr(attr_ele, value_ele)
+ unless @ignored.key?(attr_ele)
+ warn("ignored attr: #{attr_ele}")
+ @ignored[attr_ele] = attr_ele
+ end
+ end
end
end
o
diff --git a/lib/wsdl/xmlSchema/schema.rb b/lib/wsdl/xmlSchema/schema.rb
index ddd231bd97..43447f9fbf 100644
--- a/lib/wsdl/xmlSchema/schema.rb
+++ b/lib/wsdl/xmlSchema/schema.rb
@@ -24,6 +24,8 @@ class Schema < Info
attr_accessor :attributeformdefault
attr_accessor :elementformdefault
+ attr_reader :importedschema
+
def initialize
super
@targetnamespace = nil
@@ -33,6 +35,17 @@ class Schema < Info
@attributes = XSD::NamedElements.new
@imports = []
@elementformdefault = "qualified"
+ @importedschema = {}
+ @location = nil
+ @root = self
+ end
+
+ def location
+ @location || (root.nil? ? nil : root.location)
+ end
+
+ def location=(location)
+ @location = location
end
def parse_element(element)
@@ -41,6 +54,10 @@ class Schema < Info
o = Import.new
@imports << o
o
+ when IncludeName
+ o = Include.new
+ @imports << o
+ o
when ComplexTypeName
o = ComplexType.new
@complextypes << o
@@ -55,6 +72,7 @@ class Schema < Info
o
when AttributeName
o = Attribute.new
+ @attributes << o
o
else
nil
@@ -74,21 +92,39 @@ class Schema < Info
end
end
+ def collect_attributes
+ result = XSD::NamedElements.new
+ result.concat(@attributes)
+ @imports.each do |import|
+ result.concat(import.content.collect_attributes) if import.content
+ end
+ result
+ end
+
def collect_elements
result = XSD::NamedElements.new
result.concat(@elements)
+ @imports.each do |import|
+ result.concat(import.content.collect_elements) if import.content
+ end
result
end
def collect_complextypes
result = XSD::NamedElements.new
result.concat(@complextypes)
+ @imports.each do |import|
+ result.concat(import.content.collect_complextypes) if import.content
+ end
result
end
def collect_simpletypes
result = XSD::NamedElements.new
result.concat(@simpletypes)
+ @imports.each do |import|
+ result.concat(import.content.collect_simpletypes) if import.content
+ end
result
end
diff --git a/lib/wsdl/xmlSchema/simpleContent.rb b/lib/wsdl/xmlSchema/simpleContent.rb
index 0d83678a01..e1f35c88b8 100644
--- a/lib/wsdl/xmlSchema/simpleContent.rb
+++ b/lib/wsdl/xmlSchema/simpleContent.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema simpleContent definition for WSDL.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -15,17 +15,21 @@ module XMLSchema
class SimpleContent < Info
- attr_accessor :base
- attr_reader :derivetype
- attr_reader :content
- attr_reader :attributes
+ attr_reader :restriction
+ attr_reader :extension
+
+ def check_lexical_format(value)
+ check(value)
+ end
def initialize
super
- @base = nil
- @derivetype = nil
- @content = nil
- @attributes = XSD::NamedElements.new
+ @restriction = nil
+ @extension = nil
+ end
+
+ def base
+ content.base
end
def targetnamespace
@@ -34,28 +38,24 @@ class SimpleContent < Info
def parse_element(element)
case element
- when RestrictionName, ExtensionName
- @derivetype = element.name
- self
- when AttributeName
- if @derivetype.nil?
- raise Parser::ElementConstraintError.new("base attr not found.")
- end
- o = Attribute.new
- @attributes << o
- o
+ when RestrictionName
+ @restriction = SimpleRestriction.new
+ @restriction
+ when ExtensionName
+ @extension = SimpleExtension.new
+ @extension
end
end
- def parse_attr(attr, value)
- if @derivetype.nil?
- return nil
- end
- case attr
- when BaseAttrName
- @base = value
- else
- nil
+private
+
+ def content
+ @restriction || @extension
+ end
+
+ def check(value)
+ unless content.valid?(value)
+ raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
end
end
end
diff --git a/lib/wsdl/xmlSchema/simpleRestriction.rb b/lib/wsdl/xmlSchema/simpleRestriction.rb
index 6986e74423..e8bf3ebfa5 100644
--- a/lib/wsdl/xmlSchema/simpleRestriction.rb
+++ b/lib/wsdl/xmlSchema/simpleRestriction.rb
@@ -1,4 +1,4 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
+# WSDL4R - XMLSchema simpleContent restriction definition for WSDL.
# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
@@ -17,21 +17,32 @@ module XMLSchema
class SimpleRestriction < Info
attr_reader :base
attr_reader :enumeration
+ attr_accessor :length
+ attr_accessor :pattern
def initialize
super
@base = nil
@enumeration = [] # NamedElements?
+ @length = nil
+ @pattern = nil
end
def valid?(value)
- @enumeration.include?(value)
+ return false unless check_restriction(value)
+ return false unless check_length(value)
+ return false unless check_pattern(value)
+ true
end
def parse_element(element)
case element
when EnumerationName
Enumeration.new # just a parsing handler
+ when LengthName
+ Length.new # just a parsing handler
+ when PatternName
+ Pattern.new # just a parsing handler
end
end
@@ -41,6 +52,20 @@ class SimpleRestriction < Info
@base = value
end
end
+
+private
+
+ def check_restriction(value)
+ @enumeration.empty? or @enumeration.include?(value)
+ end
+
+ def check_length(value)
+ @length.nil? or value.size == @length
+ end
+
+ def check_pattern(value)
+ @pattern.nil? or @pattern =~ value
+ end
end
diff --git a/lib/wsdl/xmlSchema/simpleType.rb b/lib/wsdl/xmlSchema/simpleType.rb
index d9f76f345c..e808c318c4 100644
--- a/lib/wsdl/xmlSchema/simpleType.rb
+++ b/lib/wsdl/xmlSchema/simpleType.rb
@@ -1,5 +1,5 @@
# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2004, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -16,15 +16,11 @@ module XMLSchema
class SimpleType < Info
attr_accessor :name
- attr_reader :derivetype
attr_reader :restriction
def check_lexical_format(value)
if @restriction
check_restriction(value)
- elsif @extension
- raise NotImplementedError
- # ToDo
else
raise ArgumentError.new("incomplete simpleType")
end
@@ -33,8 +29,6 @@ class SimpleType < Info
def base
if @restriction
@restriction.base
- elsif @extension
- @extension.base
else
raise ArgumentError.new("incomplete simpleType")
end
@@ -43,7 +37,6 @@ class SimpleType < Info
def initialize(name = nil)
super()
@name = name
- @derivetype = nil
@restriction = nil
end
@@ -55,7 +48,6 @@ class SimpleType < Info
case element
when RestrictionName
@restriction = SimpleRestriction.new
- @derivetype = element.name
@restriction
end
end
@@ -71,7 +63,7 @@ private
def check_restriction(value)
unless @restriction.valid?(value)
- raise ::XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'.")
+ raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
end
end
end
diff --git a/lib/xsd/charset.rb b/lib/xsd/charset.rb
index acdea8bcf3..ccd22a7744 100644
--- a/lib/xsd/charset.rb
+++ b/lib/xsd/charset.rb
@@ -71,7 +71,7 @@ public
end
def Charset.encoding=(encoding)
- STDERR.puts("xsd charset is set to #{encoding}") if $DEBUG
+ warn("xsd charset is set to #{encoding}") if $DEBUG
@encoding = encoding
end
diff --git a/lib/xsd/codegen/classdef.rb b/lib/xsd/codegen/classdef.rb
index 8f72e95efd..9eb1ce6607 100644
--- a/lib/xsd/codegen/classdef.rb
+++ b/lib/xsd/codegen/classdef.rb
@@ -77,7 +77,7 @@ class ClassDef < ModuleDef
end
buf << dump_class_def_end
buf << dump_package_def_end(package) unless package.empty?
- buf
+ buf.gsub(/^\s+$/, '')
end
private
diff --git a/lib/xsd/codegen/commentdef.rb b/lib/xsd/codegen/commentdef.rb
index f98fade57d..c9493a1363 100644
--- a/lib/xsd/codegen/commentdef.rb
+++ b/lib/xsd/codegen/commentdef.rb
@@ -21,10 +21,10 @@ module CommentDef
private
def dump_comment
- if /^#/ =~ @comment
+ if /\A#/ =~ @comment
format(@comment)
else
- format(@comment).gsub(/^/, "# ")
+ format(@comment).gsub(/^/, '# ')
end
end
end
diff --git a/lib/xsd/codegen/gensupport.rb b/lib/xsd/codegen/gensupport.rb
index df90550fa0..854534154a 100644
--- a/lib/xsd/codegen/gensupport.rb
+++ b/lib/xsd/codegen/gensupport.rb
@@ -9,6 +9,49 @@
module XSD
module CodeGen
+# from the file 'keywords' in 1.9.
+KEYWORD = %w(
+__LINE__
+__FILE__
+BEGIN
+END
+alias
+and
+begin
+break
+case
+class
+def
+defined?
+do
+else
+elsif
+end
+ensure
+false
+for
+if
+in
+module
+next
+nil
+not
+or
+redo
+rescue
+retry
+return
+self
+super
+then
+true
+undef
+unless
+until
+when
+while
+yield
+)
module GenSupport
def capitalize(target)
@@ -25,7 +68,7 @@ module GenSupport
safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele|
GenSupport.capitalize(ele)
}.join
- unless /^[A-Z]/ =~ safename
+ if /^[A-Z]/ !~ safename or keyword?(safename)
safename = "C_#{safename}"
end
safename
@@ -33,12 +76,17 @@ module GenSupport
module_function :safeconstname
def safeconstname?(name)
- /\A[A-Z][a-zA-Z0-9_]*\z/ =~ name
+ /\A[A-Z][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
end
module_function :safeconstname?
def safemethodname(name)
- safevarname(name)
+ safename = name.scan(/[a-zA-Z0-9_]+/).join('_')
+ safename = uncapitalize(safename)
+ if /^[a-z]/ !~ safename
+ safename = "m_#{safename}"
+ end
+ safename
end
module_function :safemethodname
@@ -50,18 +98,23 @@ module GenSupport
def safevarname(name)
safename = name.scan(/[a-zA-Z0-9_]+/).join('_')
safename = uncapitalize(safename)
- unless /^[a-z]/ =~ safename
- safename = "m_#{safename}"
+ if /^[a-z]/ !~ safename or keyword?(safename)
+ safename = "v_#{safename}"
end
safename
end
module_function :safevarname
def safevarname?(name)
- /\A[a-z_][a-zA-Z0-9_]*\z/ =~ name
+ /\A[a-z_][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
end
module_function :safevarname?
+ def keyword?(word)
+ KEYWORD.include?(word)
+ end
+ module_function :keyword?
+
def format(str, indent = nil)
str = trim_eol(str)
str = trim_indent(str)
@@ -76,7 +129,7 @@ private
def trim_eol(str)
str.collect { |line|
- line.sub(/\r?\n$/, "") + "\n"
+ line.sub(/\r?\n\z/, "") + "\n"
}.join
end
diff --git a/lib/xsd/codegen/methoddef.rb b/lib/xsd/codegen/methoddef.rb
index 24a9168d58..15892fc5bf 100644
--- a/lib/xsd/codegen/methoddef.rb
+++ b/lib/xsd/codegen/methoddef.rb
@@ -34,7 +34,7 @@ class MethodDef
buf = ""
buf << dump_comment if @comment
buf << dump_method_def
- buf << dump_definition if @definition
+ buf << dump_definition if @definition and !@definition.empty?
buf << dump_method_def_end
buf
end
diff --git a/lib/xsd/codegen/moduledef.rb b/lib/xsd/codegen/moduledef.rb
index dc2746b2ee..744af2ff97 100644
--- a/lib/xsd/codegen/moduledef.rb
+++ b/lib/xsd/codegen/moduledef.rb
@@ -89,7 +89,7 @@ class ModuleDef
end
buf << dump_module_def_end
buf << dump_package_def_end(package) unless package.empty?
- buf
+ buf.gsub(/^\s+$/, '')
end
private
diff --git a/lib/xsd/datatypes.rb b/lib/xsd/datatypes.rb
index 5f77ea2e4a..d0fc44d69b 100644
--- a/lib/xsd/datatypes.rb
+++ b/lib/xsd/datatypes.rb
@@ -495,6 +495,18 @@ require 'date'
module XSDDateTimeImpl
SecInDay = 86400 # 24 * 60 * 60
+ def to_obj(klass)
+ if klass == Time
+ to_time
+ elsif klass == Date
+ to_date
+ elsif klass == DateTime
+ to_datetime
+ else
+ nil
+ end
+ end
+
def to_time
begin
if @data.offset * SecInDay == Time.now.utc_offset
@@ -511,6 +523,14 @@ module XSDDateTimeImpl
end
end
+ def to_date
+ Date.new0(@data.class.jd_to_ajd(@data.jd, 0, 0), 0, @data.start)
+ end
+
+ def to_datetime
+ data
+ end
+
def tz2of(str)
/^(?:Z|(?:([+\-])(\d\d):(\d\d))?)$/ =~ str
sign = $1
@@ -539,9 +559,18 @@ module XSDDateTimeImpl
end
def screen_data(t)
- if (t.is_a?(Date))
+ # convert t to a DateTime as an internal representation.
+ if t.is_a?(DateTime)
t
- elsif (t.is_a?(Time))
+ elsif t.is_a?(Date)
+ if t.respond_to?(:to_datetime) # from 1.9
+ t.to_datetime
+ else
+ t = screen_data_str(t)
+ t <<= 12 if t.year < 0
+ t
+ end
+ elsif t.is_a?(Time)
sec, min, hour, mday, month, year = t.to_a[0..5]
diffday = t.usec.to_r / 1000000 / SecInDay
of = t.utc_offset.to_r / SecInDay
diff --git a/lib/xsd/iconvcharset.rb b/lib/xsd/iconvcharset.rb
index cac66515e2..7e629d569b 100644
--- a/lib/xsd/iconvcharset.rb
+++ b/lib/xsd/iconvcharset.rb
@@ -22,7 +22,7 @@ class IconvCharset
out << e.success
ch, str = e.failed.split(//, 2)
out << '?'
- STDERR.puts("Failed to convert #{ch}")
+ warn("Failed to convert #{ch}")
retry
end
return out
diff --git a/lib/xsd/namedelements.rb b/lib/xsd/namedelements.rb
index f4d7c4f5aa..a13396bb71 100644
--- a/lib/xsd/namedelements.rb
+++ b/lib/xsd/namedelements.rb
@@ -1,5 +1,5 @@
# XSD4R - WSDL named element collection.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -23,6 +23,12 @@ class NamedElements
o
end
+ def freeze
+ super
+ @elements.freeze
+ self
+ end
+
def empty?
size == 0
end
@@ -43,6 +49,10 @@ class NamedElements
@elements.find { |item| item.name.name == name }
end
+ def keys
+ collect { |element| element.name }
+ end
+
def each
@elements.each do |element|
yield(element)
@@ -69,6 +79,8 @@ class NamedElements
self
end
+ Empty = NamedElements.new.freeze
+
protected
def elements=(rhs)
diff --git a/lib/xsd/ns.rb b/lib/xsd/ns.rb
index 66bd9caf43..b63a8a5cdd 100644
--- a/lib/xsd/ns.rb
+++ b/lib/xsd/ns.rb
@@ -1,5 +1,5 @@
# XSD4R - XML Schema Namespace library
-# Copyright (C) 2000, 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -20,7 +20,7 @@ class NS
def assign(ns)
@count += 1
- "n#{ @count }"
+ "n#{@count}"
end
end
@@ -54,7 +54,7 @@ public
end
def assigned?(ns)
- @ns2tag.key?(ns)
+ @default_namespace == ns or @ns2tag.key?(ns)
end
def assigned_tag?(tag)
@@ -74,7 +74,7 @@ public
elsif @ns2tag.key?(name.namespace)
@ns2tag[name.namespace] + ':' << name.name
else
- raise FormatError.new('Namespace: ' << name.namespace << ' not defined yet.')
+ raise FormatError.new("namespace: #{name.namespace} not defined yet")
end
end
@@ -83,7 +83,7 @@ public
return true if (name == rhs)
end
@tag2ns.each do |assigned_tag, assigned_ns|
- if assigned_ns == ns && "#{ assigned_tag }:#{ name }" == rhs
+ if assigned_ns == ns && "#{assigned_tag}:#{name}" == rhs
return true
end
end
@@ -103,22 +103,22 @@ public
end
# For local attribute key parsing
- # <foo xmlns="urn:" xmlns:n1="urn:" bar="1" n1:baz="2" />
+ # <foo xmlns="urn:a" xmlns:n1="urn:a" bar="1" n1:baz="2" />
# =>
- # {}bar, {urn:}baz
+ # {}bar, {urn:a}baz
def parse_local(elem)
ParseRegexp =~ elem
if $2
ns = @tag2ns[$1]
name = $2
if !ns
- raise FormatError.new('Unknown namespace qualifier: ' << $1)
+ raise FormatError.new("unknown namespace qualifier: #{$1}")
end
elsif $1
ns = nil
name = $1
else
- raise FormatError.new("Illegal element format: #{ elem }")
+ raise FormatError.new("illegal element format: #{elem}")
end
XSD::QName.new(ns, name)
end
diff --git a/lib/xsd/qname.rb b/lib/xsd/qname.rb
index ed1fa41f98..18b002764b 100644
--- a/lib/xsd/qname.rb
+++ b/lib/xsd/qname.rb
@@ -24,6 +24,12 @@ class QName
XSD::QName.new(@namespace, name)
end
+ def dump
+ ns = @namespace.nil? ? 'nil' : @namespace.dump
+ name = @name.nil? ? 'nil' : @name.dump
+ "XSD::QName.new(#{ns}, #{name})"
+ end
+
def match(rhs)
unless self.class === rhs
return false
diff --git a/lib/xsd/xmlparser.rb b/lib/xsd/xmlparser.rb
index 1f87ae2e4d..e79e36c58c 100644
--- a/lib/xsd/xmlparser.rb
+++ b/lib/xsd/xmlparser.rb
@@ -45,8 +45,8 @@ end
# Try to load XML processor.
loaded = false
[
- 'xsd/xmlparser/xmlscanner',
'xsd/xmlparser/xmlparser',
+ 'xsd/xmlparser/xmlscanner',
'xsd/xmlparser/rexmlparser',
].each do |lib|
begin
diff --git a/lib/xsd/xmlparser/xmlscanner.rb b/lib/xsd/xmlparser/xmlscanner.rb
index c2ad51be52..c80dc23910 100644
--- a/lib/xsd/xmlparser/xmlscanner.rb
+++ b/lib/xsd/xmlparser/xmlscanner.rb
@@ -1,5 +1,5 @@
# XSD4R - XMLScan XML parser library.
-# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
+# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
@@ -21,12 +21,12 @@ class XMLScanner < XSD::XMLParser::Parser
@attrs = {}
@curattr = nil
@scanner = XMLScan::XMLScanner.new(self)
- @scanner.kcode = ::XSD::Charset.charset_str(charset) if charset
+ @scanner.kcode = XSD::Charset.charset_str(charset) if charset
@scanner.parse(string_or_readable)
end
def scanner_kcode=(charset)
- @scanner.kcode = ::XSD::Charset.charset_str(charset) if charset
+ @scanner.kcode = XSD::Charset.charset_str(charset) if charset
self.xmldecl_encoding = charset
end
diff --git a/sample/soap/authheader/authmgr.rb b/sample/soap/authheader/authmgr.rb
deleted file mode 100644
index a4d3b66c0d..0000000000
--- a/sample/soap/authheader/authmgr.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class Authmgr
- def initialize
- @users = {
- 'NaHi' => 'passwd',
- 'HiNa' => 'wspass'
- }
- @sessions = {}
- end
-
- def login(userid, passwd)
- userid and passwd and @users[userid] == passwd
- end
-
- # returns userid
- def auth(sessionid)
- @sessions[sessionid]
- end
-
- def create_session(userid)
- while true
- key = create_sessionkey
- break unless @sessions[key]
- end
- @sessions[key] = userid
- key
- end
-
- def get_session(userid)
- @sessions.index(userid)
- end
-
- def destroy_session(sessionkey)
- @sessions.delete(sessionkey)
- end
-
-private
-
- def create_sessionkey
- Time.now.usec.to_s
- end
-end
diff --git a/sample/soap/authheader/client.rb b/sample/soap/authheader/client.rb
deleted file mode 100644
index 4055fe63fe..0000000000
--- a/sample/soap/authheader/client.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'soap/rpc/driver'
-require 'soap/header/simplehandler'
-
-server = ARGV.shift || 'http://localhost:7000/'
-
-class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
-
- def initialize(userid, passwd)
- super(MyHeaderName)
- @sessionid = nil
- @userid = userid
- @passwd = passwd
- @mustunderstand = true
- end
-
- def on_simple_outbound
- if @sessionid
- { "sessionid" => @sessionid }
- else
- { "userid" => @userid, "passwd" => @passwd }
- end
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- @sessionid = my_header["sessionid"]
- end
-end
-
-ns = 'http://tempuri.org/authHeaderPort'
-serv = SOAP::RPC::Driver.new(server, ns)
-serv.add_method('deposit', 'amt')
-serv.add_method('withdrawal', 'amt')
-
-serv.headerhandler << ClientAuthHeaderHandler.new('NaHi', 'passwd')
-
-serv.wiredump_dev = STDOUT
-
-p serv.deposit(150)
-p serv.withdrawal(120)
diff --git a/sample/soap/authheader/client2.rb b/sample/soap/authheader/client2.rb
deleted file mode 100644
index aa5172a5b1..0000000000
--- a/sample/soap/authheader/client2.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'soap/rpc/driver'
-require 'soap/header/simplehandler'
-
-server = ARGV.shift || 'http://localhost:7000/'
-
-class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
-
- attr_accessor :sessionid
-
- def initialize
- super(MyHeaderName)
- @sessionid = nil
- end
-
- def on_simple_outbound
- if @sessionid
- { "sessionid" => @sessionid }
- end
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- @sessionid = my_header["sessionid"]
- end
-end
-
-ns = 'http://tempuri.org/authHeaderPort'
-serv = SOAP::RPC::Driver.new(server, ns)
-serv.add_method('login', 'userid', 'passwd')
-serv.add_method('deposit', 'amt')
-serv.add_method('withdrawal', 'amt')
-
-h = ClientAuthHeaderHandler.new
-
-serv.headerhandler << h
-
-serv.wiredump_dev = STDOUT
-
-sessionid = serv.login('NaHi', 'passwd')
-h.sessionid = sessionid
-p serv.deposit(150)
-p serv.withdrawal(120)
diff --git a/sample/soap/authheader/server.rb b/sample/soap/authheader/server.rb
deleted file mode 100644
index 9c6adf280d..0000000000
--- a/sample/soap/authheader/server.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'soap/header/simplehandler'
-require 'authmgr'
-
-class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
- class AuthHeaderService
- def self.create
- new
- end
-
- def deposit(amt)
- "deposit #{amt} OK"
- end
-
- def withdrawal(amt)
- "withdrawal #{amt} OK"
- end
- end
-
- Name = 'http://tempuri.org/authHeaderPort'
- def initialize(*arg)
- super
- add_rpc_servant(AuthHeaderService.new, Name)
- # header handler must be a per request handler.
- add_rpc_request_headerhandler(ServerAuthHeaderHandler)
- end
-
- class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
-
- @authmgr = Authmgr.new
- def self.create
- new(@authmgr)
- end
-
- def initialize(authmgr)
- super(MyHeaderName)
- @authmgr = authmgr
- @userid = @sessionid = nil
- end
-
- def on_simple_outbound
- { "sessionid" => @sessionid }
- end
-
- def on_simple_inbound(my_header, mu)
- auth = false
- userid = my_header["userid"]
- passwd = my_header["passwd"]
- if @authmgr.login(userid, passwd)
- auth = true
- elsif sessionid = my_header["sessionid"]
- if userid = @authmgr.auth(sessionid)
- @authmgr.destroy_session(sessionid)
- auth = true
- end
- end
- raise RuntimeError.new("authentication failed") unless auth
- @userid = userid
- @sessionid = @authmgr.create_session(userid)
- end
- end
-end
-
-if $0 == __FILE__
- svr = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000)
- trap(:INT) do
- svr.shutdown
- end
- status = svr.start
-end
diff --git a/sample/soap/authheader/server2.rb b/sample/soap/authheader/server2.rb
deleted file mode 100644
index 8a0eaafc8d..0000000000
--- a/sample/soap/authheader/server2.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'soap/header/simplehandler'
-require 'authmgr'
-
-class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
- class AuthHeaderService
- def initialize(authmgr)
- @authmgr = authmgr
- end
-
- def login(userid, passwd)
- if @authmgr.login(userid, passwd)
- @authmgr.create_session(userid)
- else
- raise RuntimeError.new("authentication failed")
- end
- end
-
- def deposit(amt)
- "deposit #{amt} OK"
- end
-
- def withdrawal(amt)
- "withdrawal #{amt} OK"
- end
- end
-
- Name = 'http://tempuri.org/authHeaderPort'
- def initialize(*arg)
- super
- authmgr = Authmgr.new
- add_rpc_servant(AuthHeaderService.new(authmgr), Name)
- ServerAuthHeaderHandler.init(authmgr)
- # header handler must be a per request handler.
- add_rpc_request_headerhandler(ServerAuthHeaderHandler)
- end
-
- class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
-
- def self.init(authmgr)
- @authmgr = authmgr
- end
-
- def self.create
- new(@authmgr)
- end
-
- def initialize(authmgr)
- super(MyHeaderName)
- @authmgr = authmgr
- @sessionid = nil
- end
-
- def on_simple_outbound
- if @sessionid
- { "sessionid" => @sessionid }
- end
- end
-
- def on_simple_inbound(my_header, mu)
- auth = false
- if sessionid = my_header["sessionid"]
- if userid = @authmgr.auth(sessionid)
- @authmgr.destroy_session(sessionid)
- @sessionid = @authmgr.create_session(userid)
- auth = true
- end
- end
- raise RuntimeError.new("authentication failed") unless auth
- end
- end
-end
-
-if $0 == __FILE__
- svr = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000)
- trap(:INT) do
- svr.shutdown
- end
- status = svr.start
-end
diff --git a/sample/soap/babelfish.rb b/sample/soap/babelfish.rb
deleted file mode 100644
index eb2421449a..0000000000
--- a/sample/soap/babelfish.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ruby
-
-text = ARGV.shift || 'Hello world.'
-lang = ARGV.shift || 'en_fr'
-
-require 'soap/rpc/driver'
-
-server = 'http://services.xmethods.net/perl/soaplite.cgi'
-InterfaceNS = 'urn:xmethodsBabelFish'
-wireDumpDev = nil # STDERR
-
-drv = SOAP::RPC::Driver.new(server, InterfaceNS)
-drv.wiredump_dev = wireDumpDev
-drv.add_method_with_soapaction('BabelFish', InterfaceNS + "#BabelFish", 'translationmode', 'sourcedata')
-
-p drv.BabelFish(lang, text)
diff --git a/sample/soap/calc/calc.rb b/sample/soap/calc/calc.rb
deleted file mode 100644
index 6bc78803b3..0000000000
--- a/sample/soap/calc/calc.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module CalcService
- def self.add(lhs, rhs)
- lhs + rhs
- end
-
- def self.sub(lhs, rhs)
- lhs - rhs
- end
-
- def self.multi(lhs, rhs)
- lhs * rhs
- end
-
- def self.div(lhs, rhs)
- lhs / rhs
- end
-end
diff --git a/sample/soap/calc/calc2.rb b/sample/soap/calc/calc2.rb
deleted file mode 100644
index e9cf6bbca7..0000000000
--- a/sample/soap/calc/calc2.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class CalcService2
- def initialize(value = 0)
- @value = value
- end
-
- def set(value)
- @value = value
- end
-
- def get
- @value
- end
-
- def +(rhs)
- @value + rhs
- end
-
- def -(rhs)
- @value - rhs
- end
-
- def *(rhs)
- @value * rhs
- end
-
- def /(rhs)
- @value / rhs
- end
-end
diff --git a/sample/soap/calc/client.rb b/sample/soap/calc/client.rb
deleted file mode 100644
index 57a4c0ba5b..0000000000
--- a/sample/soap/calc/client.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'soap/rpc/driver'
-
-server = ARGV.shift || 'http://localhost:7000/'
-# server = 'http://localhost:8808/server.cgi'
-
-calc = SOAP::RPC::Driver.new(server, 'http://tempuri.org/calcService')
-#calc.wiredump_dev = STDERR
-calc.add_method('add', 'lhs', 'rhs')
-calc.add_method('sub', 'lhs', 'rhs')
-calc.add_method('multi', 'lhs', 'rhs')
-calc.add_method('div', 'lhs', 'rhs')
-
-puts 'add: 1 + 2 # => 3'
-puts calc.add(1, 2)
-puts 'sub: 1.1 - 2.2 # => -1.1'
-puts calc.sub(1.1, 2.2)
-puts 'multi: 1.1 * 2.2 # => 2.42'
-puts calc.multi(1.1, 2.2)
-puts 'div: 5 / 2 # => 2'
-puts calc.div(5, 2)
-puts 'div: 5.0 / 2 # => 2.5'
-puts calc.div(5.0, 2)
-puts 'div: 1.1 / 0 # => Infinity'
-puts calc.div(1.1, 0)
-puts 'div: 1 / 0 # => ZeroDivisionError'
-puts calc.div(1, 0)
diff --git a/sample/soap/calc/client2.rb b/sample/soap/calc/client2.rb
deleted file mode 100644
index 2c53f09d42..0000000000
--- a/sample/soap/calc/client2.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'soap/rpc/driver'
-
-server = ARGV.shift || 'http://localhost:7000/'
-# server = 'http://localhost:8808/server2.cgi'
-
-var = SOAP::RPC::Driver.new( server, 'http://tempuri.org/calcService' )
-var.add_method( 'set', 'newValue' )
-var.add_method( 'get' )
-var.add_method_as( '+', 'add', 'rhs' )
-var.add_method_as( '-', 'sub', 'rhs' )
-var.add_method_as( '*', 'multi', 'rhs' )
-var.add_method_as( '/', 'div', 'rhs' )
-
-puts 'var.set( 1 )'
-puts '# Bare in mind that another client set another value to this service.'
-puts '# This is only a sample for proof of concept.'
-var.set( 1 )
-puts 'var + 2 # => 1 + 2 = 3'
-puts var + 2
-puts 'var - 2.2 # => 1 - 2.2 = -1.2'
-puts var - 2.2
-puts 'var * 2.2 # => 1 * 2.2 = 2.2'
-puts var * 2.2
-puts 'var / 2 # => 1 / 2 = 0'
-puts var / 2
-puts 'var / 2.0 # => 1 / 2.0 = 0.5'
-puts var / 2.0
-puts 'var / 0 # => 1 / 0 => ZeroDivisionError'
-puts var / 0
diff --git a/sample/soap/calc/httpd.rb b/sample/soap/calc/httpd.rb
deleted file mode 100644
index bebcff96c6..0000000000
--- a/sample/soap/calc/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/soap/calc/samplehttpd.conf b/sample/soap/calc/samplehttpd.conf
deleted file mode 100644
index 85e9995021..0000000000
--- a/sample/soap/calc/samplehttpd.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-docroot = .
-port = 8808
diff --git a/sample/soap/calc/server.cgi b/sample/soap/calc/server.cgi
deleted file mode 100644
index c4fa687550..0000000000
--- a/sample/soap/calc/server.cgi
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/cgistub'
-
-class CalcServer < SOAP::RPC::CGIStub
- def initialize(*arg)
- super
-
- require 'calc'
- servant = CalcService
- add_servant(servant, 'http://tempuri.org/calcService')
- end
-end
-
-status = CalcServer.new('CalcServer', nil).start
diff --git a/sample/soap/calc/server.rb b/sample/soap/calc/server.rb
deleted file mode 100644
index 97661be9d3..0000000000
--- a/sample/soap/calc/server.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'calc'
-
-class CalcServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
-
- servant = CalcService
- add_servant(servant, 'http://tempuri.org/calcService')
- end
-end
-
-if $0 == __FILE__
- server = CalcServer.new('CalcServer', nil, '0.0.0.0', 7000)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/sample/soap/calc/server2.rb b/sample/soap/calc/server2.rb
deleted file mode 100644
index bb0f643d77..0000000000
--- a/sample/soap/calc/server2.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'calc2'
-
-class CalcServer2 < SOAP::RPC::StandaloneServer
- def on_init
- servant = CalcService2.new
- add_method(servant, 'set', 'newValue')
- add_method(servant, 'get')
- add_method_as(servant, '+', 'add', 'lhs')
- add_method_as(servant, '-', 'sub', 'lhs')
- add_method_as(servant, '*', 'multi', 'lhs')
- add_method_as(servant, '/', 'div', 'lhs')
- end
-end
-
-if $0 == __FILE__
- server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', 7000)
- trap(:INT) do
- server.shutdown
- end
- status = server.start
-end
diff --git a/sample/soap/digraph.rb b/sample/soap/digraph.rb
deleted file mode 100644
index 54ff302592..0000000000
--- a/sample/soap/digraph.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-require 'soap/marshal'
-
-class Node; include SOAP::Marshallable
- attr_reader :first, :second, :str
-
- def initialize(*init_next)
- @first = init_next[0]
- @second = init_next[1]
- end
-end
-
-n9 = Node.new
-n81 = Node.new(n9)
-n82 = Node.new(n9)
-n7 = Node.new(n81, n82)
-n61 = Node.new(n7)
-n62 = Node.new(n7)
-n5 = Node.new(n61, n62)
-n41 = Node.new(n5)
-n42 = Node.new(n5)
-n3 = Node.new(n41, n42)
-n21 = Node.new(n3)
-n22 = Node.new(n3)
-n1 = Node.new(n21, n22)
-
-File.open("digraph_marshalled_string.soap", "wb") do |f|
- SOAP::Marshal.dump(n1, f)
-end
-
-marshalledString = File.open("digraph_marshalled_string.soap") { |f| f.read }
-
-puts marshalledString
-
-newnode = SOAP::Marshal.unmarshal(marshalledString)
-
-puts newnode.inspect
-
-p newnode.first.first.__id__
-p newnode.second.first.__id__
-p newnode.first.first.first.first.__id__
-p newnode.second.first.second.first.__id__
-
-File.unlink("digraph_marshalled_string.soap")
diff --git a/sample/soap/exchange/client.rb b/sample/soap/exchange/client.rb
deleted file mode 100644
index 2aa277afef..0000000000
--- a/sample/soap/exchange/client.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env ruby
-
-require "soap/rpc/driver"
-
-ExchangeServiceNamespace = 'http://tempuri.org/exchangeService'
-
-server = ARGV.shift || "http://localhost:7000/"
-# server = "http://localhost:8808/server.cgi"
-
-logger = nil
-wiredump_dev = nil
-# logger = Logger.new(STDERR)
-# wiredump_dev = STDERR
-
-drv = SOAP::RPC::Driver.new(server, ExchangeServiceNamespace)
-drv.wiredump_dev = wiredump_dev
-drv.add_method("rate", "country1", "country2")
-
-p drv.rate("USA", "Japan")
diff --git a/sample/soap/exchange/exchange.rb b/sample/soap/exchange/exchange.rb
deleted file mode 100644
index 00f930deb8..0000000000
--- a/sample/soap/exchange/exchange.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'soap/rpc/driver'
-
-ExchangeServiceNamespace = 'http://tempuri.org/exchangeService'
-
-class Exchange
- ForeignServer = "http://services.xmethods.net/soap"
- Namespace = "urn:xmethods-CurrencyExchange"
-
- def initialize
- @drv = SOAP::RPC::Driver.new(ForeignServer, Namespace)
- @drv.add_method("getRate", "country1", "country2")
- end
-
- def rate(country1, country2)
- return @drv.getRate(country1, country2)
- end
-end
diff --git a/sample/soap/exchange/httpd.rb b/sample/soap/exchange/httpd.rb
deleted file mode 100644
index bebcff96c6..0000000000
--- a/sample/soap/exchange/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/soap/exchange/samplehttpd.conf b/sample/soap/exchange/samplehttpd.conf
deleted file mode 100644
index 85e9995021..0000000000
--- a/sample/soap/exchange/samplehttpd.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-docroot = .
-port = 8808
diff --git a/sample/soap/exchange/server.cgi b/sample/soap/exchange/server.cgi
deleted file mode 100644
index 16bc85a042..0000000000
--- a/sample/soap/exchange/server.cgi
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/local/bin/ruby
-
-require 'soap/rpc/cgistub'
-require 'exchange'
-
-class ExchangeServer < SOAP::RPC::CGIStub
- def initialize(*arg)
- super
- servant = Exchange.new
- add_servant(servant)
- end
-end
-
-status = ExchangeServer.new('SampleStructServer', ExchangeServiceNamespace).start
diff --git a/sample/soap/exchange/server.rb b/sample/soap/exchange/server.rb
deleted file mode 100644
index d510d54a76..0000000000
--- a/sample/soap/exchange/server.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'exchange'
-
-class ExchangeServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
- servant = Exchange.new
- add_servant(servant)
- end
-end
-
-if $0 == __FILE__
- status = ExchangeServer.new('SampleStructServer', ExchangeServiceNamespace, '0.0.0.0', 7000).start
-end
diff --git a/sample/soap/helloworld/hw_c.rb b/sample/soap/helloworld/hw_c.rb
deleted file mode 100644
index 253d0a409b..0000000000
--- a/sample/soap/helloworld/hw_c.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'soap/rpc/driver'
-
-s = SOAP::RPC::Driver.new('http://localhost:2000/', 'urn:hws')
-s.add_method("hello_world", "from")
-
-p s.hello_world(self.to_s)
diff --git a/sample/soap/helloworld/hw_c_gzip.rb b/sample/soap/helloworld/hw_c_gzip.rb
deleted file mode 100644
index 3335b5f571..0000000000
--- a/sample/soap/helloworld/hw_c_gzip.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'soap/rpc/driver'
-
-s = SOAP::RPC::Driver.new('http://localhost:2000/', 'urn:hws')
-s.add_method("hello_world", "from")
-#s.wiredump_dev = STDOUT # care about binary output.
-s.streamhandler.accept_encoding_gzip = true
-
-p s.hello_world(self.to_s)
diff --git a/sample/soap/helloworld/hw_s.rb b/sample/soap/helloworld/hw_s.rb
deleted file mode 100644
index f9f819a19f..0000000000
--- a/sample/soap/helloworld/hw_s.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require 'soap/rpc/standaloneServer'
-
-class HelloWorldServer < SOAP::RPC::StandaloneServer
- def on_init
- @log.level = Logger::Severity::DEBUG
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-if $0 == __FILE__
- server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', 2000)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/sample/soap/helloworld/hw_s_gzip.rb b/sample/soap/helloworld/hw_s_gzip.rb
deleted file mode 100644
index d124df0e04..0000000000
--- a/sample/soap/helloworld/hw_s_gzip.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'soap/rpc/standaloneServer'
-
-class HelloWorldServer < SOAP::RPC::StandaloneServer
- def on_init
- @soaplet.allow_content_encoding_gzip = true
- @log.level = Logger::Severity::DEBUG
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-if $0 == __FILE__
- server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', 2000)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/sample/soap/icd/IICD.rb b/sample/soap/icd/IICD.rb
deleted file mode 100644
index 3b1fa9b32c..0000000000
--- a/sample/soap/icd/IICD.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module IICD
- # All methods in a single namespace?!
- InterfaceNS = 'http://www.iwebmethod.net'
-
- Methods = [
- ['SearchWord', 'query', 'partial'],
- ['GetItemById', 'id'],
- ['EnumWords'],
- ['FullTextSearch', 'query'],
- ]
-
- def IICD.add_method(drv)
- Methods.each do |method, *param|
- drv.add_method_with_soapaction(method, InterfaceNS + "/#{ method }", *param )
- end
- end
-end
diff --git a/sample/soap/icd/icd.rb b/sample/soap/icd/icd.rb
deleted file mode 100644
index 6e1e51c996..0000000000
--- a/sample/soap/icd/icd.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env ruby
-
-$KCODE = 'SJIS'
-
-require 'soap/rpc/driver'
-require 'IICD'; include IICD
-
-server = 'http://www.iwebmethod.net/icd1.0/icd.asmx'
-wiredump_dev = nil # STDERR
-
-icd = SOAP::RPC::Driver.new(server, IICD::InterfaceNS)
-icd.wiredump_dev = wiredump_dev
-icd.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
-IICD::add_method(icd)
-
-puts "ƒL[ƒ[ƒh: 'microsoft'‚ÅŒ©o‚µŒŸõ"
-result = icd.SearchWord('microsoft', true)
-
-id = nil
-result.WORD.each do |word|
- puts "Title: " << word.title
- puts "Id: " << word.id
- puts "English: " << word.english
- puts "Japanese: " << word.japanese
- puts "----"
- id = word.id
-end
-
-item = icd.GetItemById(id)
-puts
-puts
-puts "Title: " << item.word.title
-puts "ˆÓ–¡: " << item.meaning
-
-#p icd.EnumWords
-
-puts
-puts
-puts "ƒL[ƒ[ƒh: 'IBM'‚Å‘S•¶ŒŸõ"
-icd.FullTextSearch("IBM").WORD.each do |word|
- puts "Title: " << word.title
- puts "Id: " << word.id
- puts "English: " << word.english
- puts "Japanese: " << word.japanese
- puts "----"
-end
diff --git a/sample/soap/raa/iRAA.rb b/sample/soap/raa/iRAA.rb
deleted file mode 100644
index 2b188fb887..0000000000
--- a/sample/soap/raa/iRAA.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-require 'soap/mapping'
-
-
-module RAA; extend SOAP
-
-
-InterfaceNS = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-MappingRegistry = SOAP::Mapping::Registry.new
-
-Methods = [
- ['getAllListings', ['retval', 'return']],
- ['getProductTree', ['retval', 'return']],
- ['getInfoFromCategory', ['in', 'category'], [ 'retval', 'return']],
- ['getModifiedInfoSince', ['in', 'time'], [ 'retval', 'return']],
- ['getInfoFromName', ['in', 'name'], ['retval', 'return']],
-]
-
-
-class Category
- include SOAP::Marshallable
-
- @@schema_type = 'Category'
- @@schema_ns = InterfaceNS
-
- attr_reader :major, :minor
-
- def initialize(major, minor = nil)
- @major = major
- @minor = minor
- end
-
- def to_s
- "#{ @major }/#{ @minor }"
- end
-
- def ==(rhs)
- if @major != rhs.major
- false
- elsif !@minor or !rhs.minor
- true
- else
- @minor == rhs.minor
- end
- end
-end
-
-MappingRegistry.set(
- ::RAA::Category,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new(InterfaceNS, "Category") }
-)
-
-class Product
- include SOAP::Marshallable
-
- @@schema_type = 'Product'
- @@schema_ns = InterfaceNS
-
- attr_reader :id, :name
- attr_accessor :short_description, :version, :status, :homepage, :download, :license, :description
-
- def initialize(name, short_description = nil, version = nil, status = nil, homepage = nil, download = nil, license = nil, description = nil)
- @name = name
- @short_description = short_description
- @version = version
- @status = status
- @homepage = homepage
- @download = download
- @license = license
- @description = description
- end
-end
-
-MappingRegistry.set(
- ::RAA::Product,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new(InterfaceNS, "Product") }
-)
-
-class Owner
- include SOAP::Marshallable
-
- @@schema_type = 'Owner'
- @@schema_ns = InterfaceNS
-
- attr_reader :id
- attr_accessor :email, :name
-
- def initialize(email, name)
- @email = email
- @name = name
- @id = "#{ @email }-#{ @name }"
- end
-end
-
-MappingRegistry.set(
- ::RAA::Owner,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new(InterfaceNS, "Owner") }
-)
-
-class Info
- include SOAP::Marshallable
-
- @@schema_type = 'Info'
- @@schema_ns = InterfaceNS
-
- attr_accessor :category, :product, :owner, :updated, :created
-
- def initialize(category = nil, product = nil, owner = nil, updated = nil, created = nil)
- @category = category
- @product = product
- @owner = owner
- @updated = updated
- @created = created
- end
-
- def <=>(rhs)
- @updated <=> rhs.updated
- end
-
- def eql?(rhs)
- @product.name == rhs.product.name
- end
-end
-
-MappingRegistry.set(
- ::RAA::Info,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new(InterfaceNS, "Info") }
-)
-
-class StringArray < Array; end
-MappingRegistry.set(
- ::RAA::StringArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::XSDString::Type }
-)
-
-class InfoArray < Array; end
-MappingRegistry.set(
- ::RAA::InfoArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new(InterfaceNS, 'Info') }
-)
-
-
-end
diff --git a/sample/soap/raa/soap4r.rb b/sample/soap/raa/soap4r.rb
deleted file mode 100644
index b93d1e7dbe..0000000000
--- a/sample/soap/raa/soap4r.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'iRAA'
-require 'soap/rpc/driver'
-
-
-server = ARGV.shift || 'http://raa.ruby-lang.org/soap/1.0.2/'
-
-raa = SOAP::RPC::Driver.new(server, RAA::InterfaceNS)
-raa.mapping_registry = RAA::MappingRegistry
-RAA::Methods.each do |name, *params|
- raa.add_method(name, params)
-end
-# raa.wiredump_dev = STDOUT
-
-p raa.getAllListings().sort
-
-p raa.getProductTree()
-
-p raa.getInfoFromCategory(RAA::Category.new("Library", "XML"))
-
-t = Time.at(Time.now.to_i - 24 * 3600)
-p raa.getModifiedInfoSince(t)
-
-p raa.getModifiedInfoSince(DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec))
-
-o = raa.getInfoFromName("SOAP4R")
-p o.class
-p o.owner.name
-p o
diff --git a/sample/soap/raa2.4/raa.rb b/sample/soap/raa2.4/raa.rb
deleted file mode 100644
index 9b4c4e41aa..0000000000
--- a/sample/soap/raa2.4/raa.rb
+++ /dev/null
@@ -1,332 +0,0 @@
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Gem
- @@schema_type = "Gem"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def category
- @category
- end
-
- def category=(value)
- @category = value
- end
-
- def owner
- @owner
- end
-
- def owner=(value)
- @owner = value
- end
-
- def project
- @project
- end
-
- def project=(value)
- @project = value
- end
-
- def updated
- @updated
- end
-
- def updated=(value)
- @updated = value
- end
-
- def created
- @created
- end
-
- def created=(value)
- @created = value
- end
-
- def initialize(id = nil,
- category = nil,
- owner = nil,
- project = nil,
- updated = nil,
- created = nil)
- @id = id
- @category = category
- @owner = owner
- @project = project
- @updated = updated
- @created = created
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Category
- @@schema_type = "Category"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def major
- @major
- end
-
- def major=(value)
- @major = value
- end
-
- def minor
- @minor
- end
-
- def minor=(value)
- @minor = value
- end
-
- def initialize(major = nil,
- minor = nil)
- @major = major
- @minor = minor
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Owner
- @@schema_type = "Owner"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def email
- @email
- end
-
- def email=(value)
- @email = value
- end
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def initialize(id = nil,
- email = nil,
- name = nil)
- @id = id
- @email = email
- @name = name
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Project
- @@schema_type = "Project"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def short_description
- @short_description
- end
-
- def short_description=(value)
- @short_description = value
- end
-
- def version
- @version
- end
-
- def version=(value)
- @version = value
- end
-
- def status
- @status
- end
-
- def status=(value)
- @status = value
- end
-
- def url
- @url
- end
-
- def url=(value)
- @url = value
- end
-
- def download
- @download
- end
-
- def download=(value)
- @download = value
- end
-
- def license
- @license
- end
-
- def license=(value)
- @license = value
- end
-
- def description
- @description
- end
-
- def description=(value)
- @description = value
- end
-
- def updated
- @updated
- end
-
- def updated=(value)
- @updated = value
- end
-
- def history
- @history
- end
-
- def history=(value)
- @history = value
- end
-
- def dependency
- @dependency
- end
-
- def dependency=(value)
- @dependency = value
- end
-
- def initialize(name = nil,
- short_description = nil,
- version = nil,
- status = nil,
- url = nil,
- download = nil,
- license = nil,
- description = nil,
- updated = nil,
- history = nil,
- dependency = nil)
- @name = name
- @short_description = short_description
- @version = version
- @status = status
- @url = url
- @download = download
- @license = license
- @description = description
- @updated = updated
- @history = history
- @dependency = dependency
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectDependency
- @@schema_type = "ProjectDependency"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def project
- @project
- end
-
- def project=(value)
- @project = value
- end
-
- def version
- @version
- end
-
- def version=(value)
- @version = value
- end
-
- def description
- @description
- end
-
- def description=(value)
- @description = value
- end
-
- def initialize(project = nil,
- version = nil,
- description = nil)
- @project = project
- @version = version
- @description = description
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class GemArray < Array
- # Contents type should be dumped here...
- @@schema_type = "GemArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class OwnerArray < Array
- # Contents type should be dumped here...
- @@schema_type = "OwnerArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectArray < Array
- # Contents type should be dumped here...
- @@schema_type = "ProjectArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectDependencyArray < Array
- # Contents type should be dumped here...
- @@schema_type = "ProjectDependencyArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class StringArray < Array
- # Contents type should be dumped here...
- @@schema_type = "StringArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://xml.apache.org/xml-soap
-class Map < Array
- # Contents type should be dumped here...
- @@schema_type = "Map"
- @@schema_ns = "http://xml.apache.org/xml-soap"
-end
-
diff --git a/sample/soap/raa2.4/raaDriver.rb b/sample/soap/raa2.4/raaDriver.rb
deleted file mode 100644
index 10d0ba257e..0000000000
--- a/sample/soap/raa2.4/raaDriver.rb
+++ /dev/null
@@ -1,255 +0,0 @@
-require 'raa.rb'
-
-require 'soap/rpc/driver'
-
-class RaaServicePortType < SOAP::RPC::Driver
- TargetNamespace = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- Gem,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Gem") }
- )
- MappingRegistry.set(
- Category,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Category") }
- )
- MappingRegistry.set(
- Owner,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Owner") }
- )
- MappingRegistry.set(
- Project,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Project") }
- )
- MappingRegistry.set(
- ProjectArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Project") }
- )
- MappingRegistry.set(
- ProjectDependencyArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "ProjectDependency") }
- )
- MappingRegistry.set(
- StringArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- Map,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType") }
- )
- MappingRegistry.set(
- OwnerArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Owner") }
- )
- MappingRegistry.set(
- ProjectDependency,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "ProjectDependency") }
- )
- Methods = [
- ["gem", "gem",
- [
- ["in", "name", [SOAP::SOAPString]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Gem"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["dependents", "dependents",
- [
- ["in", "name", [SOAP::SOAPString]],
- ["in", "version", [SOAP::SOAPString]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "ProjectDependency"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["names", "names",
- [
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["size", "size",
- [
- ["retval", "return", [SOAP::SOAPInt]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_by_category", "list_by_category",
- [
- ["in", "major", [SOAP::SOAPString]],
- ["in", "minor", [SOAP::SOAPString]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["tree_by_category", "tree_by_category",
- [
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_recent_updated", "list_recent_updated",
- [
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_recent_created", "list_recent_created",
- [
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_updated_since", "list_updated_since",
- [
- ["in", "date", [SOAP::SOAPDateTime]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_created_since", "list_created_since",
- [
- ["in", "date", [SOAP::SOAPDateTime]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_by_owner", "list_by_owner",
- [
- ["in", "owner_id", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_name", "search_name",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_short_description", "search_short_description",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_owner", "search_owner",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_version", "search_version",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_status", "search_status",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search_description", "search_description",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["search", "search",
- [
- ["in", "substring", [SOAP::SOAPString]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["owner", "owner",
- [
- ["in", "owner_id", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Owner"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["list_owner", "list_owner",
- [
- ["in", "idx", [SOAP::SOAPInt]],
- ["retval", "return", [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Owner"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["update", "update",
- [
- ["in", "name", [SOAP::SOAPString]],
- ["in", "pass", [SOAP::SOAPString]],
- ["in", "gem", [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Gem"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/", "Gem"]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ],
- ["update_pass", "update_pass",
- [
- ["in", "name", [SOAP::SOAPString]],
- ["in", "oldpass", [SOAP::SOAPString]],
- ["in", "newpass", [SOAP::SOAPString]]
- ],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/"
- ]
- ]
-
- DefaultEndpointUrl = "http://raa.ruby-lang.org/soapsrv"
-
- 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/soap/raa2.4/raaServiceClient.rb b/sample/soap/raa2.4/raaServiceClient.rb
deleted file mode 100644
index a59815ba72..0000000000
--- a/sample/soap/raa2.4/raaServiceClient.rb
+++ /dev/null
@@ -1,354 +0,0 @@
-#!/usr/bin/env ruby
-require 'raaDriver.rb'
-
-endpoint_url = ARGV.shift
-obj = RaaServicePortType.new(endpoint_url)
-
-# Uncomment the below line to see SOAP wiredumps.
-# obj.wiredump_dev = STDERR
-
-# SYNOPSIS
-# gem(name)
-#
-# ARGS
-# name - {http://www.w3.org/2001/XMLSchema}string
-#
-# RETURNS
-# return Gem - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}Gem
-#
-# RAISES
-# (undefined)
-#
-name = nil
-puts obj.gem(name)
-
-# SYNOPSIS
-# dependents(name, version)
-#
-# ARGS
-# name - {http://www.w3.org/2001/XMLSchema}string
-# version - {http://www.w3.org/2001/XMLSchema}string
-#
-# RETURNS
-# return ProjectDependencyArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}ProjectDependencyArray
-#
-# RAISES
-# (undefined)
-#
-name = version = nil
-puts obj.dependents(name, version)
-
-# SYNOPSIS
-# names
-#
-# ARGS
-# N/A
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-
-puts obj.names
-
-# SYNOPSIS
-# size
-#
-# ARGS
-# N/A
-#
-# RETURNS
-# return - {http://www.w3.org/2001/XMLSchema}int
-#
-# RAISES
-# (undefined)
-#
-
-puts obj.size
-
-# SYNOPSIS
-# list_by_category(major, minor)
-#
-# ARGS
-# major - {http://www.w3.org/2001/XMLSchema}string
-# minor - {http://www.w3.org/2001/XMLSchema}string
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-major = minor = nil
-puts obj.list_by_category(major, minor)
-
-# SYNOPSIS
-# tree_by_category
-#
-# ARGS
-# N/A
-#
-# RETURNS
-# return Map - {http://xml.apache.org/xml-soap}Map
-#
-# RAISES
-# (undefined)
-#
-
-puts obj.tree_by_category
-
-# SYNOPSIS
-# list_recent_updated(idx)
-#
-# ARGS
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-idx = nil
-puts obj.list_recent_updated(idx)
-
-# SYNOPSIS
-# list_recent_created(idx)
-#
-# ARGS
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-idx = nil
-puts obj.list_recent_created(idx)
-
-# SYNOPSIS
-# list_updated_since(date, idx)
-#
-# ARGS
-# date - {http://www.w3.org/2001/XMLSchema}dateTime
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-date = idx = nil
-puts obj.list_updated_since(date, idx)
-
-# SYNOPSIS
-# list_created_since(date, idx)
-#
-# ARGS
-# date - {http://www.w3.org/2001/XMLSchema}dateTime
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-date = idx = nil
-puts obj.list_created_since(date, idx)
-
-# SYNOPSIS
-# list_by_owner(owner_id)
-#
-# ARGS
-# owner_id - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-owner_id = nil
-puts obj.list_by_owner(owner_id)
-
-# SYNOPSIS
-# search_name(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_name(substring, idx)
-
-# SYNOPSIS
-# search_short_description(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_short_description(substring, idx)
-
-# SYNOPSIS
-# search_owner(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_owner(substring, idx)
-
-# SYNOPSIS
-# search_version(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_version(substring, idx)
-
-# SYNOPSIS
-# search_status(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_status(substring, idx)
-
-# SYNOPSIS
-# search_description(substring, idx)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return StringArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}StringArray
-#
-# RAISES
-# (undefined)
-#
-substring = idx = nil
-puts obj.search_description(substring, idx)
-
-# SYNOPSIS
-# search(substring)
-#
-# ARGS
-# substring - {http://www.w3.org/2001/XMLSchema}string
-#
-# RETURNS
-# return Map - {http://xml.apache.org/xml-soap}Map
-#
-# RAISES
-# (undefined)
-#
-substring = nil
-puts obj.search(substring)
-
-# SYNOPSIS
-# owner(owner_id)
-#
-# ARGS
-# owner_id - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return Owner - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}Owner
-#
-# RAISES
-# (undefined)
-#
-owner_id = nil
-puts obj.owner(owner_id)
-
-# SYNOPSIS
-# list_owner(idx)
-#
-# ARGS
-# idx - {http://www.w3.org/2001/XMLSchema}int
-#
-# RETURNS
-# return OwnerArray - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}OwnerArray
-#
-# RAISES
-# (undefined)
-#
-idx = nil
-puts obj.list_owner(idx)
-
-# SYNOPSIS
-# update(name, pass, gem)
-#
-# ARGS
-# name - {http://www.w3.org/2001/XMLSchema}string
-# pass - {http://www.w3.org/2001/XMLSchema}string
-# gem Gem - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}Gem
-#
-# RETURNS
-# return Gem - {http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/}Gem
-#
-# RAISES
-# (undefined)
-#
-name = pass = gem = nil
-puts obj.update(name, pass, gem)
-
-# SYNOPSIS
-# update_pass(name, oldpass, newpass)
-#
-# ARGS
-# name - {http://www.w3.org/2001/XMLSchema}string
-# oldpass - {http://www.w3.org/2001/XMLSchema}string
-# newpass - {http://www.w3.org/2001/XMLSchema}string
-#
-# RETURNS
-# N/A
-#
-# RAISES
-# (undefined)
-#
-name = oldpass = newpass = nil
-puts obj.update_pass(name, oldpass, newpass)
-
-
diff --git a/sample/soap/raa2.4/sample.rb b/sample/soap/raa2.4/sample.rb
deleted file mode 100644
index e157f8361f..0000000000
--- a/sample/soap/raa2.4/sample.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env ruby
-
-# This is a sample client based on raaServiceClient.rb.
-# You can generate raaServiceClient.rb and related files with
-# wsdl2ruby.rb --wsdl http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/ --type client
-
-require 'pp'
-require 'raaDriver.rb'
-
-raa = RaaServicePortType.new
-# raa.wiredump_dev = STDERR
-
-def sec(msg)
- puts
- puts "--------"
- puts "-- " + msg
- puts
-end
-
-def subsec(msg)
- puts "-- " + msg
-end
-
-sec("retrieve a gem (RAA Information) which has specified name")
-name = 'soap4r'
-pp raa.gem(name)
-
-sec("retrieve dependents of the project")
-name = 'http-access2'; version = nil
-pp raa.dependents(name, version)
-
-sec("number of registered gems")
-puts raa.size
-
-sec("retrieve all registered gem names")
-p raa.names
-
-sec("retrieve gems of specified category")
-major = 'Library'; minor = 'XML'
-p raa.list_by_category(major, minor)
-
-sec("retrieve category tree")
-pp raa.tree_by_category
-
-sec("retrieve gems which is updated recently")
-idx = 0
-p raa.list_recent_updated(idx)
-subsec("next 10 gems")
-idx += 1
-p raa.list_recent_updated(idx)
-subsec("next 10 gems")
-idx += 1
-p raa.list_recent_updated(idx)
-
-sec("retrieve gems which is created recently")
-p raa.list_recent_created(idx)
-
-sec("retrieve gems which is updated in 7 days")
-date = Time.now - 7 * 24 * 60 * 60; idx = 0
-p raa.list_updated_since(date, idx)
-
-sec("retrieve gems which is created in 7 days")
-p raa.list_created_since(date, idx)
-
-sec("retrieve gems of specified owner")
-owner_id = 8 # NaHi
-p raa.list_by_owner(owner_id)
-
-sec("search gems with keyword")
-substring = 'soap'
-pp raa.search(substring)
-
-# There are several search interface to search a field explicitly.
-# puts raa.search_name(substring, idx)
-# puts raa.search_short_description(substring, idx)
-# puts raa.search_owner(substring, idx)
-# puts raa.search_version(substring, idx)
-# puts raa.search_status(substring, idx)
-# puts raa.search_description(substring, idx)
-
-sec("retrieve owner info")
-owner_id = 8
-pp raa.owner(owner_id)
-
-sec("retrieve owners")
-idx = 0
-p raa.list_owner(idx)
-
-sec("update 'sampleproject'")
-name = 'sampleproject'
-pass = 'sampleproject'
-gem = raa.gem(name)
-p gem.project.version
-gem.project.version.succ!
-gem.updated = Time.now
-raa.update(name, pass, gem)
-p raa.gem(name).project.version
-
-sec("update pass phrase")
-raa.update_pass(name, 'sampleproject', 'foo')
-subsec("update check")
-gem = raa.gem(name)
-gem.project.description = 'Current pass phrase is "foo"'
-gem.updated = Time.now
-raa.update(name, 'foo', gem)
-#
-subsec("recover pass phrase")
-raa.update_pass(name, 'foo', 'sampleproject')
-subsec("update check")
-gem = raa.gem(name)
-gem.project.description = 'Current pass phrase is "sampleproject"'
-gem.updated = Time.now
-raa.update(name, 'sampleproject', gem)
-
-sec("done")
diff --git a/sample/soap/sampleStruct/client.rb b/sample/soap/sampleStruct/client.rb
deleted file mode 100644
index b55c7fdfc5..0000000000
--- a/sample/soap/sampleStruct/client.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'soap/rpc/driver'
-
-require 'iSampleStruct'
-
-server = ARGV.shift || 'http://localhost:7000/'
-# server = 'http://localhost:8808/server.cgi'
-
-drv = SOAP::RPC::Driver.new(server, SampleStructServiceNamespace)
-drv.wiredump_dev = STDERR
-drv.add_method('hi', 'sampleStruct')
-
-o1 = SampleStruct.new
-puts "Sending struct: #{ o1.inspect }"
-puts
-o2 = drv.hi(o1)
-puts "Received (wrapped): #{ o2.inspect }"
diff --git a/sample/soap/sampleStruct/httpd.rb b/sample/soap/sampleStruct/httpd.rb
deleted file mode 100644
index bebcff96c6..0000000000
--- a/sample/soap/sampleStruct/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/soap/sampleStruct/iSampleStruct.rb b/sample/soap/sampleStruct/iSampleStruct.rb
deleted file mode 100644
index 399ea52eb8..0000000000
--- a/sample/soap/sampleStruct/iSampleStruct.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'soap/mapping'
-
-SampleStructServiceNamespace = 'http://tempuri.org/sampleStructService'
-
-class SampleStruct; include SOAP::Marshallable
- attr_accessor :sampleArray
- attr_accessor :date
-
- def initialize
- @sampleArray = SampleArray[ "cyclic", self ]
- @date = DateTime.now
- end
-
- def wrap( rhs )
- @sampleArray = SampleArray[ "wrap", rhs.dup ]
- @date = DateTime.now
- self
- end
-end
-
-class SampleArray < Array; include SOAP::Marshallable
-end
diff --git a/sample/soap/sampleStruct/sampleStruct.rb b/sample/soap/sampleStruct/sampleStruct.rb
deleted file mode 100644
index 394c1bff09..0000000000
--- a/sample/soap/sampleStruct/sampleStruct.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'iSampleStruct'
-
-class SampleStructService
- def hi(struct)
- ack = SampleStruct.new
- ack.wrap(struct)
- ack
- end
-end
-
-if __FILE__ == $0
- p SampleStructService.new.hi(SampleStruct.new)
-end
diff --git a/sample/soap/sampleStruct/samplehttpd.conf b/sample/soap/sampleStruct/samplehttpd.conf
deleted file mode 100644
index 85e9995021..0000000000
--- a/sample/soap/sampleStruct/samplehttpd.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-docroot = .
-port = 8808
diff --git a/sample/soap/sampleStruct/server.cgi b/sample/soap/sampleStruct/server.cgi
deleted file mode 100644
index 42751386a0..0000000000
--- a/sample/soap/sampleStruct/server.cgi
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/local/bin/ruby
-
-require 'soap/rpc/cgistub'
-require 'sampleStruct'
-
-class SampleStructServer < SOAP::RPC::CGIStub
- def initialize(*arg)
- super
- servant = SampleStructService.new
- add_servant(servant)
- end
-end
-
-status = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace).start
diff --git a/sample/soap/sampleStruct/server.rb b/sample/soap/sampleStruct/server.rb
deleted file mode 100644
index ea1a2ef1d4..0000000000
--- a/sample/soap/sampleStruct/server.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'sampleStruct'
-
-class SampleStructServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
- servant = SampleStructService.new
- add_servant(servant)
- end
-end
-
-if $0 == __FILE__
- server = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace, '0.0.0.0', 7000)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/sample/soap/scopesample/client.rb b/sample/soap/scopesample/client.rb
deleted file mode 100644
index 009fdf1919..0000000000
--- a/sample/soap/scopesample/client.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-require 'soap/rpc/driver'
-
-server = ARGV.shift || 'http://localhost:7000/'
-# server = 'http://localhost:8808/server.cgi'
-
-# client which accesses application scope servant.
-app = SOAP::RPC::Driver.new(server,
- 'http://tempuri.org/applicationScopeService')
-app.add_method('push', 'value')
-app.add_method('pop')
-
-# client which accesses request scope servant must send SOAPAction to identify
-# the service.
-req = SOAP::RPC::Driver.new(server,
- 'http://tempuri.org/requestScopeService')
-req.add_method_with_soapaction('push',
- 'http://tempuri.org/requestScopeService', 'value')
-req.add_method_with_soapaction('pop',
- 'http://tempuri.org/requestScopeService')
-
-# exec
-app.push(1)
-app.push(2)
-app.push(3)
-p app.pop
-p app.pop
-p app.pop
-
-req.push(1)
-req.push(2)
-req.push(3)
-p req.pop
-p req.pop
-p req.pop
diff --git a/sample/soap/scopesample/httpd.rb b/sample/soap/scopesample/httpd.rb
deleted file mode 100644
index 5f58c7e14a..0000000000
--- a/sample/soap/scopesample/httpd.rb
+++ /dev/null
@@ -1,22 +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) do
- s.shutdown
-end
-s.start
diff --git a/sample/soap/scopesample/samplehttpd.conf b/sample/soap/scopesample/samplehttpd.conf
deleted file mode 100644
index 85e9995021..0000000000
--- a/sample/soap/scopesample/samplehttpd.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-docroot = .
-port = 8808
diff --git a/sample/soap/scopesample/servant.rb b/sample/soap/scopesample/servant.rb
deleted file mode 100644
index 5076050076..0000000000
--- a/sample/soap/scopesample/servant.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class Servant
- def self.create
- new
- end
-
- def initialize
- STDERR.puts "Servant created."
- @task = []
- end
-
- def push(value)
- @task.push(value)
- end
-
- def pop
- @task.pop
- end
-end
diff --git a/sample/soap/scopesample/server.cgi b/sample/soap/scopesample/server.cgi
deleted file mode 100755
index ebe13eb131..0000000000
--- a/sample/soap/scopesample/server.cgi
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/cgistub'
-require 'servant'
-
-class Server < SOAP::RPC::CGIStub
- class DummyServant
- def push(value)
- "Not supported"
- end
-
- def pop
- "Not supported"
- end
- end
-
- def initialize(*arg)
- super
- add_rpc_servant(Servant.new, 'http://tempuri.org/requestScopeService')
-
- # Application scope servant is not supported in CGI environment.
- # See server.rb to support application scope servant.
- dummy = DummyServant.new
- add_method_with_namespace('http://tempuri.org/applicationScopeService', dummy, 'push', 'value')
- add_method_with_namespace('http://tempuri.org/applicationScopeService', dummy, 'pop')
- end
-end
-
-status = Server.new('Server', nil).start
diff --git a/sample/soap/scopesample/server.rb b/sample/soap/scopesample/server.rb
deleted file mode 100644
index 6b87b74c2f..0000000000
--- a/sample/soap/scopesample/server.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'servant'
-
-class Server < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
- add_rpc_servant(Servant.new, 'http://tempuri.org/applicationScopeService')
- add_rpc_request_servant(Servant, 'http://tempuri.org/requestScopeService')
- end
-end
-
-if $0 == __FILE__
- server = Server.new('Server', nil, '0.0.0.0', 7000)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/sample/soap/ssl/files/README b/sample/soap/ssl/files/README
deleted file mode 100644
index 98ebcf7c23..0000000000
--- a/sample/soap/ssl/files/README
+++ /dev/null
@@ -1 +0,0 @@
-* certificates and keys in this directory is copied from http-access2 test.
diff --git a/sample/soap/ssl/files/ca.cert b/sample/soap/ssl/files/ca.cert
deleted file mode 100644
index bcabbee4ad..0000000000
--- a/sample/soap/ssl/files/ca.cert
+++ /dev/null
@@ -1,23 +0,0 @@
------BEGIN CERTIFICATE-----
-MIID0DCCArigAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMDAwNDIzMloXDTM2MDEyMjAwNDIzMlowPDELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQswCQYDVQQDDAJDQTCCASIw
-DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANbv0x42BTKFEQOE+KJ2XmiSdZpR
-wjzQLAkPLRnLB98tlzs4xo+y4RyY/rd5TT9UzBJTIhP8CJi5GbS1oXEerQXB3P0d
-L5oSSMwGGyuIzgZe5+vZ1kgzQxMEKMMKlzA73rbMd4Jx3u5+jdbP0EDrPYfXSvLY
-bS04n2aX7zrN3x5KdDrNBfwBio2/qeaaj4+9OxnwRvYP3WOvqdW0h329eMfHw0pi
-JI0drIVdsEqClUV4pebT/F+CPUPkEh/weySgo9wANockkYu5ujw2GbLFcO5LXxxm
-dEfcVr3r6t6zOA4bJwL0W/e6LBcrwiG/qPDFErhwtgTLYf6Er67SzLyA66UCAwEA
-AaOB3DCB2TAPBgNVHRMBAf8EBTADAQH/MDEGCWCGSAGG+EIBDQQkFiJSdWJ5L09w
-ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRJ7Xd380KzBV7f
-USKIQ+O/vKbhDzAOBgNVHQ8BAf8EBAMCAQYwZAYDVR0jBF0wW4AUSe13d/NCswVe
-31EiiEPjv7ym4Q+hQKQ+MDwxCzAJBgNVBAYMAkpQMRIwEAYDVQQKDAlKSU4uR1Iu
-SlAxDDAKBgNVBAsMA1JSUjELMAkGA1UEAwwCQ0GCAQAwDQYJKoZIhvcNAQEFBQAD
-ggEBAIu/mfiez5XN5tn2jScgShPgHEFJBR0BTJBZF6xCk0jyqNx/g9HMj2ELCuK+
-r/Y7KFW5c5M3AQ+xWW0ZSc4kvzyTcV7yTVIwj2jZ9ddYMN3nupZFgBK1GB4Y05GY
-MJJFRkSu6d/Ph5ypzBVw2YMT/nsOo5VwMUGLgS7YVjU+u/HNWz80J3oO17mNZllj
-PvORJcnjwlroDnS58KoJ7GDgejv3ESWADvX1OHLE4cRkiQGeLoEU4pxdCxXRqX0U
-PbwIkZN9mXVcrmPHq8MWi4eC/V7hnbZETMHuWhUoiNdOEfsAXr3iP4KjyyRdwc7a
-d/xgcK06UVQRL/HbEYGiQL056mc=
------END CERTIFICATE-----
diff --git a/sample/soap/ssl/files/client.cert b/sample/soap/ssl/files/client.cert
deleted file mode 100644
index ad13c4b735..0000000000
--- a/sample/soap/ssl/files/client.cert
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDKDCCAhCgAwIBAgIBAjANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMTAzMTQ1OFoXDTM1MDEyMzAzMTQ1OFowZTELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMRAwDgYDVQQDDAdleGFtcGxl
-MSIwIAYJKoZIhvcNAQkBDBNleGFtcGxlQGV4YW1wbGUub3JnMIGfMA0GCSqGSIb3
-DQEBAQUAA4GNADCBiQKBgQDRWssrK8Gyr+500hpLjCGR3+AHL8/hEJM5zKi/MgLW
-jTkvsgOwbYwXOiNtAbR9y4/ucDq7EY+cMUMHES4uFaPTcOaAV0aZRmk8AgslN1tQ
-gNS6ew7/Luq3DcVeWkX8PYgR9VG0mD1MPfJ6+IFA5d3vKpdBkBgN4l46jjO0/2Xf
-ewIDAQABo4GPMIGMMAwGA1UdEwEB/wQCMAAwMQYJYIZIAYb4QgENBCQWIlJ1Ynkv
-T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFOFvay0H7lr2
-xUx6waYEV2bVDYQhMAsGA1UdDwQEAwIF4DAdBgNVHSUEFjAUBggrBgEFBQcDAgYI
-KwYBBQUHAwQwDQYJKoZIhvcNAQEFBQADggEBABd2dYWqbDIWf5sWFvslezxJv8gI
-w64KCJBuyJAiDuf+oazr3016kMzAlt97KecLZDusGNagPrq02UX7YMoQFsWJBans
-cDtHrkM0al5r6/WGexNMgtYbNTYzt/IwodISGBgZ6dsOuhznwms+IBsTNDAvWeLP
-lt2tOqD8kEmjwMgn0GDRuKjs4EoboA3kMULb1p9akDV9ZESU3eOtpS5/G5J5msLI
-9WXbYBjcjvkLuJH9VsJhb+R58Vl0ViemvAHhPilSl1SPWVunGhv6FcIkdBEi1k9F
-e8BNMmsEjFiANiIRvpdLRbiGBt0KrKTndVfsmoKCvY48oCOvnzxtahFxfs8=
------END CERTIFICATE-----
diff --git a/sample/soap/ssl/files/client.key b/sample/soap/ssl/files/client.key
deleted file mode 100644
index 37bc62f259..0000000000
--- a/sample/soap/ssl/files/client.key
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICWwIBAAKBgQDRWssrK8Gyr+500hpLjCGR3+AHL8/hEJM5zKi/MgLWjTkvsgOw
-bYwXOiNtAbR9y4/ucDq7EY+cMUMHES4uFaPTcOaAV0aZRmk8AgslN1tQgNS6ew7/
-Luq3DcVeWkX8PYgR9VG0mD1MPfJ6+IFA5d3vKpdBkBgN4l46jjO0/2XfewIDAQAB
-AoGAZcz8llWErtsV3QB9gNb3S/PNADGjqBFjReva8n3jG2k4sZSibpwWTwUaTNtT
-ZQgjSRKRvH1hk9XwffNAvXAQZNNkuj/16gO2oO45nyLj4dO365ujLptWnVIWDHOE
-uN0GeiZO+VzcCisT0WCq4tvtLeH8svrxzA8cbXIEyOK7NiECQQDwo2zPFyKAZ/Cu
-lDJ6zKT+RjfWwW7DgWzirAlTrt4ViMaW+IaDH29TmQpb4V4NuR3Xi+2Xl4oicu6S
-36TW9+/FAkEA3rgfOQJuLlWSnw1RTGwvnC816a/W7iYYY7B+0U4cDbfWl7IoXT4y
-M8nV/HESooviZLqBwzAYSoj3fFKYBKpGPwJAUO8GN5iWWA2dW3ooiDiv/X1sZmRk
-dojfMFWgRW747tEzya8Ivq0h6kH8w+5GjeMG8Gn1nRiwsulo6Ckj7dEx6QJACyui
-7UIQ8qP6GZ4aYMHgVW4Mvy7Bkeo5OO7GPYs0Xv/EdJFL8vlGnVBXOjUVoS9w6Gpu
-TbLg1QQvnX2rADjmEwJANxZO2GUkaWGsEif8aGW0x5g/IdaMGG27pTWk5zqix7P3
-1UDrdo/JOXhptovhRi06EppIxAxYmbh9vd9VN8Itlw==
------END RSA PRIVATE KEY-----
diff --git a/sample/soap/ssl/files/server.cert b/sample/soap/ssl/files/server.cert
deleted file mode 100644
index 998ccc5892..0000000000
--- a/sample/soap/ssl/files/server.cert
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIC/zCCAeegAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxDjAMBgNVBAMMBVN1YkNB
-MB4XDTA0MDEzMTAzMTMxNloXDTMzMDEyMzAzMTMxNlowQzELMAkGA1UEBgwCSlAx
-EjAQBgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMRIwEAYDVQQDDAlsb2Nh
-bGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANFJTxWqup3nV9dsJAku
-p+WaXnPNIzcpAA3qMGZDJTJsfa8Du7ZxTP0XJK5mETttBrn711cJxAuP3KjqnW9S
-vtZ9lY2sXJ6Zj62sN5LwG3VVe25dI28yR1EsbHjJ5Zjf9tmggMC6am52dxuHbt5/
-vHo4ngJuKE/U+eeGRivMn6gFAgMBAAGjgYUwgYIwDAYDVR0TAQH/BAIwADAxBglg
-hkgBhvhCAQ0EJBYiUnVieS9PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd
-BgNVHQ4EFgQUpZIyygD9JxFYHHOTEuWOLbCKfckwCwYDVR0PBAQDAgWgMBMGA1Ud
-JQQMMAoGCCsGAQUFBwMBMA0GCSqGSIb3DQEBBQUAA4IBAQBwAIj5SaBHaA5X31IP
-CFCJiep96awfp7RANO0cuUj+ZpGoFn9d6FXY0g+Eg5wAkCNIzZU5NHN9xsdOpnUo
-zIBbyTfQEPrge1CMWMvL6uGaoEXytq84VTitF/xBTky4KtTn6+es4/e7jrrzeUXQ
-RC46gkHObmDT91RkOEGjHLyld2328jo3DIN/VTHIryDeVHDWjY5dENwpwdkhhm60
-DR9IrNBbXWEe9emtguNXeN0iu1ux0lG1Hc6pWGQxMlRKNvGh0yZB9u5EVe38tOV0
-jQaoNyL7qzcQoXD3Dmbi1p0iRmg/+HngISsz8K7k7MBNVsSclztwgCzTZOBiVtkM
-rRlQ
------END CERTIFICATE-----
diff --git a/sample/soap/ssl/files/server.key b/sample/soap/ssl/files/server.key
deleted file mode 100644
index 9ba2218a03..0000000000
--- a/sample/soap/ssl/files/server.key
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQDRSU8Vqrqd51fXbCQJLqflml5zzSM3KQAN6jBmQyUybH2vA7u2
-cUz9FySuZhE7bQa5+9dXCcQLj9yo6p1vUr7WfZWNrFyemY+trDeS8Bt1VXtuXSNv
-MkdRLGx4yeWY3/bZoIDAumpudncbh27ef7x6OJ4CbihP1PnnhkYrzJ+oBQIDAQAB
-AoGBAIf4CstW2ltQO7+XYGoex7Hh8s9lTSW/G2vu5Hbr1LTHy3fzAvdq8MvVR12O
-rk9fa+lU9vhzPc0NMB0GIDZ9GcHuhW5hD1Wg9OSCbTOkZDoH3CAFqonjh4Qfwv5W
-IPAFn9KHukdqGXkwEMdErsUaPTy9A1V/aROVEaAY+HJgq/eZAkEA/BP1QMV04WEZ
-Oynzz7/lLizJGGxp2AOvEVtqMoycA/Qk+zdKP8ufE0wbmCE3Qd6GoynavsHb6aGK
-gQobb8zDZwJBANSK6MrXlrZTtEaeZuyOB4mAmRzGzOUVkUyULUjEx2GDT93ujAma
-qm/2d3E+wXAkNSeRpjUmlQXy/2oSqnGvYbMCQQDRM+cYyEcGPUVpWpnj0shrF/QU
-9vSot/X1G775EMTyaw6+BtbyNxVgOIu2J+rqGbn3c+b85XqTXOPL0A2RLYkFAkAm
-syhSDtE9X55aoWsCNZY/vi+i4rvaFoQ/WleogVQAeGVpdo7/DK9t9YWoFBIqth0L
-mGSYFu9ZhvZkvQNV8eYrAkBJ+rOIaLDsmbrgkeDruH+B/9yrm4McDtQ/rgnOGYnH
-LjLpLLOrgUxqpzLWe++EwSLwK2//dHO+SPsQJ4xsyQJy
------END RSA PRIVATE KEY-----
diff --git a/sample/soap/ssl/files/sslclient.properties b/sample/soap/ssl/files/sslclient.properties
deleted file mode 100644
index 547ac7b3fb..0000000000
--- a/sample/soap/ssl/files/sslclient.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-# verify server's certificate
-protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
-# certificates for verification
-protocol.http.ssl_config.ca_file = files/ca.cert
-protocol.http.ssl_config.ca_file = files/subca.cert
diff --git a/sample/soap/ssl/files/sslclient_require_noserverauth.properties b/sample/soap/ssl/files/sslclient_require_noserverauth.properties
deleted file mode 100644
index 5ce5337fbf..0000000000
--- a/sample/soap/ssl/files/sslclient_require_noserverauth.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# no verify server's certificate
-protocol.http.ssl_config.verify_mode =
diff --git a/sample/soap/ssl/files/sslclient_with_clientauth.properties b/sample/soap/ssl/files/sslclient_with_clientauth.properties
deleted file mode 100644
index f1c81ebf46..0000000000
--- a/sample/soap/ssl/files/sslclient_with_clientauth.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-# verify server's certificate
-protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
-# certificates for verification
-protocol.http.ssl_config.ca_file = files/ca.cert
-protocol.http.ssl_config.ca_file = files/subca.cert
-
-# key and certificate for client identity
-protocol.http.ssl_config.client_cert = files/client.cert
-protocol.http.ssl_config.client_key = files/client.key
diff --git a/sample/soap/ssl/files/subca.cert b/sample/soap/ssl/files/subca.cert
deleted file mode 100644
index 1e471851b8..0000000000
--- a/sample/soap/ssl/files/subca.cert
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMDAwNDMyN1oXDTM1MDEyMjAwNDMyN1owPzELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQ4wDAYDVQQDDAVTdWJDQTCC
-ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0Ou7AyRcRXnB/kVHv/6kwe
-ANzgg/DyJfsAUqW90m7Lu1nqyug8gK0RBd77yU0w5HOAMHTVSdpjZK0g2sgx4Mb1
-d/213eL9TTl5MRVEChTvQr8q5DVG/8fxPPE7fMI8eOAzd98/NOAChk+80r4Sx7fC
-kGVEE1bKwY1MrUsUNjOY2d6t3M4HHV3HX1V8ShuKfsHxgCmLzdI8U+5CnQedFgkm
-3e+8tr8IX5RR1wA1Ifw9VadF7OdI/bGMzog/Q8XCLf+WPFjnK7Gcx6JFtzF6Gi4x
-4dp1Xl45JYiVvi9zQ132wu8A1pDHhiNgQviyzbP+UjcB/tsOpzBQF8abYzgEkWEC
-AwEAAaNyMHAwDwYDVR0TAQH/BAUwAwEB/zAxBglghkgBhvhCAQ0EJBYiUnVieS9P
-cGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUlCjXWLsReYzH
-LzsxwVnCXmKoB/owCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCJ/OyN
-rT8Cq2Y+G2yA/L1EMRvvxwFBqxavqaqHl/6rwsIBFlB3zbqGA/0oec6MAVnYynq4
-c4AcHTjx3bQ/S4r2sNTZq0DH4SYbQzIobx/YW8PjQUJt8KQdKMcwwi7arHP7A/Ha
-LKu8eIC2nsUBnP4NhkYSGhbmpJK+PFD0FVtD0ZIRlY/wsnaZNjWWcnWF1/FNuQ4H
-ySjIblqVQkPuzebv3Ror6ZnVDukn96Mg7kP4u6zgxOeqlJGRe1M949SS9Vudjl8X
-SF4aZUUB9pQGhsqQJVqaz2OlhGOp9D0q54xko/rekjAIcuDjl1mdX4F2WRrzpUmZ
-uY/bPeOBYiVsOYVe
------END CERTIFICATE-----
diff --git a/sample/soap/ssl/sslclient.rb b/sample/soap/ssl/sslclient.rb
deleted file mode 100644
index a055247a4c..0000000000
--- a/sample/soap/ssl/sslclient.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'http-access2'
-require 'soap/rpc/driver'
-
-# setup driver
-url = "https://localhost:17443/"
-client = SOAP::RPC::Driver.new(url, 'urn:sslhelloworld')
-client.add_method("hello_world", "from")
-# load SSL properties
-client.loadproperty('files/sslclient.properties')
-
-# SOAP over SSL
-p client.hello_world(__FILE__)
diff --git a/sample/soap/ssl/sslclient_require_noserverauth.rb b/sample/soap/ssl/sslclient_require_noserverauth.rb
deleted file mode 100644
index af121e9a41..0000000000
--- a/sample/soap/ssl/sslclient_require_noserverauth.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'http-access2'
-require 'soap/rpc/driver'
-
-# setup driver
-url = "https://localhost:17443/"
-client = SOAP::RPC::Driver.new(url, 'urn:sslhelloworld')
-client.add_method("hello_world", "from")
-# load SSL properties
-client.loadproperty('files/sslclient_require_noserverauth.properties')
-
-# SOAP over SSL
-p client.hello_world(__FILE__)
diff --git a/sample/soap/ssl/sslclient_with_clientauth.rb b/sample/soap/ssl/sslclient_with_clientauth.rb
deleted file mode 100644
index 7753d7b807..0000000000
--- a/sample/soap/ssl/sslclient_with_clientauth.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'http-access2'
-require 'soap/rpc/driver'
-
-# setup driver
-url = "https://localhost:17443/"
-client = SOAP::RPC::Driver.new(url, 'urn:sslhelloworld')
-client.add_method("hello_world", "from")
-# load SSL properties
-client.loadproperty('files/sslclient_with_clientauth.properties')
-
-# SOAP over SSL
-p client.hello_world(__FILE__)
diff --git a/sample/soap/ssl/sslserver.rb b/sample/soap/ssl/sslserver.rb
deleted file mode 100644
index e65cbacc7f..0000000000
--- a/sample/soap/ssl/sslserver.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require 'soap/rpc/httpserver'
-require 'webrick/https'
-require 'logger'
-
-class HelloWorldServer < SOAP::RPC::HTTPServer
-private
-
- def on_init
- @default_namespace = 'urn:sslhelloworld'
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-
-if $0 == __FILE__
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def cert(filename)
- OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- def key(filename)
- OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- $server = HelloWorldServer.new(
- :BindAddress => "0.0.0.0",
- :Port => 17443,
- :AccessLog => [],
- :SSLEnable => true,
- :SSLCACertificateFile => File.join(DIR, 'files/ca.cert'),
- :SSLCertificate => cert('files/server.cert'),
- :SSLPrivateKey => key('files/server.key'),
- :SSLVerifyClient => nil,
- :SSLCertName => nil
- )
- trap(:INT) do
- $server.shutdown
- end
- $server.start
-end
diff --git a/sample/soap/ssl/sslserver_noauth.rb b/sample/soap/ssl/sslserver_noauth.rb
deleted file mode 100644
index 48f5a68ad0..0000000000
--- a/sample/soap/ssl/sslserver_noauth.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'soap/rpc/httpserver'
-require 'webrick/https'
-require 'logger'
-
-class HelloWorldServer < SOAP::RPC::HTTPServer
-private
-
- def on_init
- @default_namespace = 'urn:sslhelloworld'
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-
-if $0 == __FILE__
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def cert(filename)
- OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- def key(filename)
- OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- $server = HelloWorldServer.new(
- :BindAddress => "0.0.0.0",
- :Port => 17443,
- :AccessLog => [],
- :SSLEnable => true,
- :SSLCertName => [['OU', 'example'], ['CN', 'localhost']] # creates dummy certificate
- )
- trap(:INT) do
- $server.shutdown
- end
- $server.start
-end
diff --git a/sample/soap/ssl/sslserver_require_clientauth.rb b/sample/soap/ssl/sslserver_require_clientauth.rb
deleted file mode 100644
index 63caf69caf..0000000000
--- a/sample/soap/ssl/sslserver_require_clientauth.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-require 'soap/rpc/httpserver'
-require 'webrick/https'
-require 'logger'
-
-class HelloWorldServer < SOAP::RPC::HTTPServer
-private
-
- def on_init
- @default_namespace = 'urn:sslhelloworld'
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-
-if $0 == __FILE__
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def cert(filename)
- OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- def key(filename)
- OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- $server = HelloWorldServer.new(
- :BindAddress => "0.0.0.0",
- :Port => 17443,
- :AccessLog => [],
- :SSLEnable => true,
- :SSLCACertificateFile => File.join(DIR, 'files/ca.cert'),
- :SSLCertificate => cert('files/server.cert'),
- :SSLPrivateKey => key('files/server.key'),
- :SSLVerifyClient =>
- OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT|OpenSSL::SSL::VERIFY_PEER,
- :SSLClientCA => cert('files/ca.cert')
- )
- trap(:INT) do
- $server.shutdown
- end
- $server.start
-end
diff --git a/sample/soap/swa/client.rb b/sample/soap/swa/client.rb
deleted file mode 100644
index 01c59a3845..0000000000
--- a/sample/soap/swa/client.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'soap/rpc/driver'
-require 'soap/attachment'
-
-server = 'http://localhost:7000/'
-driver = SOAP::RPC::Driver.new(server, 'http://www.acmetron.com/soap')
-driver.wiredump_dev = STDERR
-driver.add_method('get_file')
-driver.add_method('put_file', 'name', 'file')
-
-p driver.get_file
-file = File.open($0)
-attach = SOAP::Attachment.new(file)
-p driver.put_file($0, attach)
diff --git a/sample/soap/swa/server.rb b/sample/soap/swa/server.rb
deleted file mode 100644
index 0a82fe58bf..0000000000
--- a/sample/soap/swa/server.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'soap/rpc/standaloneServer'
-require 'soap/attachment'
-
-class SwAService
- def get_file
- return {
- 'name' => $0,
- 'file' => SOAP::Attachment.new(File.open($0))
- }
- end
-
- def put_file(name, file)
- "File '#{name}' was received ok."
- end
-end
-
-server = SOAP::RPC::StandaloneServer.new('SwAServer',
- 'http://www.acmetron.com/soap', '0.0.0.0', 7000)
-server.add_servant(SwAService.new)
-trap(:INT) do
- server.shutdown
-end
-server.start
diff --git a/sample/soap/whois.rb b/sample/soap/whois.rb
deleted file mode 100644
index 2737e8085e..0000000000
--- a/sample/soap/whois.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env ruby
-
-key = ARGV.shift
-
-require 'soap/rpc/driver'
-
-server = 'http://www.SoapClient.com/xml/SQLDataSoap.WSDL'
-interface = 'http://www.SoapClient.com/xml/SQLDataSoap.xsd'
-
-whois = SOAP::RPC::Driver.new(server, interface)
-whois.wiredump_dev = STDERR
-whois.add_method('ProcessSRL', 'SRLFile', 'RequestName', 'key')
-
-p whois.ProcessSRL('WHOIS.SRI', 'whois', key)
diff --git a/sample/wsdl/amazon/AmazonSearch.rb b/sample/wsdl/amazon/AmazonSearch.rb
deleted file mode 100644
index 373c7da29d..0000000000
--- a/sample/wsdl/amazon/AmazonSearch.rb
+++ /dev/null
@@ -1,3057 +0,0 @@
-# http://soap.amazon.com
-class ProductLineArray < Array
- @@schema_type = "ProductLineArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ProductLine
- @@schema_type = "ProductLine"
- @@schema_ns = "http://soap.amazon.com"
-
- def Mode
- @mode
- end
-
- def Mode=(value)
- @mode = value
- end
-
- def RelevanceRank
- @relevanceRank
- end
-
- def RelevanceRank=(value)
- @relevanceRank = value
- end
-
- def ProductInfo
- @productInfo
- end
-
- def ProductInfo=(value)
- @productInfo = value
- end
-
- def initialize(mode = nil, relevanceRank = nil, productInfo = nil)
- @mode = mode
- @relevanceRank = relevanceRank
- @productInfo = productInfo
- end
-end
-
-# http://soap.amazon.com
-class ProductInfo
- @@schema_type = "ProductInfo"
- @@schema_ns = "http://soap.amazon.com"
-
- def TotalResults
- @totalResults
- end
-
- def TotalResults=(value)
- @totalResults = value
- end
-
- def TotalPages
- @totalPages
- end
-
- def TotalPages=(value)
- @totalPages = value
- end
-
- def ListName
- @listName
- end
-
- def ListName=(value)
- @listName = value
- end
-
- def Details
- @details
- end
-
- def Details=(value)
- @details = value
- end
-
- def initialize(totalResults = nil, totalPages = nil, listName = nil, details = nil)
- @totalResults = totalResults
- @totalPages = totalPages
- @listName = listName
- @details = details
- end
-end
-
-# http://soap.amazon.com
-class DetailsArray < Array
- @@schema_type = "DetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Details
- @@schema_type = "Details"
- @@schema_ns = "http://soap.amazon.com"
-
- def Url
- @url
- end
-
- def Url=(value)
- @url = value
- end
-
- def Asin
- @asin
- end
-
- def Asin=(value)
- @asin = value
- end
-
- def ProductName
- @productName
- end
-
- def ProductName=(value)
- @productName = value
- end
-
- def Catalog
- @catalog
- end
-
- def Catalog=(value)
- @catalog = value
- end
-
- def KeyPhrases
- @keyPhrases
- end
-
- def KeyPhrases=(value)
- @keyPhrases = value
- end
-
- def Artists
- @artists
- end
-
- def Artists=(value)
- @artists = value
- end
-
- def Authors
- @authors
- end
-
- def Authors=(value)
- @authors = value
- end
-
- def Mpn
- @mpn
- end
-
- def Mpn=(value)
- @mpn = value
- end
-
- def Starring
- @starring
- end
-
- def Starring=(value)
- @starring = value
- end
-
- def Directors
- @directors
- end
-
- def Directors=(value)
- @directors = value
- end
-
- def TheatricalReleaseDate
- @theatricalReleaseDate
- end
-
- def TheatricalReleaseDate=(value)
- @theatricalReleaseDate = value
- end
-
- def ReleaseDate
- @releaseDate
- end
-
- def ReleaseDate=(value)
- @releaseDate = value
- end
-
- def Manufacturer
- @manufacturer
- end
-
- def Manufacturer=(value)
- @manufacturer = value
- end
-
- def Distributor
- @distributor
- end
-
- def Distributor=(value)
- @distributor = value
- end
-
- def ImageUrlSmall
- @imageUrlSmall
- end
-
- def ImageUrlSmall=(value)
- @imageUrlSmall = value
- end
-
- def ImageUrlMedium
- @imageUrlMedium
- end
-
- def ImageUrlMedium=(value)
- @imageUrlMedium = value
- end
-
- def ImageUrlLarge
- @imageUrlLarge
- end
-
- def ImageUrlLarge=(value)
- @imageUrlLarge = value
- end
-
- def MerchantId
- @merchantId
- end
-
- def MerchantId=(value)
- @merchantId = value
- end
-
- def MinPrice
- @minPrice
- end
-
- def MinPrice=(value)
- @minPrice = value
- end
-
- def MaxPrice
- @maxPrice
- end
-
- def MaxPrice=(value)
- @maxPrice = value
- end
-
- def MinSalePrice
- @minSalePrice
- end
-
- def MinSalePrice=(value)
- @minSalePrice = value
- end
-
- def MaxSalePrice
- @maxSalePrice
- end
-
- def MaxSalePrice=(value)
- @maxSalePrice = value
- end
-
- def MultiMerchant
- @multiMerchant
- end
-
- def MultiMerchant=(value)
- @multiMerchant = value
- end
-
- def MerchantSku
- @merchantSku
- end
-
- def MerchantSku=(value)
- @merchantSku = value
- end
-
- def ListPrice
- @listPrice
- end
-
- def ListPrice=(value)
- @listPrice = value
- end
-
- def OurPrice
- @ourPrice
- end
-
- def OurPrice=(value)
- @ourPrice = value
- end
-
- def UsedPrice
- @usedPrice
- end
-
- def UsedPrice=(value)
- @usedPrice = value
- end
-
- def RefurbishedPrice
- @refurbishedPrice
- end
-
- def RefurbishedPrice=(value)
- @refurbishedPrice = value
- end
-
- def CollectiblePrice
- @collectiblePrice
- end
-
- def CollectiblePrice=(value)
- @collectiblePrice = value
- end
-
- def ThirdPartyNewPrice
- @thirdPartyNewPrice
- end
-
- def ThirdPartyNewPrice=(value)
- @thirdPartyNewPrice = value
- end
-
- def NumberOfOfferings
- @numberOfOfferings
- end
-
- def NumberOfOfferings=(value)
- @numberOfOfferings = value
- end
-
- def ThirdPartyNewCount
- @thirdPartyNewCount
- end
-
- def ThirdPartyNewCount=(value)
- @thirdPartyNewCount = value
- end
-
- def UsedCount
- @usedCount
- end
-
- def UsedCount=(value)
- @usedCount = value
- end
-
- def CollectibleCount
- @collectibleCount
- end
-
- def CollectibleCount=(value)
- @collectibleCount = value
- end
-
- def RefurbishedCount
- @refurbishedCount
- end
-
- def RefurbishedCount=(value)
- @refurbishedCount = value
- end
-
- def ThirdPartyProductInfo
- @thirdPartyProductInfo
- end
-
- def ThirdPartyProductInfo=(value)
- @thirdPartyProductInfo = value
- end
-
- def SalesRank
- @salesRank
- end
-
- def SalesRank=(value)
- @salesRank = value
- end
-
- def BrowseList
- @browseList
- end
-
- def BrowseList=(value)
- @browseList = value
- end
-
- def Media
- @media
- end
-
- def Media=(value)
- @media = value
- end
-
- def ReadingLevel
- @readingLevel
- end
-
- def ReadingLevel=(value)
- @readingLevel = value
- end
-
- def NumberOfPages
- @numberOfPages
- end
-
- def NumberOfPages=(value)
- @numberOfPages = value
- end
-
- def NumberOfIssues
- @numberOfIssues
- end
-
- def NumberOfIssues=(value)
- @numberOfIssues = value
- end
-
- def IssuesPerYear
- @issuesPerYear
- end
-
- def IssuesPerYear=(value)
- @issuesPerYear = value
- end
-
- def SubscriptionLength
- @subscriptionLength
- end
-
- def SubscriptionLength=(value)
- @subscriptionLength = value
- end
-
- def DeweyNumber
- @deweyNumber
- end
-
- def DeweyNumber=(value)
- @deweyNumber = value
- end
-
- def RunningTime
- @runningTime
- end
-
- def RunningTime=(value)
- @runningTime = value
- end
-
- def Publisher
- @publisher
- end
-
- def Publisher=(value)
- @publisher = value
- end
-
- def NumMedia
- @numMedia
- end
-
- def NumMedia=(value)
- @numMedia = value
- end
-
- def Isbn
- @isbn
- end
-
- def Isbn=(value)
- @isbn = value
- end
-
- def Features
- @features
- end
-
- def Features=(value)
- @features = value
- end
-
- def MpaaRating
- @mpaaRating
- end
-
- def MpaaRating=(value)
- @mpaaRating = value
- end
-
- def EsrbRating
- @esrbRating
- end
-
- def EsrbRating=(value)
- @esrbRating = value
- end
-
- def AgeGroup
- @ageGroup
- end
-
- def AgeGroup=(value)
- @ageGroup = value
- end
-
- def Availability
- @availability
- end
-
- def Availability=(value)
- @availability = value
- end
-
- def Upc
- @upc
- end
-
- def Upc=(value)
- @upc = value
- end
-
- def Tracks
- @tracks
- end
-
- def Tracks=(value)
- @tracks = value
- end
-
- def Accessories
- @accessories
- end
-
- def Accessories=(value)
- @accessories = value
- end
-
- def Platforms
- @platforms
- end
-
- def Platforms=(value)
- @platforms = value
- end
-
- def Encoding
- @encoding
- end
-
- def Encoding=(value)
- @encoding = value
- end
-
- def ProductDescription
- @productDescription
- end
-
- def ProductDescription=(value)
- @productDescription = value
- end
-
- def Reviews
- @reviews
- end
-
- def Reviews=(value)
- @reviews = value
- end
-
- def SimilarProducts
- @similarProducts
- end
-
- def SimilarProducts=(value)
- @similarProducts = value
- end
-
- def FeaturedProducts
- @featuredProducts
- end
-
- def FeaturedProducts=(value)
- @featuredProducts = value
- end
-
- def Lists
- @lists
- end
-
- def Lists=(value)
- @lists = value
- end
-
- def Status
- @status
- end
-
- def Status=(value)
- @status = value
- end
-
- def Variations
- @variations
- end
-
- def Variations=(value)
- @variations = value
- end
-
- def initialize(url = nil, asin = nil, productName = nil, catalog = nil, keyPhrases = nil, artists = nil, authors = nil, mpn = nil, starring = nil, directors = nil, theatricalReleaseDate = nil, releaseDate = nil, manufacturer = nil, distributor = nil, imageUrlSmall = nil, imageUrlMedium = nil, imageUrlLarge = nil, merchantId = nil, minPrice = nil, maxPrice = nil, minSalePrice = nil, maxSalePrice = nil, multiMerchant = nil, merchantSku = nil, listPrice = nil, ourPrice = nil, usedPrice = nil, refurbishedPrice = nil, collectiblePrice = nil, thirdPartyNewPrice = nil, numberOfOfferings = nil, thirdPartyNewCount = nil, usedCount = nil, collectibleCount = nil, refurbishedCount = nil, thirdPartyProductInfo = nil, salesRank = nil, browseList = nil, media = nil, readingLevel = nil, numberOfPages = nil, numberOfIssues = nil, issuesPerYear = nil, subscriptionLength = nil, deweyNumber = nil, runningTime = nil, publisher = nil, numMedia = nil, isbn = nil, features = nil, mpaaRating = nil, esrbRating = nil, ageGroup = nil, availability = nil, upc = nil, tracks = nil, accessories = nil, platforms = nil, encoding = nil, productDescription = nil, reviews = nil, similarProducts = nil, featuredProducts = nil, lists = nil, status = nil, variations = nil)
- @url = url
- @asin = asin
- @productName = productName
- @catalog = catalog
- @keyPhrases = keyPhrases
- @artists = artists
- @authors = authors
- @mpn = mpn
- @starring = starring
- @directors = directors
- @theatricalReleaseDate = theatricalReleaseDate
- @releaseDate = releaseDate
- @manufacturer = manufacturer
- @distributor = distributor
- @imageUrlSmall = imageUrlSmall
- @imageUrlMedium = imageUrlMedium
- @imageUrlLarge = imageUrlLarge
- @merchantId = merchantId
- @minPrice = minPrice
- @maxPrice = maxPrice
- @minSalePrice = minSalePrice
- @maxSalePrice = maxSalePrice
- @multiMerchant = multiMerchant
- @merchantSku = merchantSku
- @listPrice = listPrice
- @ourPrice = ourPrice
- @usedPrice = usedPrice
- @refurbishedPrice = refurbishedPrice
- @collectiblePrice = collectiblePrice
- @thirdPartyNewPrice = thirdPartyNewPrice
- @numberOfOfferings = numberOfOfferings
- @thirdPartyNewCount = thirdPartyNewCount
- @usedCount = usedCount
- @collectibleCount = collectibleCount
- @refurbishedCount = refurbishedCount
- @thirdPartyProductInfo = thirdPartyProductInfo
- @salesRank = salesRank
- @browseList = browseList
- @media = media
- @readingLevel = readingLevel
- @numberOfPages = numberOfPages
- @numberOfIssues = numberOfIssues
- @issuesPerYear = issuesPerYear
- @subscriptionLength = subscriptionLength
- @deweyNumber = deweyNumber
- @runningTime = runningTime
- @publisher = publisher
- @numMedia = numMedia
- @isbn = isbn
- @features = features
- @mpaaRating = mpaaRating
- @esrbRating = esrbRating
- @ageGroup = ageGroup
- @availability = availability
- @upc = upc
- @tracks = tracks
- @accessories = accessories
- @platforms = platforms
- @encoding = encoding
- @productDescription = productDescription
- @reviews = reviews
- @similarProducts = similarProducts
- @featuredProducts = featuredProducts
- @lists = lists
- @status = status
- @variations = variations
- end
-end
-
-# http://soap.amazon.com
-class KeyPhraseArray < Array
- @@schema_type = "KeyPhraseArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class KeyPhrase
- @@schema_type = "KeyPhrase"
- @@schema_ns = "http://soap.amazon.com"
-
- def KeyPhrase
- @keyPhrase
- end
-
- def KeyPhrase=(value)
- @keyPhrase = value
- end
-
- def Type
- @type
- end
-
- def Type=(value)
- @type = value
- end
-
- def initialize(keyPhrase = nil, type = nil)
- @keyPhrase = keyPhrase
- @type = type
- end
-end
-
-# http://soap.amazon.com
-class ArtistArray < Array
- @@schema_type = "ArtistArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class AuthorArray < Array
- @@schema_type = "AuthorArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class StarringArray < Array
- @@schema_type = "StarringArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class DirectorArray < Array
- @@schema_type = "DirectorArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class BrowseNodeArray < Array
- @@schema_type = "BrowseNodeArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class BrowseNode
- @@schema_type = "BrowseNode"
- @@schema_ns = "http://soap.amazon.com"
-
- def BrowseId
- @browseId
- end
-
- def BrowseId=(value)
- @browseId = value
- end
-
- def BrowseName
- @browseName
- end
-
- def BrowseName=(value)
- @browseName = value
- end
-
- def initialize(browseId = nil, browseName = nil)
- @browseId = browseId
- @browseName = browseName
- end
-end
-
-# http://soap.amazon.com
-class FeaturesArray < Array
- @@schema_type = "FeaturesArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class TrackArray < Array
- @@schema_type = "TrackArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Track
- @@schema_type = "Track"
- @@schema_ns = "http://soap.amazon.com"
-
- def TrackName
- @trackName
- end
-
- def TrackName=(value)
- @trackName = value
- end
-
- def ByArtist
- @byArtist
- end
-
- def ByArtist=(value)
- @byArtist = value
- end
-
- def initialize(trackName = nil, byArtist = nil)
- @trackName = trackName
- @byArtist = byArtist
- end
-end
-
-# http://soap.amazon.com
-class AccessoryArray < Array
- @@schema_type = "AccessoryArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class PlatformArray < Array
- @@schema_type = "PlatformArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Reviews
- @@schema_type = "Reviews"
- @@schema_ns = "http://soap.amazon.com"
-
- def AvgCustomerRating
- @avgCustomerRating
- end
-
- def AvgCustomerRating=(value)
- @avgCustomerRating = value
- end
-
- def TotalCustomerReviews
- @totalCustomerReviews
- end
-
- def TotalCustomerReviews=(value)
- @totalCustomerReviews = value
- end
-
- def CustomerReviews
- @customerReviews
- end
-
- def CustomerReviews=(value)
- @customerReviews = value
- end
-
- def initialize(avgCustomerRating = nil, totalCustomerReviews = nil, customerReviews = nil)
- @avgCustomerRating = avgCustomerRating
- @totalCustomerReviews = totalCustomerReviews
- @customerReviews = customerReviews
- end
-end
-
-# http://soap.amazon.com
-class CustomerReviewArray < Array
- @@schema_type = "CustomerReviewArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class CustomerReview
- @@schema_type = "CustomerReview"
- @@schema_ns = "http://soap.amazon.com"
-
- def Rating
- @rating
- end
-
- def Rating=(value)
- @rating = value
- end
-
- def Date
- @date
- end
-
- def Date=(value)
- @date = value
- end
-
- def Summary
- @summary
- end
-
- def Summary=(value)
- @summary = value
- end
-
- def Comment
- @comment
- end
-
- def Comment=(value)
- @comment = value
- end
-
- def initialize(rating = nil, date = nil, summary = nil, comment = nil)
- @rating = rating
- @date = date
- @summary = summary
- @comment = comment
- end
-end
-
-# http://soap.amazon.com
-class SimilarProductsArray < Array
- @@schema_type = "SimilarProductsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class FeaturedProductsArray < Array
- @@schema_type = "FeaturedProductsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class FeaturedProduct
- @@schema_type = "FeaturedProduct"
- @@schema_ns = "http://soap.amazon.com"
-
- def Asin
- @asin
- end
-
- def Asin=(value)
- @asin = value
- end
-
- def Comment
- @comment
- end
-
- def Comment=(value)
- @comment = value
- end
-
- def initialize(asin = nil, comment = nil)
- @asin = asin
- @comment = comment
- end
-end
-
-# http://soap.amazon.com
-class ListArray < Array
- @@schema_type = "ListArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class VariationArray < Array
- @@schema_type = "VariationArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Variation
- @@schema_type = "Variation"
- @@schema_ns = "http://soap.amazon.com"
-
- def Asin
- @asin
- end
-
- def Asin=(value)
- @asin = value
- end
-
- def ClothingSize
- @clothingSize
- end
-
- def ClothingSize=(value)
- @clothingSize = value
- end
-
- def ClothingColor
- @clothingColor
- end
-
- def ClothingColor=(value)
- @clothingColor = value
- end
-
- def Price
- @price
- end
-
- def Price=(value)
- @price = value
- end
-
- def SalePrice
- @salePrice
- end
-
- def SalePrice=(value)
- @salePrice = value
- end
-
- def Availability
- @availability
- end
-
- def Availability=(value)
- @availability = value
- end
-
- def MultiMerchant
- @multiMerchant
- end
-
- def MultiMerchant=(value)
- @multiMerchant = value
- end
-
- def MerchantSku
- @merchantSku
- end
-
- def MerchantSku=(value)
- @merchantSku = value
- end
-
- def initialize(asin = nil, clothingSize = nil, clothingColor = nil, price = nil, salePrice = nil, availability = nil, multiMerchant = nil, merchantSku = nil)
- @asin = asin
- @clothingSize = clothingSize
- @clothingColor = clothingColor
- @price = price
- @salePrice = salePrice
- @availability = availability
- @multiMerchant = multiMerchant
- @merchantSku = merchantSku
- end
-end
-
-# http://soap.amazon.com
-class MarketplaceSearch
- @@schema_type = "MarketplaceSearch"
- @@schema_ns = "http://soap.amazon.com"
-
- def MarketplaceSearchDetails
- @marketplaceSearchDetails
- end
-
- def MarketplaceSearchDetails=(value)
- @marketplaceSearchDetails = value
- end
-
- def initialize(marketplaceSearchDetails = nil)
- @marketplaceSearchDetails = marketplaceSearchDetails
- end
-end
-
-# http://soap.amazon.com
-class SellerProfile
- @@schema_type = "SellerProfile"
- @@schema_ns = "http://soap.amazon.com"
-
- def SellerProfileDetails
- @sellerProfileDetails
- end
-
- def SellerProfileDetails=(value)
- @sellerProfileDetails = value
- end
-
- def initialize(sellerProfileDetails = nil)
- @sellerProfileDetails = sellerProfileDetails
- end
-end
-
-# http://soap.amazon.com
-class SellerSearch
- @@schema_type = "SellerSearch"
- @@schema_ns = "http://soap.amazon.com"
-
- def SellerSearchDetails
- @sellerSearchDetails
- end
-
- def SellerSearchDetails=(value)
- @sellerSearchDetails = value
- end
-
- def initialize(sellerSearchDetails = nil)
- @sellerSearchDetails = sellerSearchDetails
- end
-end
-
-# http://soap.amazon.com
-class MarketplaceSearchDetails
- @@schema_type = "MarketplaceSearchDetails"
- @@schema_ns = "http://soap.amazon.com"
-
- def NumberOfOpenListings
- @numberOfOpenListings
- end
-
- def NumberOfOpenListings=(value)
- @numberOfOpenListings = value
- end
-
- def ListingProductInfo
- @listingProductInfo
- end
-
- def ListingProductInfo=(value)
- @listingProductInfo = value
- end
-
- def initialize(numberOfOpenListings = nil, listingProductInfo = nil)
- @numberOfOpenListings = numberOfOpenListings
- @listingProductInfo = listingProductInfo
- end
-end
-
-# http://soap.amazon.com
-class MarketplaceSearchDetailsArray < Array
- @@schema_type = "MarketplaceSearchDetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class SellerProfileDetails
- @@schema_type = "SellerProfileDetails"
- @@schema_ns = "http://soap.amazon.com"
-
- def SellerNickname
- @sellerNickname
- end
-
- def SellerNickname=(value)
- @sellerNickname = value
- end
-
- def OverallFeedbackRating
- @overallFeedbackRating
- end
-
- def OverallFeedbackRating=(value)
- @overallFeedbackRating = value
- end
-
- def NumberOfFeedback
- @numberOfFeedback
- end
-
- def NumberOfFeedback=(value)
- @numberOfFeedback = value
- end
-
- def NumberOfCanceledBids
- @numberOfCanceledBids
- end
-
- def NumberOfCanceledBids=(value)
- @numberOfCanceledBids = value
- end
-
- def NumberOfCanceledAuctions
- @numberOfCanceledAuctions
- end
-
- def NumberOfCanceledAuctions=(value)
- @numberOfCanceledAuctions = value
- end
-
- def StoreId
- @storeId
- end
-
- def StoreId=(value)
- @storeId = value
- end
-
- def StoreName
- @storeName
- end
-
- def StoreName=(value)
- @storeName = value
- end
-
- def SellerFeedback
- @sellerFeedback
- end
-
- def SellerFeedback=(value)
- @sellerFeedback = value
- end
-
- def initialize(sellerNickname = nil, overallFeedbackRating = nil, numberOfFeedback = nil, numberOfCanceledBids = nil, numberOfCanceledAuctions = nil, storeId = nil, storeName = nil, sellerFeedback = nil)
- @sellerNickname = sellerNickname
- @overallFeedbackRating = overallFeedbackRating
- @numberOfFeedback = numberOfFeedback
- @numberOfCanceledBids = numberOfCanceledBids
- @numberOfCanceledAuctions = numberOfCanceledAuctions
- @storeId = storeId
- @storeName = storeName
- @sellerFeedback = sellerFeedback
- end
-end
-
-# http://soap.amazon.com
-class SellerProfileDetailsArray < Array
- @@schema_type = "SellerProfileDetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class SellerSearchDetails
- @@schema_type = "SellerSearchDetails"
- @@schema_ns = "http://soap.amazon.com"
-
- def SellerNickname
- @sellerNickname
- end
-
- def SellerNickname=(value)
- @sellerNickname = value
- end
-
- def StoreId
- @storeId
- end
-
- def StoreId=(value)
- @storeId = value
- end
-
- def StoreName
- @storeName
- end
-
- def StoreName=(value)
- @storeName = value
- end
-
- def NumberOfOpenListings
- @numberOfOpenListings
- end
-
- def NumberOfOpenListings=(value)
- @numberOfOpenListings = value
- end
-
- def ListingProductInfo
- @listingProductInfo
- end
-
- def ListingProductInfo=(value)
- @listingProductInfo = value
- end
-
- def initialize(sellerNickname = nil, storeId = nil, storeName = nil, numberOfOpenListings = nil, listingProductInfo = nil)
- @sellerNickname = sellerNickname
- @storeId = storeId
- @storeName = storeName
- @numberOfOpenListings = numberOfOpenListings
- @listingProductInfo = listingProductInfo
- end
-end
-
-# http://soap.amazon.com
-class SellerSearchDetailsArray < Array
- @@schema_type = "SellerSearchDetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ListingProductInfo
- @@schema_type = "ListingProductInfo"
- @@schema_ns = "http://soap.amazon.com"
-
- def ListingProductDetails
- @listingProductDetails
- end
-
- def ListingProductDetails=(value)
- @listingProductDetails = value
- end
-
- def initialize(listingProductDetails = nil)
- @listingProductDetails = listingProductDetails
- end
-end
-
-# http://soap.amazon.com
-class ListingProductDetailsArray < Array
- @@schema_type = "ListingProductDetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ListingProductDetails
- @@schema_type = "ListingProductDetails"
- @@schema_ns = "http://soap.amazon.com"
-
- def ExchangeId
- @exchangeId
- end
-
- def ExchangeId=(value)
- @exchangeId = value
- end
-
- def ListingId
- @listingId
- end
-
- def ListingId=(value)
- @listingId = value
- end
-
- def ExchangeTitle
- @exchangeTitle
- end
-
- def ExchangeTitle=(value)
- @exchangeTitle = value
- end
-
- def ExchangeDescription
- @exchangeDescription
- end
-
- def ExchangeDescription=(value)
- @exchangeDescription = value
- end
-
- def ExchangePrice
- @exchangePrice
- end
-
- def ExchangePrice=(value)
- @exchangePrice = value
- end
-
- def ExchangeAsin
- @exchangeAsin
- end
-
- def ExchangeAsin=(value)
- @exchangeAsin = value
- end
-
- def ExchangeEndDate
- @exchangeEndDate
- end
-
- def ExchangeEndDate=(value)
- @exchangeEndDate = value
- end
-
- def ExchangeTinyImage
- @exchangeTinyImage
- end
-
- def ExchangeTinyImage=(value)
- @exchangeTinyImage = value
- end
-
- def ExchangeSellerId
- @exchangeSellerId
- end
-
- def ExchangeSellerId=(value)
- @exchangeSellerId = value
- end
-
- def ExchangeSellerNickname
- @exchangeSellerNickname
- end
-
- def ExchangeSellerNickname=(value)
- @exchangeSellerNickname = value
- end
-
- def ExchangeStartDate
- @exchangeStartDate
- end
-
- def ExchangeStartDate=(value)
- @exchangeStartDate = value
- end
-
- def ExchangeStatus
- @exchangeStatus
- end
-
- def ExchangeStatus=(value)
- @exchangeStatus = value
- end
-
- def ExchangeQuantity
- @exchangeQuantity
- end
-
- def ExchangeQuantity=(value)
- @exchangeQuantity = value
- end
-
- def ExchangeQuantityAllocated
- @exchangeQuantityAllocated
- end
-
- def ExchangeQuantityAllocated=(value)
- @exchangeQuantityAllocated = value
- end
-
- def ExchangeFeaturedCategory
- @exchangeFeaturedCategory
- end
-
- def ExchangeFeaturedCategory=(value)
- @exchangeFeaturedCategory = value
- end
-
- def ExchangeCondition
- @exchangeCondition
- end
-
- def ExchangeCondition=(value)
- @exchangeCondition = value
- end
-
- def ExchangeConditionType
- @exchangeConditionType
- end
-
- def ExchangeConditionType=(value)
- @exchangeConditionType = value
- end
-
- def ExchangeAvailability
- @exchangeAvailability
- end
-
- def ExchangeAvailability=(value)
- @exchangeAvailability = value
- end
-
- def ExchangeOfferingType
- @exchangeOfferingType
- end
-
- def ExchangeOfferingType=(value)
- @exchangeOfferingType = value
- end
-
- def ExchangeSellerState
- @exchangeSellerState
- end
-
- def ExchangeSellerState=(value)
- @exchangeSellerState = value
- end
-
- def ExchangeSellerCountry
- @exchangeSellerCountry
- end
-
- def ExchangeSellerCountry=(value)
- @exchangeSellerCountry = value
- end
-
- def ExchangeSellerRating
- @exchangeSellerRating
- end
-
- def ExchangeSellerRating=(value)
- @exchangeSellerRating = value
- end
-
- def initialize(exchangeId = nil, listingId = nil, exchangeTitle = nil, exchangeDescription = nil, exchangePrice = nil, exchangeAsin = nil, exchangeEndDate = nil, exchangeTinyImage = nil, exchangeSellerId = nil, exchangeSellerNickname = nil, exchangeStartDate = nil, exchangeStatus = nil, exchangeQuantity = nil, exchangeQuantityAllocated = nil, exchangeFeaturedCategory = nil, exchangeCondition = nil, exchangeConditionType = nil, exchangeAvailability = nil, exchangeOfferingType = nil, exchangeSellerState = nil, exchangeSellerCountry = nil, exchangeSellerRating = nil)
- @exchangeId = exchangeId
- @listingId = listingId
- @exchangeTitle = exchangeTitle
- @exchangeDescription = exchangeDescription
- @exchangePrice = exchangePrice
- @exchangeAsin = exchangeAsin
- @exchangeEndDate = exchangeEndDate
- @exchangeTinyImage = exchangeTinyImage
- @exchangeSellerId = exchangeSellerId
- @exchangeSellerNickname = exchangeSellerNickname
- @exchangeStartDate = exchangeStartDate
- @exchangeStatus = exchangeStatus
- @exchangeQuantity = exchangeQuantity
- @exchangeQuantityAllocated = exchangeQuantityAllocated
- @exchangeFeaturedCategory = exchangeFeaturedCategory
- @exchangeCondition = exchangeCondition
- @exchangeConditionType = exchangeConditionType
- @exchangeAvailability = exchangeAvailability
- @exchangeOfferingType = exchangeOfferingType
- @exchangeSellerState = exchangeSellerState
- @exchangeSellerCountry = exchangeSellerCountry
- @exchangeSellerRating = exchangeSellerRating
- end
-end
-
-# http://soap.amazon.com
-class SellerFeedback
- @@schema_type = "SellerFeedback"
- @@schema_ns = "http://soap.amazon.com"
-
- def Feedback
- @feedback
- end
-
- def Feedback=(value)
- @feedback = value
- end
-
- def initialize(feedback = nil)
- @feedback = feedback
- end
-end
-
-# http://soap.amazon.com
-class FeedbackArray < Array
- @@schema_type = "FeedbackArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Feedback
- @@schema_type = "Feedback"
- @@schema_ns = "http://soap.amazon.com"
-
- def FeedbackRating
- @feedbackRating
- end
-
- def FeedbackRating=(value)
- @feedbackRating = value
- end
-
- def FeedbackComments
- @feedbackComments
- end
-
- def FeedbackComments=(value)
- @feedbackComments = value
- end
-
- def FeedbackDate
- @feedbackDate
- end
-
- def FeedbackDate=(value)
- @feedbackDate = value
- end
-
- def FeedbackRater
- @feedbackRater
- end
-
- def FeedbackRater=(value)
- @feedbackRater = value
- end
-
- def initialize(feedbackRating = nil, feedbackComments = nil, feedbackDate = nil, feedbackRater = nil)
- @feedbackRating = feedbackRating
- @feedbackComments = feedbackComments
- @feedbackDate = feedbackDate
- @feedbackRater = feedbackRater
- end
-end
-
-# http://soap.amazon.com
-class ThirdPartyProductInfo
- @@schema_type = "ThirdPartyProductInfo"
- @@schema_ns = "http://soap.amazon.com"
-
- def ThirdPartyProductDetails
- @thirdPartyProductDetails
- end
-
- def ThirdPartyProductDetails=(value)
- @thirdPartyProductDetails = value
- end
-
- def initialize(thirdPartyProductDetails = nil)
- @thirdPartyProductDetails = thirdPartyProductDetails
- end
-end
-
-# http://soap.amazon.com
-class ThirdPartyProductDetailsArray < Array
- @@schema_type = "ThirdPartyProductDetailsArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ThirdPartyProductDetails
- @@schema_type = "ThirdPartyProductDetails"
- @@schema_ns = "http://soap.amazon.com"
-
- def OfferingType
- @offeringType
- end
-
- def OfferingType=(value)
- @offeringType = value
- end
-
- def SellerId
- @sellerId
- end
-
- def SellerId=(value)
- @sellerId = value
- end
-
- def SellerNickname
- @sellerNickname
- end
-
- def SellerNickname=(value)
- @sellerNickname = value
- end
-
- def ExchangeId
- @exchangeId
- end
-
- def ExchangeId=(value)
- @exchangeId = value
- end
-
- def OfferingPrice
- @offeringPrice
- end
-
- def OfferingPrice=(value)
- @offeringPrice = value
- end
-
- def Condition
- @condition
- end
-
- def Condition=(value)
- @condition = value
- end
-
- def ConditionType
- @conditionType
- end
-
- def ConditionType=(value)
- @conditionType = value
- end
-
- def ExchangeAvailability
- @exchangeAvailability
- end
-
- def ExchangeAvailability=(value)
- @exchangeAvailability = value
- end
-
- def SellerCountry
- @sellerCountry
- end
-
- def SellerCountry=(value)
- @sellerCountry = value
- end
-
- def SellerState
- @sellerState
- end
-
- def SellerState=(value)
- @sellerState = value
- end
-
- def ShipComments
- @shipComments
- end
-
- def ShipComments=(value)
- @shipComments = value
- end
-
- def SellerRating
- @sellerRating
- end
-
- def SellerRating=(value)
- @sellerRating = value
- end
-
- def initialize(offeringType = nil, sellerId = nil, sellerNickname = nil, exchangeId = nil, offeringPrice = nil, condition = nil, conditionType = nil, exchangeAvailability = nil, sellerCountry = nil, sellerState = nil, shipComments = nil, sellerRating = nil)
- @offeringType = offeringType
- @sellerId = sellerId
- @sellerNickname = sellerNickname
- @exchangeId = exchangeId
- @offeringPrice = offeringPrice
- @condition = condition
- @conditionType = conditionType
- @exchangeAvailability = exchangeAvailability
- @sellerCountry = sellerCountry
- @sellerState = sellerState
- @shipComments = shipComments
- @sellerRating = sellerRating
- end
-end
-
-# http://soap.amazon.com
-class KeywordRequest
- @@schema_type = "KeywordRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :keyword
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :price
-
- def initialize(keyword = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, price = nil)
- @keyword = keyword
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class TextStreamRequest
- @@schema_type = "TextStreamRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :textStream
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :price
-
- def initialize(textStream = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, price = nil)
- @textStream = textStream
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class PowerRequest
- @@schema_type = "PowerRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :power
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
-
- def initialize(power = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil)
- @power = power
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class BrowseNodeRequest
- @@schema_type = "BrowseNodeRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :browse_node
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(browse_node = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @browse_node = browse_node
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class AsinRequest
- @@schema_type = "AsinRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :asin
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :offer
- attr_accessor :offerpage
- attr_accessor :locale
- attr_accessor :mode
-
- def initialize(asin = nil, tag = nil, type = nil, devtag = nil, offer = nil, offerpage = nil, locale = nil, mode = nil)
- @asin = asin
- @tag = tag
- @type = type
- @devtag = devtag
- @offer = offer
- @offerpage = offerpage
- @locale = locale
- @mode = mode
- end
-end
-
-# http://soap.amazon.com
-class BlendedRequest
- @@schema_type = "BlendedRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :blended
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :locale
-
- def initialize(blended = nil, tag = nil, type = nil, devtag = nil, locale = nil)
- @blended = blended
- @tag = tag
- @type = type
- @devtag = devtag
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class UpcRequest
- @@schema_type = "UpcRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :upc
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
-
- def initialize(upc = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil)
- @upc = upc
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class SkuRequest
- @@schema_type = "SkuRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :sku
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :merchant_id
- attr_accessor :keywords
- attr_accessor :sort
- attr_accessor :locale
-
- def initialize(sku = nil, mode = nil, tag = nil, type = nil, devtag = nil, merchant_id = nil, keywords = nil, sort = nil, locale = nil)
- @sku = sku
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @merchant_id = merchant_id
- @keywords = keywords
- @sort = sort
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class ArtistRequest
- @@schema_type = "ArtistRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :artist
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(artist = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @artist = artist
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class AuthorRequest
- @@schema_type = "AuthorRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :author
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(author = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @author = author
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class ActorRequest
- @@schema_type = "ActorRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :actor
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(actor = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @actor = actor
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class DirectorRequest
- @@schema_type = "DirectorRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :director
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(director = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @director = director
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class ExchangeRequest
- @@schema_type = "ExchangeRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :exchange_id
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :locale
-
- def initialize(exchange_id = nil, tag = nil, type = nil, devtag = nil, locale = nil)
- @exchange_id = exchange_id
- @tag = tag
- @type = type
- @devtag = devtag
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class ManufacturerRequest
- @@schema_type = "ManufacturerRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :manufacturer
- attr_accessor :page
- attr_accessor :mode
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :sort
- attr_accessor :locale
- attr_accessor :keywords
- attr_accessor :price
-
- def initialize(manufacturer = nil, page = nil, mode = nil, tag = nil, type = nil, devtag = nil, sort = nil, locale = nil, keywords = nil, price = nil)
- @manufacturer = manufacturer
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- @locale = locale
- @keywords = keywords
- @price = price
- end
-end
-
-# http://soap.amazon.com
-class ListManiaRequest
- @@schema_type = "ListManiaRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :lm_id
- attr_accessor :page
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :locale
-
- def initialize(lm_id = nil, page = nil, tag = nil, type = nil, devtag = nil, locale = nil)
- @lm_id = lm_id
- @page = page
- @tag = tag
- @type = type
- @devtag = devtag
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class WishlistRequest
- @@schema_type = "WishlistRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :wishlist_id
- attr_accessor :page
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :locale
-
- def initialize(wishlist_id = nil, page = nil, tag = nil, type = nil, devtag = nil, locale = nil)
- @wishlist_id = wishlist_id
- @page = page
- @tag = tag
- @type = type
- @devtag = devtag
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class MarketplaceRequest
- @@schema_type = "MarketplaceRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :marketplace_search
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :page
- attr_accessor :keyword
- attr_accessor :keyword_search
- attr_accessor :browse_id
- attr_accessor :zipcode
- attr_accessor :area_id
- attr_accessor :geo
- attr_accessor :sort
- attr_accessor :listing_id
- attr_accessor :desc
- attr_accessor :locale
- attr_accessor :index
-
- def initialize(marketplace_search = nil, tag = nil, type = nil, devtag = nil, page = nil, keyword = nil, keyword_search = nil, browse_id = nil, zipcode = nil, area_id = nil, geo = nil, sort = nil, listing_id = nil, desc = nil, locale = nil, index = nil)
- @marketplace_search = marketplace_search
- @tag = tag
- @type = type
- @devtag = devtag
- @page = page
- @keyword = keyword
- @keyword_search = keyword_search
- @browse_id = browse_id
- @zipcode = zipcode
- @area_id = area_id
- @geo = geo
- @sort = sort
- @listing_id = listing_id
- @desc = desc
- @locale = locale
- @index = index
- end
-end
-
-# http://soap.amazon.com
-class SellerProfileRequest
- @@schema_type = "SellerProfileRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :seller_id
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :page
- attr_accessor :desc
- attr_accessor :locale
-
- def initialize(seller_id = nil, tag = nil, type = nil, devtag = nil, page = nil, desc = nil, locale = nil)
- @seller_id = seller_id
- @tag = tag
- @type = type
- @devtag = devtag
- @page = page
- @desc = desc
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class SellerRequest
- @@schema_type = "SellerRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :seller_id
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :offerstatus
- attr_accessor :page
- attr_accessor :seller_browse_id
- attr_accessor :keyword
- attr_accessor :desc
- attr_accessor :locale
- attr_accessor :index
-
- def initialize(seller_id = nil, tag = nil, type = nil, devtag = nil, offerstatus = nil, page = nil, seller_browse_id = nil, keyword = nil, desc = nil, locale = nil, index = nil)
- @seller_id = seller_id
- @tag = tag
- @type = type
- @devtag = devtag
- @offerstatus = offerstatus
- @page = page
- @seller_browse_id = seller_browse_id
- @keyword = keyword
- @desc = desc
- @locale = locale
- @index = index
- end
-end
-
-# http://soap.amazon.com
-class SimilarityRequest
- @@schema_type = "SimilarityRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :asin
- attr_accessor :tag
- attr_accessor :type
- attr_accessor :devtag
- attr_accessor :locale
-
- def initialize(asin = nil, tag = nil, type = nil, devtag = nil, locale = nil)
- @asin = asin
- @tag = tag
- @type = type
- @devtag = devtag
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class ItemIdArray < Array
- @@schema_type = "ItemIdArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ItemArray < Array
- @@schema_type = "ItemArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Item
- @@schema_type = "Item"
- @@schema_ns = "http://soap.amazon.com"
-
- def ItemId
- @itemId
- end
-
- def ItemId=(value)
- @itemId = value
- end
-
- def ProductName
- @productName
- end
-
- def ProductName=(value)
- @productName = value
- end
-
- def Catalog
- @catalog
- end
-
- def Catalog=(value)
- @catalog = value
- end
-
- def Asin
- @asin
- end
-
- def Asin=(value)
- @asin = value
- end
-
- def ExchangeId
- @exchangeId
- end
-
- def ExchangeId=(value)
- @exchangeId = value
- end
-
- def Quantity
- @quantity
- end
-
- def Quantity=(value)
- @quantity = value
- end
-
- def ListPrice
- @listPrice
- end
-
- def ListPrice=(value)
- @listPrice = value
- end
-
- def OurPrice
- @ourPrice
- end
-
- def OurPrice=(value)
- @ourPrice = value
- end
-
- def MerchantSku
- @merchantSku
- end
-
- def MerchantSku=(value)
- @merchantSku = value
- end
-
- def initialize(itemId = nil, productName = nil, catalog = nil, asin = nil, exchangeId = nil, quantity = nil, listPrice = nil, ourPrice = nil, merchantSku = nil)
- @itemId = itemId
- @productName = productName
- @catalog = catalog
- @asin = asin
- @exchangeId = exchangeId
- @quantity = quantity
- @listPrice = listPrice
- @ourPrice = ourPrice
- @merchantSku = merchantSku
- end
-end
-
-# http://soap.amazon.com
-class ItemQuantityArray < Array
- @@schema_type = "ItemQuantityArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ItemQuantity
- @@schema_type = "ItemQuantity"
- @@schema_ns = "http://soap.amazon.com"
-
- def ItemId
- @itemId
- end
-
- def ItemId=(value)
- @itemId = value
- end
-
- def Quantity
- @quantity
- end
-
- def Quantity=(value)
- @quantity = value
- end
-
- def initialize(itemId = nil, quantity = nil)
- @itemId = itemId
- @quantity = quantity
- end
-end
-
-# http://soap.amazon.com
-class AddItemArray < Array
- @@schema_type = "AddItemArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class AddItem
- @@schema_type = "AddItem"
- @@schema_ns = "http://soap.amazon.com"
-
- def ParentAsin
- @parentAsin
- end
-
- def ParentAsin=(value)
- @parentAsin = value
- end
-
- def Asin
- @asin
- end
-
- def Asin=(value)
- @asin = value
- end
-
- def MerchantId
- @merchantId
- end
-
- def MerchantId=(value)
- @merchantId = value
- end
-
- def ExchangeId
- @exchangeId
- end
-
- def ExchangeId=(value)
- @exchangeId = value
- end
-
- def Quantity
- @quantity
- end
-
- def Quantity=(value)
- @quantity = value
- end
-
- def initialize(parentAsin = nil, asin = nil, merchantId = nil, exchangeId = nil, quantity = nil)
- @parentAsin = parentAsin
- @asin = asin
- @merchantId = merchantId
- @exchangeId = exchangeId
- @quantity = quantity
- end
-end
-
-# http://soap.amazon.com
-class ShoppingCart
- @@schema_type = "ShoppingCart"
- @@schema_ns = "http://soap.amazon.com"
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def PurchaseUrl
- @purchaseUrl
- end
-
- def PurchaseUrl=(value)
- @purchaseUrl = value
- end
-
- def Items
- @items
- end
-
- def Items=(value)
- @items = value
- end
-
- def SimilarProducts
- @similarProducts
- end
-
- def SimilarProducts=(value)
- @similarProducts = value
- end
-
- def initialize(cartId = nil, hMAC = nil, purchaseUrl = nil, items = nil, similarProducts = nil)
- @cartId = cartId
- @hMAC = hMAC
- @purchaseUrl = purchaseUrl
- @items = items
- @similarProducts = similarProducts
- end
-end
-
-# http://soap.amazon.com
-class GetShoppingCartRequest
- @@schema_type = "GetShoppingCartRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :locale
- attr_accessor :sims
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def initialize(tag = nil, devtag = nil, cartId = nil, hMAC = nil, locale = nil, sims = nil)
- @tag = tag
- @devtag = devtag
- @cartId = cartId
- @hMAC = hMAC
- @locale = locale
- @sims = sims
- end
-end
-
-# http://soap.amazon.com
-class ClearShoppingCartRequest
- @@schema_type = "ClearShoppingCartRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :locale
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def initialize(tag = nil, devtag = nil, cartId = nil, hMAC = nil, locale = nil)
- @tag = tag
- @devtag = devtag
- @cartId = cartId
- @hMAC = hMAC
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class AddShoppingCartItemsRequest
- @@schema_type = "AddShoppingCartItemsRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :locale
- attr_accessor :sims
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def Items
- @items
- end
-
- def Items=(value)
- @items = value
- end
-
- def initialize(tag = nil, devtag = nil, cartId = nil, hMAC = nil, items = nil, locale = nil, sims = nil)
- @tag = tag
- @devtag = devtag
- @cartId = cartId
- @hMAC = hMAC
- @items = items
- @locale = locale
- @sims = sims
- end
-end
-
-# http://soap.amazon.com
-class RemoveShoppingCartItemsRequest
- @@schema_type = "RemoveShoppingCartItemsRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :locale
- attr_accessor :sims
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def Items
- @items
- end
-
- def Items=(value)
- @items = value
- end
-
- def initialize(tag = nil, devtag = nil, cartId = nil, hMAC = nil, items = nil, locale = nil, sims = nil)
- @tag = tag
- @devtag = devtag
- @cartId = cartId
- @hMAC = hMAC
- @items = items
- @locale = locale
- @sims = sims
- end
-end
-
-# http://soap.amazon.com
-class ModifyShoppingCartItemsRequest
- @@schema_type = "ModifyShoppingCartItemsRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :locale
- attr_accessor :sims
-
- def CartId
- @cartId
- end
-
- def CartId=(value)
- @cartId = value
- end
-
- def HMAC
- @hMAC
- end
-
- def HMAC=(value)
- @hMAC = value
- end
-
- def Items
- @items
- end
-
- def Items=(value)
- @items = value
- end
-
- def initialize(tag = nil, devtag = nil, cartId = nil, hMAC = nil, items = nil, locale = nil, sims = nil)
- @tag = tag
- @devtag = devtag
- @cartId = cartId
- @hMAC = hMAC
- @items = items
- @locale = locale
- @sims = sims
- end
-end
-
-# http://soap.amazon.com
-class OrderIdArray < Array
- @@schema_type = "OrderIdArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class Price
- @@schema_type = "Price"
- @@schema_ns = "http://soap.amazon.com"
-
- def Amount
- @amount
- end
-
- def Amount=(value)
- @amount = value
- end
-
- def CurrencyCode
- @currencyCode
- end
-
- def CurrencyCode=(value)
- @currencyCode = value
- end
-
- def initialize(amount = nil, currencyCode = nil)
- @amount = amount
- @currencyCode = currencyCode
- end
-end
-
-# http://soap.amazon.com
-class Package
- @@schema_type = "Package"
- @@schema_ns = "http://soap.amazon.com"
-
- def TrackingNumber
- @trackingNumber
- end
-
- def TrackingNumber=(value)
- @trackingNumber = value
- end
-
- def CarrierName
- @carrierName
- end
-
- def CarrierName=(value)
- @carrierName = value
- end
-
- def initialize(trackingNumber = nil, carrierName = nil)
- @trackingNumber = trackingNumber
- @carrierName = carrierName
- end
-end
-
-# http://soap.amazon.com
-class PackageArray < Array
- @@schema_type = "PackageArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class OrderItem
- @@schema_type = "OrderItem"
- @@schema_ns = "http://soap.amazon.com"
-
- def ItemNumber
- @itemNumber
- end
-
- def ItemNumber=(value)
- @itemNumber = value
- end
-
- def ASIN
- @aSIN
- end
-
- def ASIN=(value)
- @aSIN = value
- end
-
- def ExchangeId
- @exchangeId
- end
-
- def ExchangeId=(value)
- @exchangeId = value
- end
-
- def Quantity
- @quantity
- end
-
- def Quantity=(value)
- @quantity = value
- end
-
- def UnitPrice
- @unitPrice
- end
-
- def UnitPrice=(value)
- @unitPrice = value
- end
-
- def TotalPrice
- @totalPrice
- end
-
- def TotalPrice=(value)
- @totalPrice = value
- end
-
- def initialize(itemNumber = nil, aSIN = nil, exchangeId = nil, quantity = nil, unitPrice = nil, totalPrice = nil)
- @itemNumber = itemNumber
- @aSIN = aSIN
- @exchangeId = exchangeId
- @quantity = quantity
- @unitPrice = unitPrice
- @totalPrice = totalPrice
- end
-end
-
-# http://soap.amazon.com
-class OrderItemArray < Array
- @@schema_type = "OrderItemArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class ShortSummary
- @@schema_type = "ShortSummary"
- @@schema_ns = "http://soap.amazon.com"
-
- def OrderId
- @orderId
- end
-
- def OrderId=(value)
- @orderId = value
- end
-
- def SellerId
- @sellerId
- end
-
- def SellerId=(value)
- @sellerId = value
- end
-
- def Condition
- @condition
- end
-
- def Condition=(value)
- @condition = value
- end
-
- def TransactionDate
- @transactionDate
- end
-
- def TransactionDate=(value)
- @transactionDate = value
- end
-
- def TransactionDateEpoch
- @transactionDateEpoch
- end
-
- def TransactionDateEpoch=(value)
- @transactionDateEpoch = value
- end
-
- def Total
- @total
- end
-
- def Total=(value)
- @total = value
- end
-
- def Subtotal
- @subtotal
- end
-
- def Subtotal=(value)
- @subtotal = value
- end
-
- def Shipping
- @shipping
- end
-
- def Shipping=(value)
- @shipping = value
- end
-
- def Tax
- @tax
- end
-
- def Tax=(value)
- @tax = value
- end
-
- def Promotion
- @promotion
- end
-
- def Promotion=(value)
- @promotion = value
- end
-
- def StoreName
- @storeName
- end
-
- def StoreName=(value)
- @storeName = value
- end
-
- def Packages
- @packages
- end
-
- def Packages=(value)
- @packages = value
- end
-
- def OrderItems
- @orderItems
- end
-
- def OrderItems=(value)
- @orderItems = value
- end
-
- def ErrorCode
- @errorCode
- end
-
- def ErrorCode=(value)
- @errorCode = value
- end
-
- def ErrorString
- @errorString
- end
-
- def ErrorString=(value)
- @errorString = value
- end
-
- def initialize(orderId = nil, sellerId = nil, condition = nil, transactionDate = nil, transactionDateEpoch = nil, total = nil, subtotal = nil, shipping = nil, tax = nil, promotion = nil, storeName = nil, packages = nil, orderItems = nil, errorCode = nil, errorString = nil)
- @orderId = orderId
- @sellerId = sellerId
- @condition = condition
- @transactionDate = transactionDate
- @transactionDateEpoch = transactionDateEpoch
- @total = total
- @subtotal = subtotal
- @shipping = shipping
- @tax = tax
- @promotion = promotion
- @storeName = storeName
- @packages = packages
- @orderItems = orderItems
- @errorCode = errorCode
- @errorString = errorString
- end
-end
-
-# http://soap.amazon.com
-class ShortSummaryArray < Array
- @@schema_type = "ShortSummaryArray"
- @@schema_ns = "http://soap.amazon.com"
-end
-
-# http://soap.amazon.com
-class GetTransactionDetailsRequest
- @@schema_type = "GetTransactionDetailsRequest"
- @@schema_ns = "http://soap.amazon.com"
-
- attr_accessor :tag
- attr_accessor :devtag
- attr_accessor :key
- attr_accessor :locale
-
- def OrderIds
- @orderIds
- end
-
- def OrderIds=(value)
- @orderIds = value
- end
-
- def initialize(tag = nil, devtag = nil, key = nil, orderIds = nil, locale = nil)
- @tag = tag
- @devtag = devtag
- @key = key
- @orderIds = orderIds
- @locale = locale
- end
-end
-
-# http://soap.amazon.com
-class GetTransactionDetailsResponse
- @@schema_type = "GetTransactionDetailsResponse"
- @@schema_ns = "http://soap.amazon.com"
-
- def ShortSummaries
- @shortSummaries
- end
-
- def ShortSummaries=(value)
- @shortSummaries = value
- end
-
- def initialize(shortSummaries = nil)
- @shortSummaries = shortSummaries
- end
-end
-
diff --git a/sample/wsdl/amazon/AmazonSearchDriver.rb b/sample/wsdl/amazon/AmazonSearchDriver.rb
deleted file mode 100644
index 60af68887c..0000000000
--- a/sample/wsdl/amazon/AmazonSearchDriver.rb
+++ /dev/null
@@ -1,536 +0,0 @@
-require 'AmazonSearch.rb'
-
-require 'soap/rpc/driver'
-
-class AmazonSearchPort < ::SOAP::RPC::Driver
- DefaultEndpointUrl = "http://soap.amazon.com/onca/soap3"
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- KeywordRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "KeywordRequest") }
- )
- MappingRegistry.set(
- ProductInfo,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ProductInfo") }
- )
- MappingRegistry.set(
- DetailsArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "Details") }
- )
- MappingRegistry.set(
- TextStreamRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "TextStreamRequest") }
- )
- MappingRegistry.set(
- PowerRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "PowerRequest") }
- )
- MappingRegistry.set(
- BrowseNodeRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "BrowseNodeRequest") }
- )
- MappingRegistry.set(
- AsinRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "AsinRequest") }
- )
- MappingRegistry.set(
- BlendedRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "BlendedRequest") }
- )
- MappingRegistry.set(
- ProductLineArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ProductLine") }
- )
- MappingRegistry.set(
- UpcRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "UpcRequest") }
- )
- MappingRegistry.set(
- SkuRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SkuRequest") }
- )
- MappingRegistry.set(
- AuthorRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "AuthorRequest") }
- )
- MappingRegistry.set(
- ArtistRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ArtistRequest") }
- )
- MappingRegistry.set(
- ActorRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ActorRequest") }
- )
- MappingRegistry.set(
- ManufacturerRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ManufacturerRequest") }
- )
- MappingRegistry.set(
- DirectorRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "DirectorRequest") }
- )
- MappingRegistry.set(
- ListManiaRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ListManiaRequest") }
- )
- MappingRegistry.set(
- WishlistRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "WishlistRequest") }
- )
- MappingRegistry.set(
- ExchangeRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ExchangeRequest") }
- )
- MappingRegistry.set(
- ListingProductDetails,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ListingProductDetails") }
- )
- MappingRegistry.set(
- MarketplaceRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceRequest") }
- )
- MappingRegistry.set(
- MarketplaceSearch,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearch") }
- )
- MappingRegistry.set(
- MarketplaceSearchDetailsArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearchDetails") }
- )
- MappingRegistry.set(
- SellerProfileRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileRequest") }
- )
- MappingRegistry.set(
- SellerProfile,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfile") }
- )
- MappingRegistry.set(
- SellerProfileDetailsArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileDetails") }
- )
- MappingRegistry.set(
- SellerRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerRequest") }
- )
- MappingRegistry.set(
- SellerSearch,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearch") }
- )
- MappingRegistry.set(
- SellerSearchDetailsArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearchDetails") }
- )
- MappingRegistry.set(
- SimilarityRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SimilarityRequest") }
- )
- MappingRegistry.set(
- GetShoppingCartRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "GetShoppingCartRequest") }
- )
- MappingRegistry.set(
- ShoppingCart,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ShoppingCart") }
- )
- MappingRegistry.set(
- ItemArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "Item") }
- )
- MappingRegistry.set(
- SimilarProductsArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- ClearShoppingCartRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ClearShoppingCartRequest") }
- )
- MappingRegistry.set(
- AddShoppingCartItemsRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "AddShoppingCartItemsRequest") }
- )
- MappingRegistry.set(
- AddItemArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "AddItem") }
- )
- MappingRegistry.set(
- RemoveShoppingCartItemsRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "RemoveShoppingCartItemsRequest") }
- )
- MappingRegistry.set(
- ItemIdArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- ModifyShoppingCartItemsRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ModifyShoppingCartItemsRequest") }
- )
- MappingRegistry.set(
- ItemQuantityArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
- )
- MappingRegistry.set(
- GetTransactionDetailsRequest,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "GetTransactionDetailsRequest") }
- )
- MappingRegistry.set(
- OrderIdArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- GetTransactionDetailsResponse,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "GetTransactionDetailsResponse") }
- )
- MappingRegistry.set(
- ShortSummaryArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ShortSummary") }
- )
- MappingRegistry.set(
- Details,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "Details") }
- )
- MappingRegistry.set(
- ProductLine,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ProductLine") }
- )
- MappingRegistry.set(
- MarketplaceSearchDetails,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "MarketplaceSearchDetails") }
- )
- MappingRegistry.set(
- SellerProfileDetails,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerProfileDetails") }
- )
- MappingRegistry.set(
- SellerSearchDetails,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "SellerSearchDetails") }
- )
- MappingRegistry.set(
- Item,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "Item") }
- )
- MappingRegistry.set(
- AddItem,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "AddItem") }
- )
- MappingRegistry.set(
- ItemQuantity,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
- )
- MappingRegistry.set(
- ShortSummary,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://soap.amazon.com", "ShortSummary") }
- )
-
- Methods = [
- ["KeywordSearchRequest", "keywordSearchRequest",
- [
- ["in", "KeywordSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "KeywordRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["TextStreamSearchRequest", "textStreamSearchRequest",
- [
- ["in", "TextStreamSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "TextStreamRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["PowerSearchRequest", "powerSearchRequest",
- [
- ["in", "PowerSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "PowerRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["BrowseNodeSearchRequest", "browseNodeSearchRequest",
- [
- ["in", "BrowseNodeSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "BrowseNodeRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["AsinSearchRequest", "asinSearchRequest",
- [
- ["in", "AsinSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "AsinRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["BlendedSearchRequest", "blendedSearchRequest",
- [
- ["in", "BlendedSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "BlendedRequest"]],
- ["retval", "return", [::SOAP::SOAPArray, "http://soap.amazon.com", "ProductLine"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["UpcSearchRequest", "upcSearchRequest",
- [
- ["in", "UpcSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "UpcRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["SkuSearchRequest", "skuSearchRequest",
- [
- ["in", "SkuSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SkuRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["AuthorSearchRequest", "authorSearchRequest",
- [
- ["in", "AuthorSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "AuthorRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ArtistSearchRequest", "artistSearchRequest",
- [
- ["in", "ArtistSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ArtistRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ActorSearchRequest", "actorSearchRequest",
- [
- ["in", "ActorSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ActorRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ManufacturerSearchRequest", "manufacturerSearchRequest",
- [
- ["in", "ManufacturerSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ManufacturerRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["DirectorSearchRequest", "directorSearchRequest",
- [
- ["in", "DirectorSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "DirectorRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ListManiaSearchRequest", "listManiaSearchRequest",
- [
- ["in", "ListManiaSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ListManiaRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["WishlistSearchRequest", "wishlistSearchRequest",
- [
- ["in", "WishlistSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "WishlistRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ExchangeSearchRequest", "exchangeSearchRequest",
- [
- ["in", "ExchangeSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ExchangeRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ListingProductDetails"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["MarketplaceSearchRequest", "marketplaceSearchRequest",
- [
- ["in", "MarketplaceSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "MarketplaceRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "MarketplaceSearch"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["SellerProfileSearchRequest", "sellerProfileSearchRequest",
- [
- ["in", "SellerProfileSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerProfileRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerProfile"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["SellerSearchRequest", "sellerSearchRequest",
- [
- ["in", "SellerSearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SellerSearch"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["SimilaritySearchRequest", "similaritySearchRequest",
- [
- ["in", "SimilaritySearchRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "SimilarityRequest"]],
- ["retval", "return", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["GetShoppingCartRequest", "getShoppingCartRequest",
- [
- ["in", "GetShoppingCartRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "GetShoppingCartRequest"]],
- ["retval", "ShoppingCart", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ClearShoppingCartRequest", "clearShoppingCartRequest",
- [
- ["in", "ClearShoppingCartRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ClearShoppingCartRequest"]],
- ["retval", "ShoppingCart", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["AddShoppingCartItemsRequest", "addShoppingCartItemsRequest",
- [
- ["in", "AddShoppingCartItemsRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "AddShoppingCartItemsRequest"]],
- ["retval", "ShoppingCart", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["RemoveShoppingCartItemsRequest", "removeShoppingCartItemsRequest",
- [
- ["in", "RemoveShoppingCartItemsRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "RemoveShoppingCartItemsRequest"]],
- ["retval", "ShoppingCart", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["ModifyShoppingCartItemsRequest", "modifyShoppingCartItemsRequest",
- [
- ["in", "ModifyShoppingCartItemsRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ModifyShoppingCartItemsRequest"]],
- ["retval", "ShoppingCart", [::SOAP::SOAPStruct, "http://soap.amazon.com", "ShoppingCart"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ],
- ["GetTransactionDetailsRequest", "getTransactionDetailsRequest",
- [
- ["in", "GetTransactionDetailsRequest", [::SOAP::SOAPStruct, "http://soap.amazon.com", "GetTransactionDetailsRequest"]],
- ["retval", "GetTransactionDetailsResponse", [::SOAP::SOAPStruct, "http://soap.amazon.com", "GetTransactionDetailsResponse"]]
- ],
- "http://soap.amazon.com", "http://soap.amazon.com"
- ]
- ]
-
- 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/amazon/sampleClient.rb b/sample/wsdl/amazon/sampleClient.rb
deleted file mode 100644
index 3caad84e04..0000000000
--- a/sample/wsdl/amazon/sampleClient.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env ruby
-
-# This file is a sample based on AmazonSearchServiceClient.rb, which can be
-# generated by WSDL file and wsdl2ruby.rb.
-#
-# $ wsdl2ruby.rb --type client --force \
-# --wsdl http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
-#
-# See wsdlDriver.rb to use WSDL file directly (slow).
-require 'AmazonSearchDriver.rb'
-
-endpoint_url = ARGV.shift
-obj = AmazonSearchPort.new(endpoint_url)
-
-# Uncomment the below line to see SOAP wiredumps.
-# obj.wiredump_dev = STDERR
-
-# SYNOPSIS
-# KeywordSearchRequest(keywordSearchRequest)
-#
-# ARGS
-# keywordSearchRequest KeywordRequest - {urn:PI/DevCentral/SoapService}KeywordRequest
-#
-# RETURNS
-# return ProductInfo - {urn:PI/DevCentral/SoapService}ProductInfo
-#
-# RAISES
-# N/A
-#
-keywordSearchRequest = KeywordRequest.new("Ruby Object", "1", "books", "webservices-20", "lite", "", "+salesrank")
-obj.keywordSearchRequest(keywordSearchRequest).Details.each do |detail|
- puts "== #{detail.ProductName}"
- puts "Author: #{detail.Authors.join(", ")}"
- puts "Release date: #{detail.ReleaseDate}"
- puts "List price: #{detail.ListPrice}, our price: #{detail.OurPrice}"
- puts
-end
diff --git a/sample/wsdl/amazon/wsdlDriver.rb b/sample/wsdl/amazon/wsdlDriver.rb
deleted file mode 100644
index e62a9a65b3..0000000000
--- a/sample/wsdl/amazon/wsdlDriver.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require 'soap/wsdlDriver'
-
-book = ARGV.shift || "Ruby"
-
-# AmazonSearch.rb is generated from WSDL.
-# Run "wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas3/AmazonWebServices.wsdl --classdef --force"
-# http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
-require 'AmazonSearch.rb'
-
-=begin
-Or, define the class by yourself like this.
-
-class KeywordRequest
- def initialize(keyword = nil,
- page = nil,
- mode = nil,
- tag = nil,
- type = nil,
- devtag = nil,
- sort = nil)
- @keyword = keyword
- @page = page
- @mode = mode
- @tag = tag
- @type = type
- @devtag = devtag
- @sort = sort
- end
-end
-=end
-
-# You must get 'developer's token" from http://associates.amazon.com/exec/panama/associates/ntg/browse/-/1067662 to use Amazon Web Services 2.0.
-#devtag = File.open(File.expand_path("~/.amazon_key")) { |f| f.read }.chomp
-devtag = nil
-
-# v2: AMAZON_WSDL = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'
-AMAZON_WSDL = 'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl'
-amazon = SOAP::WSDLDriverFactory.new(AMAZON_WSDL).create_driver
-p "WSDL loaded"
-amazon.generate_explicit_type = true
-amazon.mandatorycharset = 'utf-8' # AWS should fix this bug.
-#amazon.wiredump_dev = STDERR
-
-# Show sales rank.
-req = KeywordRequest.new(book, "1", "books", "webservices-20", "lite", devtag, "+salesrank")
-amazon.KeywordSearchRequest(req).Details.each do |detail|
- puts "== #{detail.ProductName}"
- puts "Author: #{detail.Authors.join(", ")}"
- puts "Release date: #{detail.ReleaseDate}"
- puts "List price: #{detail.ListPrice}, our price: #{detail.OurPrice}"
- puts
-end
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
diff --git a/sample/wsdl/raa/raa.wsdl b/sample/wsdl/raa/raa.wsdl
deleted file mode 100644
index 78376893dd..0000000000
--- a/sample/wsdl/raa/raa.wsdl
+++ /dev/null
@@ -1,264 +0,0 @@
-<?xml version="1.0"?>
-<definitions
- name="RAA"
- targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:tns="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:txd="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:apachesoap="http://xml.apache.org/xml-soap">
-
- <types>
- <schema
- xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/">
-
- <complexType name="Category">
- <all>
- <element name="major" type="string"/>
- <element name="minor" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Product">
- <all>
- <element name="id" type="int"/>
- <element name="name" type="string"/>
- <element name="short_description" type="string"/>
- <element name="version" type="string"/>
- <element name="status" type="string"/>
- <element name="homepage" type="anyURI"/>
- <element name="download" type="anyURI"/>
- <element name="license" type="string"/>
- <element name="description" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Owner">
- <all>
- <element name="id" type="int"/>
- <element name="email" type="anyURI"/>
- <element name="name" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Info">
- <all>
- <element name="category" type="txd:Category"/>
- <element name="product" type="txd:Product"/>
- <element name="owner" type="txd:Owner"/>
- <element name="created" type="xsd:dateTime"/>
- <element name="updated" type="xsd:dateTime"/>
- </all>
- </complexType>
-
- <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
- <complexType name="InfoArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="txd:Info[]"/>
- </restriction>
- </complexContent>
- </complexType>
-
- <complexType name="StringArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
- </restriction>
- </complexContent>
- </complexType>
- </schema>
-
- <!-- type definition for ApacheSOAP's Map -->
- <schema
- xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://xml.apache.org/xml-soap">
- <complexType name="Map">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="key" type="anyType" />
- <element name="value" type="anyType" />
- </sequence>
- </complexType>
- </element>
- </sequence>
- </complexType>
- </schema>
- </types>
-
- <message name="getAllListingsRequest"/>
- <message name="getAllListingsResponse">
- <part name="return" type="txd:StringArray"/>
- </message>
-
- <message name="getProductTreeRequest"/>
- <message name="getProductTreeResponse">
- <part name="return" type="apachesoap:Map"/>
- </message>
-
- <message name="getInfoFromCategoryRequest">
- <part name="category" type="txd:Category"/>
- </message>
- <message name="getInfoFromCategoryResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <message name="getModifiedInfoSinceRequest">
- <part name="timeInstant" type="xsd:dateTime"/>
- </message>
- <message name="getModifiedInfoSinceResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <message name="getInfoFromNameRequest">
- <part name="productName" type="xsd:string"/>
- </message>
- <message name="getInfoFromNameResponse">
- <part name="return" type="txd:Info"/>
- </message>
-
- <message name="getInfoFromOwnerIdRequest">
- <part name="ownerId" type="xsd:int"/>
- </message>
- <message name="getInfoFromOwnerIdResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <portType name="RAABaseServicePortType">
- <operation name="getAllListings"
- parameterOrder="">
- <input message="tns:getAllListingsRequest"/>
- <output message="tns:getAllListingsResponse"/>
- </operation>
-
- <operation name="getProductTree"
- parameterOrder="">
- <input message="tns:getProductTreeRequest"/>
- <output message="tns:getProductTreeResponse"/>
- </operation>
-
- <operation name="getInfoFromCategory"
- parameterOrder="category">
- <input message="tns:getInfoFromCategoryRequest"/>
- <output message="tns:getInfoFromCategoryResponse"/>
- </operation>
-
- <operation name="getModifiedInfoSince"
- parameterOrder="timeInstant">
- <input message="tns:getModifiedInfoSinceRequest"/>
- <output message="tns:getModifiedInfoSinceResponse"/>
- </operation>
-
- <operation name="getInfoFromName"
- parameterOrder="productName">
- <input message="tns:getInfoFromNameRequest"/>
- <output message="tns:getInfoFromNameResponse"/>
- </operation>
-
- <operation name="getInfoFromOwnerId"
- parameterOrder="ownerId">
- <input message="tns:getInfoFromOwnerIdRequest"/>
- <output message="tns:getInfoFromOwnerIdResponse"/>
- </operation>
- </portType>
-
- <binding name="RAABaseServicePortBinding" type="tns:RAABaseServicePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <operation name="getAllListings">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getProductTree">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromCategory">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getModifiedInfoSince">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromName">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromOwnerId">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
- </binding>
-
- <service name="RAAService">
- <port name="RAABaseServicePort" binding="tns:RAABaseServicePortBinding">
- <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
- </port>
- </service>
-</definitions>
diff --git a/sample/wsdl/raa/soap4r.rb b/sample/wsdl/raa/soap4r.rb
deleted file mode 100644
index a70b3b5b21..0000000000
--- a/sample/wsdl/raa/soap4r.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/wsdlDriver'
-wsdl = 'http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/'
-raa = SOAP::WSDLDriverFactory.new(wsdl).create_driver
-raa.generate_explicit_type = true
-p "WSDL loaded."
-
-class Category
- def initialize(major, minor)
- @major = major
- @minor = minor
- end
-end
-
-p raa.getAllListings().sort
-
-p raa.getProductTree()
-
-p raa.getInfoFromCategory(Category.new("Library", "XML"))
-
-t = Time.at(Time.now.to_i - 24 * 3600)
-p raa.getModifiedInfoSince(t)
-
-p raa.getModifiedInfoSince(DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec))
-
-o = raa.getInfoFromName("SOAP4R")
-p o.type
-p o.owner.name
-p o
-
diff --git a/sample/wsdl/raa2.4/raa.rb b/sample/wsdl/raa2.4/raa.rb
deleted file mode 100644
index 9b4c4e41aa..0000000000
--- a/sample/wsdl/raa2.4/raa.rb
+++ /dev/null
@@ -1,332 +0,0 @@
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Gem
- @@schema_type = "Gem"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def category
- @category
- end
-
- def category=(value)
- @category = value
- end
-
- def owner
- @owner
- end
-
- def owner=(value)
- @owner = value
- end
-
- def project
- @project
- end
-
- def project=(value)
- @project = value
- end
-
- def updated
- @updated
- end
-
- def updated=(value)
- @updated = value
- end
-
- def created
- @created
- end
-
- def created=(value)
- @created = value
- end
-
- def initialize(id = nil,
- category = nil,
- owner = nil,
- project = nil,
- updated = nil,
- created = nil)
- @id = id
- @category = category
- @owner = owner
- @project = project
- @updated = updated
- @created = created
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Category
- @@schema_type = "Category"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def major
- @major
- end
-
- def major=(value)
- @major = value
- end
-
- def minor
- @minor
- end
-
- def minor=(value)
- @minor = value
- end
-
- def initialize(major = nil,
- minor = nil)
- @major = major
- @minor = minor
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Owner
- @@schema_type = "Owner"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def email
- @email
- end
-
- def email=(value)
- @email = value
- end
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def initialize(id = nil,
- email = nil,
- name = nil)
- @id = id
- @email = email
- @name = name
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class Project
- @@schema_type = "Project"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def short_description
- @short_description
- end
-
- def short_description=(value)
- @short_description = value
- end
-
- def version
- @version
- end
-
- def version=(value)
- @version = value
- end
-
- def status
- @status
- end
-
- def status=(value)
- @status = value
- end
-
- def url
- @url
- end
-
- def url=(value)
- @url = value
- end
-
- def download
- @download
- end
-
- def download=(value)
- @download = value
- end
-
- def license
- @license
- end
-
- def license=(value)
- @license = value
- end
-
- def description
- @description
- end
-
- def description=(value)
- @description = value
- end
-
- def updated
- @updated
- end
-
- def updated=(value)
- @updated = value
- end
-
- def history
- @history
- end
-
- def history=(value)
- @history = value
- end
-
- def dependency
- @dependency
- end
-
- def dependency=(value)
- @dependency = value
- end
-
- def initialize(name = nil,
- short_description = nil,
- version = nil,
- status = nil,
- url = nil,
- download = nil,
- license = nil,
- description = nil,
- updated = nil,
- history = nil,
- dependency = nil)
- @name = name
- @short_description = short_description
- @version = version
- @status = status
- @url = url
- @download = download
- @license = license
- @description = description
- @updated = updated
- @history = history
- @dependency = dependency
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectDependency
- @@schema_type = "ProjectDependency"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-
- def project
- @project
- end
-
- def project=(value)
- @project = value
- end
-
- def version
- @version
- end
-
- def version=(value)
- @version = value
- end
-
- def description
- @description
- end
-
- def description=(value)
- @description = value
- end
-
- def initialize(project = nil,
- version = nil,
- description = nil)
- @project = project
- @version = version
- @description = description
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class GemArray < Array
- # Contents type should be dumped here...
- @@schema_type = "GemArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class OwnerArray < Array
- # Contents type should be dumped here...
- @@schema_type = "OwnerArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectArray < Array
- # Contents type should be dumped here...
- @@schema_type = "ProjectArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class ProjectDependencyArray < Array
- # Contents type should be dumped here...
- @@schema_type = "ProjectDependencyArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/
-class StringArray < Array
- # Contents type should be dumped here...
- @@schema_type = "StringArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/type/RAA/0.0.3/"
-end
-
-# http://xml.apache.org/xml-soap
-class Map < Array
- # Contents type should be dumped here...
- @@schema_type = "Map"
- @@schema_ns = "http://xml.apache.org/xml-soap"
-end
-
diff --git a/sample/wsdl/raa2.4/wsdlDriver.rb b/sample/wsdl/raa2.4/wsdlDriver.rb
deleted file mode 100644
index bc5fb19982..0000000000
--- a/sample/wsdl/raa2.4/wsdlDriver.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/env ruby
-
-# You can generate raa.rb required here with the command;
-# wsdl2ruby.rb --wsdl http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/ --classdef
-require 'raa'
-require 'soap/wsdlDriver'
-require 'pp'
-
-RAA_WSDL = 'http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/'
-
-raa = SOAP::WSDLDriverFactory.new(RAA_WSDL).create_driver
-raa.generate_explicit_type = true
-# raa.wiredump_dev = STDERR
-
-def sec(msg)
- puts
- puts "--------"
- puts "-- " + msg
- puts
-end
-
-def subsec(msg)
- puts "-- " + msg
-end
-
-sec("retrieve a gem (RAA Information) which has specified name")
-name = 'soap4r'
-pp raa.gem(name)
-
-sec("retrieve dependents of the project")
-name = 'http-access2'; version = nil
-pp raa.dependents(name, version)
-
-sec("number of registered gems")
-puts raa.size
-
-sec("retrieve all registered gem names")
-p raa.names
-
-sec("retrieve gems of specified category")
-major = 'Library'; minor = 'XML'
-p raa.list_by_category(major, minor)
-
-sec("retrieve category tree")
-pp raa.tree_by_category
-
-sec("retrieve gems which is updated recently")
-idx = 0
-p raa.list_recent_updated(idx)
-subsec("next 10 gems")
-idx += 1
-p raa.list_recent_updated(idx)
-subsec("next 10 gems")
-idx += 1
-p raa.list_recent_updated(idx)
-
-sec("retrieve gems which is created recently")
-p raa.list_recent_created(idx)
-
-sec("retrieve gems which is updated in 7 days")
-date = Time.now - 7 * 24 * 60 * 60; idx = 0
-p raa.list_updated_since(date, idx)
-
-sec("retrieve gems which is created in 7 days")
-p raa.list_created_since(date, idx)
-
-sec("retrieve gems of specified owner")
-owner_id = 8 # NaHi
-p raa.list_by_owner(owner_id)
-
-sec("search gems with keyword")
-substring = 'soap'
-pp raa.search(substring)
-
-# There are several search interface to search a field explicitly.
-# puts raa.search_name(substring, idx)
-# puts raa.search_short_description(substring, idx)
-# puts raa.search_owner(substring, idx)
-# puts raa.search_version(substring, idx)
-# puts raa.search_status(substring, idx)
-# puts raa.search_description(substring, idx)
-
-sec("retrieve owner info")
-owner_id = 8
-pp raa.owner(owner_id)
-
-sec("retrieve owners")
-idx = 0
-p raa.list_owner(idx)
-
-sec("update 'sampleproject'")
-name = 'sampleproject'
-pass = 'sampleproject'
-gem = raa.gem(name)
-p gem.project.version
-gem.project.version.succ!
-gem.updated = Time.now
-raa.update(name, pass, gem)
-p raa.gem(name).project.version
-
-sec("update pass phrase")
-raa.update_pass(name, 'sampleproject', 'foo')
-subsec("update check")
-gem = raa.gem(name)
-gem.project.description = 'Current pass phrase is "foo"'
-gem.updated = Time.now
-raa.update(name, 'foo', gem)
-#
-subsec("recover pass phrase")
-raa.update_pass(name, 'foo', 'sampleproject')
-subsec("update check")
-gem = raa.gem(name)
-gem.project.description = 'Current pass phrase is "sampleproject"'
-gem.updated = Time.now
-raa.update(name, 'sampleproject', gem)
-
-sec("done")
diff --git a/test/soap/calc/test_calc.rb b/test/soap/calc/test_calc.rb
index 4210c65772..88738716a6 100644
--- a/test/soap/calc/test_calc.rb
+++ b/test/soap/calc/test_calc.rb
@@ -16,13 +16,6 @@ class TestCalc < Test::Unit::TestCase
@t = Thread.new {
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
@endpoint = "http://localhost:#{Port}/"
@calc = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
@calc.add_method('add', 'lhs', 'rhs')
diff --git a/test/soap/calc/test_calc2.rb b/test/soap/calc/test_calc2.rb
index d15cfe9600..8d6180e99e 100644
--- a/test/soap/calc/test_calc2.rb
+++ b/test/soap/calc/test_calc2.rb
@@ -17,13 +17,6 @@ class TestCalc2 < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
@endpoint = "http://localhost:#{Port}/"
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
@var.wiredump_dev = STDERR if $DEBUG
diff --git a/test/soap/calc/test_calc_cgi.rb b/test/soap/calc/test_calc_cgi.rb
index d1655b0b01..d28830629f 100644
--- a/test/soap/calc/test_calc_cgi.rb
+++ b/test/soap/calc/test_calc_cgi.rb
@@ -35,13 +35,6 @@ class TestCalcCGI < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
@endpoint = "http://localhost:#{Port}/server.cgi"
@calc = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
@calc.wiredump_dev = STDERR if $DEBUG
diff --git a/test/soap/header/server.cgi b/test/soap/header/server.cgi
index f9739d0d15..2a188538d9 100644
--- a/test/soap/header/server.cgi
+++ b/test/soap/header/server.cgi
@@ -85,18 +85,18 @@ class AuthHeaderPortServer < SOAP::RPC::CGIStub
end
def on_simple_inbound(my_header, mu)
- auth = false
+ succeeded = false
userid = my_header["userid"]
passwd = my_header["passwd"]
if login(userid, passwd)
- auth = true
+ succeeded = true
elsif sessionid = my_header["sessionid"]
if userid = auth(sessionid)
destroy_session(sessionid)
- auth = true
+ succeeded = true
end
end
- raise RuntimeError.new("authentication failed") unless auth
+ raise RuntimeError.new("authentication failed") unless succeeded
@userid = userid
@sessionid = create_session(userid)
end
diff --git a/test/soap/header/test_authheader.rb b/test/soap/header/test_authheader.rb
index 2c04769dd6..47e1e76b82 100644
--- a/test/soap/header/test_authheader.rb
+++ b/test/soap/header/test_authheader.rb
@@ -33,7 +33,7 @@ class TestAuthHeader < Test::Unit::TestCase
super
add_rpc_servant(AuthHeaderService.new, PortName)
ServerAuthHeaderHandler.init
- add_rpc_request_headerhandler(ServerAuthHeaderHandler)
+ add_request_headerhandler(ServerAuthHeaderHandler)
end
class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
@@ -162,13 +162,6 @@ class TestAuthHeader < Test::Unit::TestCase
@t = Thread.new {
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
diff --git a/test/soap/header/test_authheader_cgi.rb b/test/soap/header/test_authheader_cgi.rb
index 03bd1bb965..d70b022ad8 100644
--- a/test/soap/header/test_authheader_cgi.rb
+++ b/test/soap/header/test_authheader_cgi.rb
@@ -72,13 +72,6 @@ class TestAuthHeaderCGI < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
diff --git a/test/soap/helloworld/test_helloworld.rb b/test/soap/helloworld/test_helloworld.rb
index cd78d9fa0b..40c35b57fb 100644
--- a/test/soap/helloworld/test_helloworld.rb
+++ b/test/soap/helloworld/test_helloworld.rb
@@ -17,13 +17,6 @@ class TestHelloWorld < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
@endpoint = "http://localhost:#{Port}/"
@client = SOAP::RPC::Driver.new(@endpoint, 'urn:hws')
@client.add_method("hello_world", "from")
diff --git a/test/soap/ssl/sslsvr.rb b/test/soap/ssl/sslsvr.rb
index 52a8d6878f..4f67eb9485 100644
--- a/test/soap/ssl/sslsvr.rb
+++ b/test/soap/ssl/sslsvr.rb
@@ -51,13 +51,6 @@ if $0 == __FILE__
Thread.current.abort_on_exception = true
$server.start
}
- while $server.status != :Running
- sleep 0.1
- unless t.alive?
- t.join
- raise
- end
- end
STDOUT.sync = true
puts $$
t.join
diff --git a/test/soap/ssl/test_ssl.rb b/test/soap/ssl/test_ssl.rb
index 82bb890d71..d6df970160 100644
--- a/test/soap/ssl/test_ssl.rb
+++ b/test/soap/ssl/test_ssl.rb
@@ -5,7 +5,7 @@ rescue LoadError
end
require 'soap/rpc/driver'
-if defined?(HTTPAccess2)
+if defined?(HTTPAccess2) and defined?(OpenSSL)
module SOAP; module SSL
@@ -130,6 +130,7 @@ __EOP__
@client.loadproperty(testpropertyname)
@client.options["protocol.http.ssl_config.verify_callback"] = method(:verify_callback).to_proc
@verify_callback_called = false
+ # NG with String
begin
@client.hello_world("ssl client")
assert(false)
@@ -137,11 +138,35 @@ __EOP__
assert_equal("certificate verify failed", ssle.message)
assert(@verify_callback_called)
end
- #
+ # NG with Integer
+ @client.options["protocol.http.ssl_config.verify_depth"] = 0
+ begin
+ @client.hello_world("ssl client")
+ assert(false)
+ rescue OpenSSL::SSL::SSLError => ssle
+ assert_equal("certificate verify failed", ssle.message)
+ assert(@verify_callback_called)
+ end
+ # OK with empty
@client.options["protocol.http.ssl_config.verify_depth"] = ""
@verify_callback_called = false
assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
assert(@verify_callback_called)
+ # OK with nil
+ @client.options["protocol.http.ssl_config.verify_depth"] = nil
+ @verify_callback_called = false
+ assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
+ assert(@verify_callback_called)
+ # OK with String
+ @client.options["protocol.http.ssl_config.verify_depth"] = "3"
+ @verify_callback_called = false
+ assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
+ assert(@verify_callback_called)
+ # OK with Integer
+ @client.options["protocol.http.ssl_config.verify_depth"] = 3
+ @verify_callback_called = false
+ assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
+ assert(@verify_callback_called)
ensure
File.unlink(testpropertyname)
end
diff --git a/test/soap/struct/test_struct.rb b/test/soap/struct/test_struct.rb
index 71ada31676..d92f4bc18a 100644
--- a/test/soap/struct/test_struct.rb
+++ b/test/soap/struct/test_struct.rb
@@ -30,6 +30,7 @@ class TestStruct < Test::Unit::TestCase
def setup_server
@server = Server.new(
:Port => Port,
+ :BindAddress => "0.0.0.0",
:AccessLog => [],
:SOAPDefaultNamespace => Namespace
)
@@ -63,13 +64,6 @@ class TestStruct < Test::Unit::TestCase
Thread.current.abort_on_exception = true
server.start
}
- while server.status != :Running
- sleep 0.1
- unless t.alive?
- t.join
- raise
- end
- end
t
end
diff --git a/test/soap/swa/test_file.rb b/test/soap/swa/test_file.rb
index 29bdf88a3b..8389d8826c 100644
--- a/test/soap/swa/test_file.rb
+++ b/test/soap/swa/test_file.rb
@@ -33,13 +33,6 @@ class TestFile < Test::Unit::TestCase
@t = Thread.new {
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
@endpoint = "http://localhost:#{Port}/"
@client = SOAP::RPC::Driver.new(@endpoint, 'http://www.acmetron.com/soap')
@client.add_method('get_file')
diff --git a/test/soap/test_basetype.rb b/test/soap/test_basetype.rb
index afd550f996..3785873560 100644
--- a/test/soap/test_basetype.rb
+++ b/test/soap/test_basetype.rb
@@ -382,6 +382,9 @@ class TestSOAP < Test::Unit::TestCase
]
targets.each do |data, expected|
assert_equal(expected, SOAP::SOAPDateTime.new(data).to_s)
+ d = DateTime.parse(data)
+ d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
+ assert_equal(expected, SOAP::SOAPDateTime.new(d).to_s)
end
targets = [
@@ -481,6 +484,9 @@ class TestSOAP < Test::Unit::TestCase
]
targets.each do |data, expected|
assert_equal(expected, SOAP::SOAPDate.new(data).to_s)
+ d = Date.parse(data)
+ d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
+ assert_equal(expected, SOAP::SOAPDate.new(d).to_s)
end
end
diff --git a/test/soap/test_streamhandler.rb b/test/soap/test_streamhandler.rb
index fa0080e9f1..a8d06d5f2a 100644
--- a/test/soap/test_streamhandler.rb
+++ b/test/soap/test_streamhandler.rb
@@ -80,13 +80,6 @@ class TestStreamHandler < Test::Unit::TestCase
Thread.current.abort_on_exception = true
server.start
}
- while server.status != :Running
- sleep 0.1
- unless t.alive?
- t.join
- raise
- end
- end
t
end
@@ -141,6 +134,19 @@ __EOX__
assert(/^text\/xml;/ =~ h["content-type"])
end
+ def test_uri
+ # initialize client with URI object
+ @client = SOAP::RPC::Driver.new(URI.parse(@url), '')
+ @client.add_method("do_server_proc")
+ # same as test_normal
+ str = ""
+ @client.wiredump_dev = str
+ assert_nil(@client.do_server_proc)
+ r, h = parse_req_header(str)
+ assert_match(%r"POST / HTTP/1.", r)
+ assert(/^text\/xml;/ =~ h["content-type"])
+ end
+
def test_basic_auth
unless Object.const_defined?('HTTPAccess2')
# soap4r + net/http + basic_auth is not supported.
diff --git a/test/soap/wsdlDriver/simpletype.wsdl b/test/soap/wsdlDriver/simpletype.wsdl
index 7c211a6b2c..6781dda552 100644
--- a/test/soap/wsdlDriver/simpletype.wsdl
+++ b/test/soap/wsdlDriver/simpletype.wsdl
@@ -10,12 +10,12 @@
<xsd:schema targetNamespace="urn:example.com:simpletype-rpc-type">
<xsd:complexType name="version_struct">
<xsd:all>
- <xsd:element name="version" type="txd:versions" />
+ <xsd:element name="myversion" type="txd:myversions" />
<xsd:element name="msg" type="xsd:string" />
</xsd:all>
</xsd:complexType>
- <xsd:simpleType name="versions">
+ <xsd:simpleType name="myversions">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1.6"/>
<xsd:enumeration value="1.8"/>
@@ -26,7 +26,7 @@
</types>
<message name="msg_version">
- <part name="version" type="txd:versions"/>
+ <part name="myversion" type="txd:myversions"/>
</message>
<message name="msg_version_struct">
diff --git a/test/soap/wsdlDriver/test_calc.rb b/test/soap/wsdlDriver/test_calc.rb
index f1cc116a59..629c5cdbfb 100644
--- a/test/soap/wsdlDriver/test_calc.rb
+++ b/test/soap/wsdlDriver/test_calc.rb
@@ -73,7 +73,8 @@ class TestCalc < Test::Unit::TestCase
assert_equal(0.3, @client.add(0.1, 0.2))
end
- def test_old_driver
+ # test for backward compatibility
+ def __NOTEST__test_old_driver
@client = ::SOAP::WSDLDriverFactory.new(@wsdl).create_driver
@client.wiredump_dev = STDOUT if $DEBUG
@client.endpoint_url = "http://localhost:#{Port}/"
diff --git a/test/soap/wsdlDriver/test_simpletype.rb b/test/soap/wsdlDriver/test_simpletype.rb
index ed628927cd..76b3a32df7 100644
--- a/test/soap/wsdlDriver/test_simpletype.rb
+++ b/test/soap/wsdlDriver/test_simpletype.rb
@@ -30,6 +30,7 @@ class TestSimpleType < Test::Unit::TestCase
def setup_server
@server = Server.new(
+ :BindAddress => "0.0.0.0",
:Port => Port,
:AccessLog => [],
:SOAPDefaultNamespace => "urn:example.com:simpletype-rpc"
@@ -40,7 +41,8 @@ class TestSimpleType < Test::Unit::TestCase
def setup_client
wsdl = File.join(DIR, 'simpletype.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
+ @client.wiredump_dev = STDOUT if $DEBUG
@client.endpoint_url = "http://localhost:#{Port}/"
@client.generate_explicit_type = false
end
@@ -65,13 +67,6 @@ class TestSimpleType < Test::Unit::TestCase
Thread.current.abort_on_exception = true
server.start
}
- while server.status != :Running
- sleep 0.1
- unless t.alive?
- t.join
- raise
- end
- end
t
end
@@ -79,10 +74,10 @@ class TestSimpleType < Test::Unit::TestCase
result = @client.echo_version("1.9")
assert_equal("1.9", result.version)
assert_equal("checked", result.msg)
- assert_raise(::XSD::ValueSpaceError) do
+ assert_raise(XSD::ValueSpaceError) do
@client.echo_version("2.0")
end
- assert_raise(::XSD::ValueSpaceError) do
+ assert_raise(XSD::ValueSpaceError) do
@client.echo_version(nil) # nil => "2.0" => out of range
end
end
diff --git a/test/wsdl/datetime/DatetimeService.rb b/test/wsdl/datetime/DatetimeService.rb
index 91c006005d..800e06d66f 100644
--- a/test/wsdl/datetime/DatetimeService.rb
+++ b/test/wsdl/datetime/DatetimeService.rb
@@ -2,37 +2,43 @@
require 'datetimeServant.rb'
require 'soap/rpc/standaloneServer'
+require 'soap/mapping/registry'
class DatetimePortType
- MappingRegistry = SOAP::Mapping::Registry.new
-
- # No mapping definition
+ MappingRegistry = ::SOAP::Mapping::Registry.new
Methods = [
- ["now", "now", [
- ["in", "now",
- [SOAP::SOAPDateTime]],
- ["retval", "now",
- [SOAP::SOAPDateTime]]], "", "urn:jp.gr.jin.rrr.example.datetime"]
+ ["now", "now",
+ [
+ ["in", "now", [::SOAP::SOAPDateTime]],
+ ["retval", "now", [::SOAP::SOAPDateTime]]
+ ],
+ "", "urn:jp.gr.jin.rrr.example.datetime", :rpc
+ ]
]
end
-class DatetimePortTypeApp < SOAP::RPC::StandaloneServer
+class DatetimePortTypeApp < ::SOAP::RPC::StandaloneServer
def initialize(*arg)
- super
-
+ super(*arg)
servant = DatetimePortType.new
- DatetimePortType::Methods.each do |name_as, name, params, soapaction, namespace|
- qname = XSD::QName.new(namespace, name_as)
- @soaplet.app_scope_router.add_method(servant, qname, soapaction,
- name, params)
+ DatetimePortType::Methods.each do |name_as, name, param_def, soapaction, namespace, style|
+ if style == :document
+ @router.add_document_operation(servant, soapaction, name, param_def)
+ else
+ qname = XSD::QName.new(namespace, name_as)
+ @router.add_rpc_operation(servant, qname, soapaction, name, param_def)
+ end
end
-
self.mapping_registry = DatetimePortType::MappingRegistry
end
end
-# Change listen port.
if $0 == __FILE__
- DatetimePortTypeApp.new('app', nil, '0.0.0.0', 10080).start
+ # Change listen port.
+ server = DatetimePortTypeApp.new('app', nil, '0.0.0.0', 10080)
+ trap(:INT) do
+ server.shutdown
+ end
+ server.start
end
diff --git a/test/wsdl/datetime/test_datetime.rb b/test/wsdl/datetime/test_datetime.rb
index 0f531ff18c..7652318205 100644
--- a/test/wsdl/datetime/test_datetime.rb
+++ b/test/wsdl/datetime/test_datetime.rb
@@ -24,20 +24,14 @@ class TestDatetime < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
wsdl = File.join(DIR, 'datetime.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
@client.endpoint_url = "http://localhost:#{Port}/"
@client.generate_explicit_type = true
+ @client.wiredump_dev = STDOUT if $DEBUG
end
def teardown
diff --git a/test/wsdl/map/test_map.rb b/test/wsdl/map/test_map.rb
index bee3a75892..68f7d76e05 100644
--- a/test/wsdl/map/test_map.rb
+++ b/test/wsdl/map/test_map.rb
@@ -32,6 +32,7 @@ class TestMap < Test::Unit::TestCase
def setup_server
@server = Server.new(
+ :BindAddress => "0.0.0.0",
:Port => Port,
:AccessLog => [],
:SOAPDefaultNamespace => "urn:map"
@@ -41,20 +42,14 @@ class TestMap < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
wsdl = File.join(DIR, 'map.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
@client.endpoint_url = "http://localhost:#{Port}/"
@client.generate_explicit_type = true
+ @client.wiredump_dev = STDOUT if $DEBUG
end
def teardown
diff --git a/test/wsdl/raa/RAAService.rb b/test/wsdl/raa/RAAService.rb
index 42cdfaea47..9d0813304c 100644
--- a/test/wsdl/raa/RAAService.rb
+++ b/test/wsdl/raa/RAAService.rb
@@ -87,8 +87,7 @@ class App < SOAP::RPC::StandaloneServer
servant = RAABaseServicePortType.new
RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace|
qname = XSD::QName.new(namespace, name_as)
- @soaplet.app_scope_router.add_method(servant, qname, soapaction,
- name, params)
+ @router.add_method(servant, qname, soapaction, name, params)
end
self.mapping_registry = RAABaseServicePortType::MappingRegistry
diff --git a/test/wsdl/raa/test_raa.rb b/test/wsdl/raa/test_raa.rb
index cf171b373f..0b00042ffb 100644
--- a/test/wsdl/raa/test_raa.rb
+++ b/test/wsdl/raa/test_raa.rb
@@ -26,18 +26,11 @@ class TestRAA < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
wsdl = File.join(DIR, 'raa.wsdl')
- @raa = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @raa = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
@raa.endpoint_url = "http://localhost:#{Port}/"
end
diff --git a/test/wsdl/simpletype/simpletype.wsdl b/test/wsdl/simpletype/simpletype.wsdl
index ec3266fc14..623969c794 100644
--- a/test/wsdl/simpletype/simpletype.wsdl
+++ b/test/wsdl/simpletype/simpletype.wsdl
@@ -10,19 +10,28 @@
<xsd:element name="ruby">
<xsd:complexType>
<xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="version" type="tns:version"/>
+ <xsd:element minOccurs="1" maxOccurs="1" name="myversion" type="tns:myversion"/>
<xsd:element minOccurs="0" maxOccurs="1" name="date" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:simpleType name="version">
+ <xsd:simpleType name="myversion">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1.6"/>
<xsd:enumeration value="1.8"/>
<xsd:enumeration value="1.9"/>
</xsd:restriction>
</xsd:simpleType>
+
+ <xsd:element name="myid" type="tns:ID"/>
+
+ <xsd:simpleType name="ID">
+ <xsd:restriction base="xsd:string">
+ <xsd:length value="18"/>
+ <xsd:pattern value='[a-zA-Z0-9]{18}'/>
+ </xsd:restriction>
+ </xsd:simpleType>
</xsd:schema>
</types>
@@ -31,11 +40,19 @@
</message>
<message name="ping_out">
- <part name="parameters" element="xsd:string"/>
+ <part name="parameters" type="xsd:string"/>
+ </message>
+
+ <message name="ping_id_in">
+ <part name="parameters" element="tns:myid"/>
+ </message>
+
+ <message name="ping_id_out">
+ <part name="parameters" element="tns:myid"/>
</message>
<message name="versionmsg">
- <part name="version" element="tns:version"/>
+ <part name="myversion" element="tns:myversion"/>
</message>
<portType name="ping_port_type">
@@ -44,6 +61,11 @@
<output message="tns:ping_out"/>
</operation>
+ <operation name="ping_id">
+ <input message="tns:ping_id_in"/>
+ <output message="tns:ping_id_out"/>
+ </operation>
+
<operation name="echo_version">
<input message="tns:versionmsg"/>
<output message="tns:versionmsg"/>
@@ -53,7 +75,13 @@
<binding name="ping_binding" type="tns:ping_port_type">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="ping">
- <soap:operation soapAction="urn:example.com:simpletype" style="document"/>
+ <soap:operation soapAction="urn:example.com:simpletype:ping" style="document"/>
+ <input><soap:body use="literal"/></input>
+ <output><soap:body use="literal"/></output>
+ </operation>
+
+ <operation name="ping_id">
+ <soap:operation soapAction="urn:example.com:simpletype:ping_id" style="document"/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
diff --git a/test/wsdl/simpletype/test_simpletype.rb b/test/wsdl/simpletype/test_simpletype.rb
index a46bf5dd78..7e644c3042 100644
--- a/test/wsdl/simpletype/test_simpletype.rb
+++ b/test/wsdl/simpletype/test_simpletype.rb
@@ -10,12 +10,23 @@ module SimpleType
class TestSimpleType < Test::Unit::TestCase
class Server < ::SOAP::RPC::StandaloneServer
def on_init
- add_method(self, 'ruby', 'version', 'date')
+ add_document_method(self, 'urn:example.com:simpletype:ping', 'ping',
+ XSD::QName.new('urn:example.com:simpletype', 'ruby'),
+ XSD::QName.new('http://www.w3.org/2001/XMLSchema', 'string'))
+ add_document_method(self, 'urn:example.com:simpletype:ping_id', 'ping_id',
+ XSD::QName.new('urn:example.com:simpletype', 'myid'),
+ XSD::QName.new('urn:example.com:simpletype', 'myid'))
end
- def ruby(version, date)
+ def ping(ruby)
+ version = ruby["myversion"]
+ date = ruby["date"]
"#{version} (#{date})"
end
+
+ def ping_id(id)
+ id
+ end
end
DIR = File.dirname(File.expand_path(__FILE__))
@@ -35,9 +46,10 @@ class TestSimpleType < Test::Unit::TestCase
def setup_client
wsdl = File.join(DIR, 'simpletype.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
@client.endpoint_url = "http://localhost:#{Port}/"
@client.generate_explicit_type = false
+ @client.wiredump_dev = STDOUT if $DEBUG
end
def teardown
@@ -60,19 +72,25 @@ class TestSimpleType < Test::Unit::TestCase
Thread.current.abort_on_exception = true
server.start
}
- while server.status != :Running
- sleep 0.1
- unless t.alive?
- t.join
- raise
- end
- end
t
end
def test_ping
- header, body = @client.ping(nil, {:version => "1.9", :date => "2004-01-01T00:00:00Z"})
- assert_equal("1.9 (2004-01-01T00:00:00Z)", body)
+ ret = @client.ping({:myversion => "1.9", :date => "2004-01-01T00:00:00Z"})
+ assert_equal("1.9 (2004-01-01T00:00:00Z)", ret)
+ end
+
+ def test_ping_id
+ ret = @client.ping_id("012345678901234567")
+ assert_equal("012345678901234567", ret)
+ # length
+ assert_raise(XSD::ValueSpaceError) do
+ @client.ping_id("0123456789012345678")
+ end
+ # pattern
+ assert_raise(XSD::ValueSpaceError) do
+ @client.ping_id("01234567890123456;")
+ end
end
end
diff --git a/test/wsdl/soap/test_soapbodyparts.rb b/test/wsdl/soap/test_soapbodyparts.rb
index efead18301..291319aedf 100644
--- a/test/wsdl/soap/test_soapbodyparts.rb
+++ b/test/wsdl/soap/test_soapbodyparts.rb
@@ -10,19 +10,19 @@ module SOAP
class TestSOAPBodyParts < Test::Unit::TestCase
class Server < ::SOAP::RPC::StandaloneServer
def on_init
- add_method(self, 'foo', 'p1', 'p2')
- add_method(self, 'bar', 'p1', 'p2')
+ add_method(self, 'foo', 'p1', 'p2', 'p3')
+ add_method(self, 'bar', 'p1', 'p2', 'p3')
add_method(self, 'baz', 'p1', 'p2', 'p3')
end
- def foo(p1, p2)
- [p1, p2]
+ def foo(p1, p2, p3)
+ [p1, p2, p3]
end
alias bar foo
def baz(p1, p2, p3)
- [p1, p2, p3]
+ [p3, p2, p1]
end
end
@@ -42,18 +42,11 @@ class TestSOAPBodyParts < Test::Unit::TestCase
Thread.current.abort_on_exception = true
@server.start
}
- while @server.status != :Running
- sleep 0.1
- unless @t.alive?
- @t.join
- raise
- end
- end
end
def setup_client
wsdl = File.join(DIR, 'soapbodyparts.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
@client.endpoint_url = "http://localhost:#{Port}/"
@client.wiredump_dev = STDERR if $DEBUG
end
@@ -74,10 +67,10 @@ class TestSOAPBodyParts < Test::Unit::TestCase
end
def test_soapbodyparts
- assert_equal(["2", "1"], @client.foo("1", "2"))
- assert_equal(["1", "2"], @client.foo("2", "1"))
- assert_equal(["2", "3"], @client.bar("2", "3"))
- assert_equal(["1", "2", "3"], @client.baz("1", "2", "3"))
+ assert_equal(["1", "2", "3"], @client.foo("1", "2", "3"))
+ assert_equal(["3", "2", "1"], @client.foo("3", "2", "1"))
+ assert_equal(["1", "2", "3"], @client.bar("1", "2", "3"))
+ assert_equal(["3", "2", "1"], @client.baz("1", "2", "3"))
end
end
diff --git a/test/xsd/test_xsd.rb b/test/xsd/test_xsd.rb
index 1f594571fe..6302f3128b 100644
--- a/test/xsd/test_xsd.rb
+++ b/test/xsd/test_xsd.rb
@@ -414,6 +414,9 @@ class TestXSD < Test::Unit::TestCase
]
targets.each do |data, expected|
assert_equal(expected, XSD::XSDDateTime.new(data).to_s)
+ d = DateTime.parse(data)
+ d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
+ assert_equal(expected, XSD::XSDDateTime.new(d).to_s)
end
targets = [
@@ -513,6 +516,9 @@ class TestXSD < Test::Unit::TestCase
]
targets.each do |data, expected|
assert_equal(expected, XSD::XSDDate.new(data).to_s)
+ d = Date.parse(data)
+ d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
+ assert_equal(expected, XSD::XSDDate.new(d).to_s)
end
end
end