mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/xsd/datatypes.rb: dump sign by itself. under the problematic platform,
sprintf("%+.10g", -0.0) => +0. Sigh. * sample/wsdl/amazon/*: update schema ver2 to ver3. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18b1fd953f
commit
6ea9e723ea
8 changed files with 1202 additions and 136 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Oct 4 02:12:44 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/xsd/datatypes.rb: dump sign by itself. under the problematic
|
||||||
|
platform, sprintf("%+.10g", -0.0) => +0. sigh.
|
||||||
|
|
||||||
|
* sample/wsdl/amazon/*: update schema ver2 to ver3.
|
||||||
|
|
||||||
Sat Oct 4 01:33:46 2003 Tanaka Akira <akr@m17n.org>
|
Sat Oct 4 01:33:46 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/pathname.rb (initialize): duplicate and freeze argument.
|
* lib/pathname.rb (initialize): duplicate and freeze argument.
|
||||||
|
|
|
@ -36,7 +36,7 @@ module Marshal
|
||||||
Time,
|
Time,
|
||||||
::SOAP::SOAPDateTime,
|
::SOAP::SOAPDateTime,
|
||||||
::SOAP::Mapping::Registry::DateTimeFactory
|
::SOAP::Mapping::Registry::DateTimeFactory
|
||||||
)
|
)
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
public
|
public
|
||||||
|
|
|
@ -37,8 +37,6 @@ class StreamHandler
|
||||||
end
|
end
|
||||||
|
|
||||||
RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]"
|
RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]"
|
||||||
%q$Id$ =~ /: (\S+),v (\S+)/
|
|
||||||
RCS_FILE, RCS_REVISION = $1, $2
|
|
||||||
|
|
||||||
class ConnectionData
|
class ConnectionData
|
||||||
attr_accessor :send_string
|
attr_accessor :send_string
|
||||||
|
|
|
@ -135,10 +135,6 @@ class XSDAnySimpleType < NSDBase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def trim(data)
|
|
||||||
data.sub(/\A\s*(\S*)\s*\z/, '\1')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
|
@ -204,7 +200,7 @@ private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
if value.is_a?(String)
|
if value.is_a?(String)
|
||||||
str = trim(value)
|
str = value.strip
|
||||||
if str == 'true' || str == '1'
|
if str == 'true' || str == '1'
|
||||||
@data = true
|
@data = true
|
||||||
elsif str == 'false' || str == '0'
|
elsif str == 'false' || str == '0'
|
||||||
|
@ -245,7 +241,7 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_str(str)
|
def set_str(str)
|
||||||
/^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ trim(str.to_s)
|
/^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ str.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
|
||||||
end
|
end
|
||||||
|
@ -281,7 +277,14 @@ private
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module FloatConstants
|
||||||
|
NaN = 0.0/0.0
|
||||||
|
POSITIVE_INF = 1.0/0.0
|
||||||
|
NEGATIVE_INF = -1.0/0.0
|
||||||
|
end
|
||||||
|
|
||||||
class XSDFloat < XSDAnySimpleType
|
class XSDFloat < XSDAnySimpleType
|
||||||
|
include FloatConstants
|
||||||
Type = QName.new(Namespace, FloatLiteral)
|
Type = QName.new(Namespace, FloatLiteral)
|
||||||
|
|
||||||
def initialize(value = nil)
|
def initialize(value = nil)
|
||||||
|
@ -299,13 +302,13 @@ private
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
str = trim(value.to_s)
|
str = value.to_s.strip
|
||||||
if str == 'NaN'
|
if str == 'NaN'
|
||||||
@data = 0.0/0.0
|
@data = NaN
|
||||||
elsif str == 'INF'
|
elsif str == 'INF'
|
||||||
@data = 1.0/0.0
|
@data = POSITIVE_INF
|
||||||
elsif str == '-INF'
|
elsif str == '-INF'
|
||||||
@data = -1.0/0.0
|
@data = NEGATIVE_INF
|
||||||
else
|
else
|
||||||
if /^[+\-\.\deE]+$/ !~ str
|
if /^[+\-\.\deE]+$/ !~ str
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
|
||||||
|
@ -320,7 +323,6 @@ private
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Do I have to convert 0.0 -> 0 and -0.0 -> -0 ?
|
|
||||||
def _to_s
|
def _to_s
|
||||||
if @data.nan?
|
if @data.nan?
|
||||||
'NaN'
|
'NaN'
|
||||||
|
@ -329,7 +331,8 @@ private
|
||||||
elsif @data.infinite? == -1
|
elsif @data.infinite? == -1
|
||||||
'-INF'
|
'-INF'
|
||||||
else
|
else
|
||||||
sprintf("%+.10g", @data)
|
sign = (1 / @data > 0.0) ? '+' : '-'
|
||||||
|
sign + sprintf("%.10g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -346,6 +349,7 @@ end
|
||||||
|
|
||||||
# Ruby's Float is double-precision 64-bit floating point value.
|
# Ruby's Float is double-precision 64-bit floating point value.
|
||||||
class XSDDouble < XSDAnySimpleType
|
class XSDDouble < XSDAnySimpleType
|
||||||
|
include FloatConstants
|
||||||
Type = QName.new(Namespace, DoubleLiteral)
|
Type = QName.new(Namespace, DoubleLiteral)
|
||||||
|
|
||||||
def initialize(value = nil)
|
def initialize(value = nil)
|
||||||
|
@ -363,13 +367,13 @@ private
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
str = trim(value.to_s)
|
str = value.to_s.strip
|
||||||
if str == 'NaN'
|
if str == 'NaN'
|
||||||
@data = 0.0/0.0
|
@data = NaN
|
||||||
elsif str == 'INF'
|
elsif str == 'INF'
|
||||||
@data = 1.0/0.0
|
@data = POSITIVE_INF
|
||||||
elsif str == '-INF'
|
elsif str == '-INF'
|
||||||
@data = -1.0/0.0
|
@data = NEGATIVE_INF
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@data = Float(str)
|
@data = Float(str)
|
||||||
|
@ -388,7 +392,6 @@ private
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Do I have to convert 0.0 -> 0 and -0.0 -> -0 ?
|
|
||||||
def _to_s
|
def _to_s
|
||||||
if @data.nan?
|
if @data.nan?
|
||||||
'NaN'
|
'NaN'
|
||||||
|
@ -397,7 +400,8 @@ private
|
||||||
elsif @data.infinite? == -1
|
elsif @data.infinite? == -1
|
||||||
'-INF'
|
'-INF'
|
||||||
else
|
else
|
||||||
sprintf("%+.16g", @data)
|
sign = (1 / @data > 0.0) ? '+' : '-'
|
||||||
|
sign + sprintf("%.16g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -429,7 +433,7 @@ class XSDDuration < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
/^([+\-]?)P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/ =~ trim(value.to_s)
|
/^([+\-]?)P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/ =~ value.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
||||||
end
|
end
|
||||||
|
@ -475,9 +479,6 @@ end
|
||||||
|
|
||||||
require 'rational'
|
require 'rational'
|
||||||
require 'date'
|
require 'date'
|
||||||
unless Object.const_defined?('DateTime')
|
|
||||||
raise LoadError.new('XSD4R requires date2/3.2 or later to be installed. You can download it from http://www.funaba.org/en/ruby.html#date2')
|
|
||||||
end
|
|
||||||
|
|
||||||
module XSDDateTimeImpl
|
module XSDDateTimeImpl
|
||||||
SecInDay = 86400 # 24 * 60 * 60
|
SecInDay = 86400 # 24 * 60 * 60
|
||||||
|
@ -557,7 +558,7 @@ class XSDDateTime < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^([+\-]?\d\d\d\d\d*)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ trim(t.to_s)
|
/^([+\-]?\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -620,7 +621,7 @@ class XSDTime < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ trim(t.to_s)
|
/^(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -663,7 +664,7 @@ class XSDDate < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^([+\-]?\d\d\d\d\d*)-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ trim(t.to_s)
|
/^([+\-]?\d{4,})-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -699,7 +700,7 @@ class XSDGYearMonth < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^([+\-]?\d\d\d\d\d*)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ trim(t.to_s)
|
/^([+\-]?\d{4,})-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -734,7 +735,7 @@ class XSDGYear < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^([+\-]?\d\d\d\d\d*)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ trim(t.to_s)
|
/^([+\-]?\d{4,})(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -768,7 +769,7 @@ class XSDGMonthDay < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ trim(t.to_s)
|
/^(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -799,7 +800,7 @@ class XSDGDay < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ trim(t.to_s)
|
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -829,7 +830,7 @@ class XSDGMonth < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_str(t)
|
def set_str(t)
|
||||||
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ trim(t.to_s)
|
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
|
||||||
end
|
end
|
||||||
|
@ -860,7 +861,7 @@ class XSDHexBinary < XSDAnySimpleType
|
||||||
if /^[0-9a-fA-F]*$/ !~ value
|
if /^[0-9a-fA-F]*$/ !~ value
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
||||||
end
|
end
|
||||||
@data = trim(String.new(value))
|
@data = String.new(value).strip
|
||||||
@is_nil = false
|
@is_nil = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -890,7 +891,7 @@ class XSDBase64Binary < XSDAnySimpleType
|
||||||
if /^[A-Za-z0-9+\/=]*$/ !~ value
|
if /^[A-Za-z0-9+\/=]*$/ !~ value
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
||||||
end
|
end
|
||||||
@data = trim(String.new(value))
|
@data = String.new(value).strip
|
||||||
@is_nil = false
|
@is_nil = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -901,7 +902,7 @@ class XSDBase64Binary < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
@data = trim([value].pack("m"))
|
@data = [value].pack("m").strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -918,7 +919,7 @@ private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
begin
|
begin
|
||||||
@data = URI.parse(trim(value.to_s))
|
@data = URI.parse(value.to_s.strip)
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
||||||
end
|
end
|
||||||
|
@ -937,7 +938,7 @@ class XSDQName < XSDAnySimpleType
|
||||||
private
|
private
|
||||||
|
|
||||||
def _set(value)
|
def _set(value)
|
||||||
/^(?:([^:]+):)?([^:]+)$/ =~ trim(value.to_s)
|
/^(?:([^:]+):)?([^:]+)$/ =~ value.to_s.strip
|
||||||
unless Regexp.last_match
|
unless Regexp.last_match
|
||||||
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
|
||||||
end
|
end
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,6 +23,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
::SOAP::Mapping::Registry::TypedArrayFactory,
|
::SOAP::Mapping::Registry::TypedArrayFactory,
|
||||||
{ :type => XSD::QName.new("http://soap.amazon.com", "Details") }
|
{ :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(
|
MappingRegistry.set(
|
||||||
PowerRequest,
|
PowerRequest,
|
||||||
::SOAP::SOAPStruct,
|
::SOAP::SOAPStruct,
|
||||||
|
@ -59,6 +65,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||||
{ :type => XSD::QName.new("http://soap.amazon.com", "UpcRequest") }
|
{ :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(
|
MappingRegistry.set(
|
||||||
AuthorRequest,
|
AuthorRequest,
|
||||||
::SOAP::SOAPStruct,
|
::SOAP::SOAPStruct,
|
||||||
|
@ -191,6 +203,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
::SOAP::Mapping::Registry::TypedArrayFactory,
|
::SOAP::Mapping::Registry::TypedArrayFactory,
|
||||||
{ :type => XSD::QName.new("http://soap.amazon.com", "Item") }
|
{ :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(
|
MappingRegistry.set(
|
||||||
ClearShoppingCartRequest,
|
ClearShoppingCartRequest,
|
||||||
::SOAP::SOAPStruct,
|
::SOAP::SOAPStruct,
|
||||||
|
@ -233,6 +251,30 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
::SOAP::Mapping::Registry::TypedArrayFactory,
|
::SOAP::Mapping::Registry::TypedArrayFactory,
|
||||||
{ :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
|
{ :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(
|
MappingRegistry.set(
|
||||||
Details,
|
Details,
|
||||||
::SOAP::SOAPStruct,
|
::SOAP::SOAPStruct,
|
||||||
|
@ -281,6 +323,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||||
{ :type => XSD::QName.new("http://soap.amazon.com", "ItemQuantity") }
|
{ :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 = [
|
Methods = [
|
||||||
["KeywordSearchRequest", "keywordSearchRequest", [
|
["KeywordSearchRequest", "keywordSearchRequest", [
|
||||||
|
@ -289,6 +337,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
["retval", "return",
|
["retval", "return",
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
|
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
|
||||||
"http://soap.amazon.com", "http://soap.amazon.com"],
|
"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", [
|
["PowerSearchRequest", "powerSearchRequest", [
|
||||||
["in", "PowerSearchRequest",
|
["in", "PowerSearchRequest",
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "PowerRequest"]],
|
[::SOAP::SOAPStruct, "http://soap.amazon.com", "PowerRequest"]],
|
||||||
|
@ -319,6 +373,12 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
["retval", "return",
|
["retval", "return",
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
|
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ProductInfo"]]],
|
||||||
"http://soap.amazon.com", "http://soap.amazon.com"],
|
"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", [
|
["AuthorSearchRequest", "authorSearchRequest", [
|
||||||
["in", "AuthorSearchRequest",
|
["in", "AuthorSearchRequest",
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "AuthorRequest"]],
|
[::SOAP::SOAPStruct, "http://soap.amazon.com", "AuthorRequest"]],
|
||||||
|
@ -420,10 +480,16 @@ class AmazonSearchPort < SOAP::RPC::Driver
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ModifyShoppingCartItemsRequest"]],
|
[::SOAP::SOAPStruct, "http://soap.amazon.com", "ModifyShoppingCartItemsRequest"]],
|
||||||
["retval", "ShoppingCart",
|
["retval", "ShoppingCart",
|
||||||
[::SOAP::SOAPStruct, "http://soap.amazon.com", "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"]
|
"http://soap.amazon.com", "http://soap.amazon.com"]
|
||||||
]
|
]
|
||||||
|
|
||||||
DefaultEndpointUrl = "http://soap.amazon.com/onca/soap2"
|
DefaultEndpointUrl = "http://soap.amazon.com/onca/soap3"
|
||||||
|
|
||||||
def initialize(endpoint_url = nil)
|
def initialize(endpoint_url = nil)
|
||||||
endpoint_url ||= DefaultEndpointUrl
|
endpoint_url ||= DefaultEndpointUrl
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# generated by WSDL file and wsdl2ruby.rb.
|
# generated by WSDL file and wsdl2ruby.rb.
|
||||||
#
|
#
|
||||||
# $ wsdl2ruby.rb --type client --force \
|
# $ wsdl2ruby.rb --type client --force \
|
||||||
# --wsdl http://soap.amazon.com/schemas2/AmazonWebServices.wsdl
|
# --wsdl http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
|
||||||
#
|
#
|
||||||
# See wsdlDriver.rb to use WSDL file directly (slow).
|
# See wsdlDriver.rb to use WSDL file directly (slow).
|
||||||
require 'AmazonSearchDriver.rb'
|
require 'AmazonSearchDriver.rb'
|
||||||
|
|
|
@ -3,7 +3,8 @@ require 'soap/wsdlDriver'
|
||||||
book = ARGV.shift || "Ruby"
|
book = ARGV.shift || "Ruby"
|
||||||
|
|
||||||
# AmazonSearch.rb is generated from WSDL.
|
# AmazonSearch.rb is generated from WSDL.
|
||||||
# Run "wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas2/AmazonWebServices.wsdl --classDef --force"
|
# Run "wsdl2ruby.rb --wsdl http://soap.amazon.com/schemas3/AmazonWebServices.wsdl --classdef --force"
|
||||||
|
# http://soap.amazon.com/schemas3/AmazonWebServices.wsdl
|
||||||
require 'AmazonSearch.rb'
|
require 'AmazonSearch.rb'
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -32,7 +33,8 @@ end
|
||||||
#devtag = File.open(File.expand_path("~/.amazon_key")).read.chomp
|
#devtag = File.open(File.expand_path("~/.amazon_key")).read.chomp
|
||||||
devtag = nil
|
devtag = nil
|
||||||
|
|
||||||
AMAZON_WSDL = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'
|
# 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
|
amazon = SOAP::WSDLDriverFactory.new(AMAZON_WSDL).create_driver
|
||||||
p "WSDL loaded"
|
p "WSDL loaded"
|
||||||
amazon.generate_explicit_type = true
|
amazon.generate_explicit_type = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue