mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/soap/streamHandler.rb: drop unused http parameters.
* lib/soap/encodingstyle/soapHandler.rb, lib/soap/mapping/factory.rb, lib/soap/mapping/mapping.rb, lib/soap/mapping/registry.rb, lib/wsdl/soap/complexType.rb: ApacheSOAP's map support was broken under WSDL dynanic client environment. fixed. * test/wsdl/raa/*: add tests. * lib/xsd/datatypes.rb: dateTime precision bug fix (at least, I hope.) bug of soap4r. XSDDateTimeImple.to_time passed a Float to Time.local/Time.gm as an usec, and NUM2LONG(rb_num2long for Float) causes rounding error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a017b0cc8a
commit
42bca643c3
18 changed files with 256 additions and 95 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Fri Nov 28 14:41:52 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/soap/streamHandler.rb: drop unused http parameters.
|
||||
|
||||
* lib/soap/encodingstyle/soapHandler.rb, lib/soap/mapping/factory.rb,
|
||||
lib/soap/mapping/mapping.rb, lib/soap/mapping/registry.rb,
|
||||
lib/wsdl/soap/complexType.rb: ApacheSOAP's map support was broken
|
||||
under WSDL dynanic client environment. fixed.
|
||||
|
||||
* test/wsdl/raa/*: add tests.
|
||||
|
||||
* lib/xsd/datatypes.rb: dateTime precision bug fix (at least, I hope.)
|
||||
bug of soap4r. XSDDateTimeImple.to_time passed a Float to
|
||||
Time.local/Time.gm as an usec, and NUM2LONG(rb_num2long for Float)
|
||||
causes rounding error.
|
||||
|
||||
* test/soap/test_basetype.rb, test/xsd/test_xsd.rb: add tests.
|
||||
|
||||
Fri Nov 28 04:15:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (method_arity): used wrong Proc object. [ruby-talk:86504]
|
||||
|
|
3
MANIFEST
3
MANIFEST
|
@ -731,8 +731,9 @@ test/wsdl/axisArray/test_axisarray.rb
|
|||
test/wsdl/emptycomplextype.wsdl
|
||||
test/wsdl/raa/RAA.rb
|
||||
test/wsdl/raa/README.txt
|
||||
test/wsdl/raa/RAAServant.rb
|
||||
test/wsdl/raa/RAAService.rb
|
||||
test/wsdl/raa/raa.wsdl
|
||||
test/wsdl/raa/server.rb
|
||||
test/wsdl/raa/test_raa.rb
|
||||
test/wsdl/test_emptycomplextype.rb
|
||||
test/xsd/test_xmlschemaparser.rb
|
||||
|
|
|
@ -162,8 +162,6 @@ class SOAPHandler < Handler
|
|||
o = SOAPReference.decode(elename, href)
|
||||
@refpool << o
|
||||
elsif @decode_typemap
|
||||
# to parse multi-ref element with decode_tag_by_type.
|
||||
# && (parent.node.class != SOAPBody || @is_first_top_ele)
|
||||
o = decode_tag_by_wsdl(ns, elename, type, parent.node, arytype, extraattr)
|
||||
else
|
||||
o = decode_tag_by_type(ns, elename, type, parent.node, arytype, extraattr)
|
||||
|
@ -333,6 +331,7 @@ private
|
|||
|
||||
def decode_tag_by_wsdl(ns, elename, typestr, parent, arytypestr, extraattr)
|
||||
o = nil
|
||||
# should branch by root attribute?
|
||||
if parent.class == SOAPBody
|
||||
if @is_first_top_ele
|
||||
# Unqualified name is allowed here.
|
||||
|
@ -363,11 +362,12 @@ private
|
|||
extraattr)
|
||||
end
|
||||
|
||||
# parent.definedtype is nil means the parent is SOAPUnknown. SOAPUnknown is
|
||||
# generated by decode_tag_by_type when its type is anyType.
|
||||
# parent.definedtype == nil means the parent is SOAPUnknown. SOAPUnknown
|
||||
# is generated by decode_tag_by_type when its type is anyType.
|
||||
parenttype = parent.definedtype || @decode_typemap[parent.type]
|
||||
unless parenttype
|
||||
raise EncodingStyleError.new("Unknown type '#{ parent.type }'.")
|
||||
return decode_tag_by_type(ns, elename, typestr, parent, arytypestr,
|
||||
extraattr)
|
||||
end
|
||||
|
||||
definedtype_name = parenttype.child_type(elename)
|
||||
|
|
|
@ -356,15 +356,22 @@ class HashFactory_ < Factory
|
|||
unless node.type == MapQName
|
||||
return false
|
||||
end
|
||||
if node.key?('default')
|
||||
if node.class == SOAPStruct and node.key?('default')
|
||||
return false
|
||||
end
|
||||
obj = create_empty_object(obj_class)
|
||||
mark_unmarshalled_obj(node, obj)
|
||||
if node.class == SOAPStruct
|
||||
node.each do |key, value|
|
||||
obj[Mapping._soap2obj(value['key'], map)] =
|
||||
Mapping._soap2obj(value['value'], map)
|
||||
end
|
||||
else
|
||||
node.each do |value|
|
||||
obj[Mapping._soap2obj(value['key'], map)] =
|
||||
Mapping._soap2obj(value['value'], map)
|
||||
end
|
||||
end
|
||||
return true, obj
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,9 +77,10 @@ module Mapping
|
|||
end
|
||||
if detail.is_a?(Mapping::SOAPException)
|
||||
begin
|
||||
remote_backtrace = detail.to_e.backtrace
|
||||
raise detail.to_e
|
||||
rescue Exception => e2
|
||||
detail.set_backtrace(e2)
|
||||
e2.set_backtrace(remote_backtrace + e2.backtrace)
|
||||
raise
|
||||
end
|
||||
else
|
||||
|
|
|
@ -34,11 +34,9 @@ RubyIVarName = XSD::QName.new(RubyTypeInstanceNamespace, 'ivars')
|
|||
|
||||
# Inner class to pass an exception.
|
||||
class SOAPException; include Marshallable
|
||||
attr_reader :excn_type_name, :message, :backtrace, :cause
|
||||
attr_reader :excn_type_name, :cause
|
||||
def initialize(e)
|
||||
@excn_type_name = Mapping.name2elename(e.class.to_s)
|
||||
@message = e.message
|
||||
@backtrace = e.backtrace
|
||||
@cause = e
|
||||
end
|
||||
|
||||
|
@ -50,25 +48,15 @@ class SOAPException; include Marshallable
|
|||
klass = Mapping.class_from_name(
|
||||
Mapping.elename2name(@excn_type_name.to_s))
|
||||
if klass.nil?
|
||||
raise RuntimeError.new(@message)
|
||||
raise RuntimeError.new(@cause.message)
|
||||
end
|
||||
unless klass <= ::Exception
|
||||
raise NameError.new
|
||||
end
|
||||
obj = klass.new(@message)
|
||||
obj = klass.new(@cause.message)
|
||||
obj.extend(::SOAP::Mapping::MappedException)
|
||||
obj
|
||||
end
|
||||
|
||||
def set_backtrace(e)
|
||||
e.set_backtrace(
|
||||
if @backtrace.is_a?(Array)
|
||||
@backtrace
|
||||
else
|
||||
[@backtrace.inspect]
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -238,10 +226,12 @@ class Registry
|
|||
[::String, ::SOAP::SOAPGMonth, BasetypeFactory],
|
||||
[::String, ::SOAP::SOAPQName, BasetypeFactory],
|
||||
|
||||
[::Hash, ::SOAP::SOAPArray, HashFactory],
|
||||
[::Hash, ::SOAP::SOAPStruct, HashFactory],
|
||||
|
||||
[::Array, ::SOAP::SOAPArray, ArrayFactory,
|
||||
{:derived_class => true}],
|
||||
|
||||
[::Hash, ::SOAP::SOAPStruct, HashFactory],
|
||||
[::SOAP::Mapping::SOAPException,
|
||||
::SOAP::SOAPStruct, TypedStructFactory,
|
||||
{:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
|
||||
|
@ -282,10 +272,12 @@ class Registry
|
|||
[::String, ::SOAP::SOAPGMonth, BasetypeFactory],
|
||||
[::String, ::SOAP::SOAPQName, BasetypeFactory],
|
||||
|
||||
[::Hash, ::SOAP::SOAPArray, HashFactory],
|
||||
[::Hash, ::SOAP::SOAPStruct, HashFactory],
|
||||
|
||||
# Does not allow Array's subclass here.
|
||||
[::Array, ::SOAP::SOAPArray, ArrayFactory],
|
||||
|
||||
[::Hash, ::SOAP::SOAPStruct, HashFactory],
|
||||
[::SOAP::Mapping::SOAPException,
|
||||
::SOAP::SOAPStruct, TypedStructFactory,
|
||||
{:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
|
||||
|
|
|
@ -82,9 +82,6 @@ public
|
|||
attr_reader :client
|
||||
|
||||
NofRetry = 10 # [times]
|
||||
ConnectTimeout = 20 # [sec]
|
||||
SendTimeout = 60 # [sec]
|
||||
ReceiveTimeout = 60 # [sec]
|
||||
|
||||
def initialize(endpoint_url, proxy = nil, charset = nil)
|
||||
super(endpoint_url)
|
||||
|
@ -93,9 +90,6 @@ public
|
|||
@wiredump_dev = nil # Set an IO to get wiredump.
|
||||
@wiredump_file_base = nil
|
||||
@client = Client.new(@proxy, "SOAP4R/#{ Version }")
|
||||
@client.session_manager.connect_timeout = ConnectTimeout
|
||||
@client.session_manager.send_timeout = SendTimeout
|
||||
@client.session_manager.receive_timeout = ReceiveTimeout
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
|
|
@ -48,14 +48,23 @@ class ComplexType < Info
|
|||
end
|
||||
|
||||
def child_defined_complextype(name)
|
||||
unless compoundtype == :TYPE_STRUCT
|
||||
raise RuntimeError.new("Assert: not for struct")
|
||||
end
|
||||
ele = nil
|
||||
case compoundtype
|
||||
when :TYPE_STRUCT
|
||||
unless ele = find_element(name)
|
||||
if name.namespace.nil?
|
||||
ele = find_element_by_name(name.name)
|
||||
end
|
||||
end
|
||||
when :TYPE_ARRAY
|
||||
if content.elements.size == 1
|
||||
ele = content.elements[0]
|
||||
else
|
||||
raise RuntimeError.new("Assert: must not reach.")
|
||||
end
|
||||
else
|
||||
raise RuntimeError.new("Assert: Not implemented.")
|
||||
end
|
||||
unless ele
|
||||
raise RuntimeError.new("Cannot find #{name} as a children of #{@name}.")
|
||||
end
|
||||
|
@ -83,10 +92,13 @@ class ComplexType < Info
|
|||
private
|
||||
|
||||
def content_arytype
|
||||
arytype = find_arytype
|
||||
if arytype = find_arytype
|
||||
ns = arytype.namespace
|
||||
name = arytype.name.sub(/\[(?:,)*\]$/, '')
|
||||
XSD::QName.new(ns, name)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -162,7 +162,6 @@ class XSDString < XSDAnySimpleType
|
|||
def initialize(value = nil)
|
||||
super()
|
||||
@type = Type
|
||||
@encoding = nil
|
||||
set(value) if value
|
||||
end
|
||||
|
||||
|
@ -254,6 +253,7 @@ private
|
|||
end
|
||||
|
||||
@data = _to_s
|
||||
@data.freeze
|
||||
end
|
||||
|
||||
# 0.0 -> 0; right?
|
||||
|
@ -440,6 +440,7 @@ private
|
|||
@min = $7.to_i
|
||||
@sec = $8 ? XSDDecimal.new($8) : 0
|
||||
@data = _to_s
|
||||
@data.freeze
|
||||
end
|
||||
|
||||
def _to_s
|
||||
|
@ -476,11 +477,11 @@ module XSDDateTimeImpl
|
|||
begin
|
||||
if @data.offset * SecInDay == Time.now.utc_offset
|
||||
d = @data
|
||||
usec = (d.sec_fraction * SecInDay * 1000000).to_f
|
||||
usec = (d.sec_fraction * SecInDay * 1000000).round
|
||||
Time.local(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
|
||||
else
|
||||
d = @data.newof
|
||||
usec = (d.sec_fraction * SecInDay * 1000000).to_f
|
||||
usec = (d.sec_fraction * SecInDay * 1000000).round
|
||||
Time.gm(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
|
||||
end
|
||||
rescue ArgumentError
|
||||
|
@ -516,6 +517,7 @@ module XSDDateTimeImpl
|
|||
end
|
||||
|
||||
def _set(t)
|
||||
set_datetime_init(t)
|
||||
if (t.is_a?(Date))
|
||||
@data = t
|
||||
elsif (t.is_a?(Time))
|
||||
|
@ -541,11 +543,16 @@ class XSDDateTime < XSDAnySimpleType
|
|||
def initialize(value = nil)
|
||||
super()
|
||||
@type = Type
|
||||
@secfrac = nil
|
||||
set(value) if value
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
@secfrac = nil
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^([+\-]?\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
|
||||
|
@ -568,6 +575,7 @@ private
|
|||
zonestr = $8
|
||||
|
||||
@data = DateTime.civil(year, mon, mday, hour, min, sec, tz2of(zonestr))
|
||||
@secfrac = secfrac
|
||||
|
||||
if secfrac
|
||||
diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / SecInDay
|
||||
|
@ -588,10 +596,11 @@ private
|
|||
s = format('%.4d-%02d-%02dT%02d:%02d:%02d',
|
||||
year, @data.mon, @data.mday, @data.hour, @data.min, @data.sec)
|
||||
if @data.sec_fraction.nonzero?
|
||||
fr = @data.sec_fraction * SecInDay
|
||||
shiftsize = fr.denominator.to_s.size + 1
|
||||
fr_s = (fr * (10 ** shiftsize)).to_i.to_s
|
||||
s << '.' << '0' * (shiftsize - fr_s.size) << fr_s.sub(/0+$/, '')
|
||||
if @secfrac
|
||||
s << ".#{ @secfrac }"
|
||||
else
|
||||
s << sprintf("%.16f", (@data.sec_fraction * SecInDay).to_f).sub(/^0/, '').sub(/0*$/, '')
|
||||
end
|
||||
end
|
||||
add_tz(s)
|
||||
end
|
||||
|
@ -604,11 +613,16 @@ class XSDTime < XSDAnySimpleType
|
|||
def initialize(value = nil)
|
||||
super()
|
||||
@type = Type
|
||||
@secfrac = nil
|
||||
set(value) if value
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
@secfrac = nil
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -622,19 +636,22 @@ private
|
|||
zonestr = $5
|
||||
|
||||
@data = DateTime.civil(1, 1, 1, hour, min, sec, tz2of(zonestr))
|
||||
@secfrac = secfrac
|
||||
|
||||
if secfrac
|
||||
@data += secfrac.to_i.to_r / (10 ** secfrac.size) / SecInDay
|
||||
diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / SecInDay
|
||||
@data += diffday
|
||||
end
|
||||
end
|
||||
|
||||
def _to_s
|
||||
s = format('%02d:%02d:%02d', @data.hour, @data.min, @data.sec)
|
||||
if @data.sec_fraction.nonzero?
|
||||
fr = @data.sec_fraction * SecInDay
|
||||
shiftsize = fr.denominator.to_s.size + 1
|
||||
fr_s = (fr * (10 ** shiftsize)).to_i.to_s
|
||||
s << '.' << '0' * (shiftsize - fr_s.size) << fr_s.sub(/0+$/, '')
|
||||
if @secfrac
|
||||
s << ".#{ @secfrac }"
|
||||
else
|
||||
s << sprintf("%.16f", (@data.sec_fraction * SecInDay).to_f).sub(/^0/, '').sub(/0*$/, '')
|
||||
end
|
||||
end
|
||||
add_tz(s)
|
||||
end
|
||||
|
@ -652,6 +669,9 @@ class XSDDate < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^([+\-]?\d{4,})-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -688,6 +708,9 @@ class XSDGYearMonth < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^([+\-]?\d{4,})-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -723,6 +746,9 @@ class XSDGYear < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^([+\-]?\d{4,})(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -757,6 +783,9 @@ class XSDGMonthDay < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -788,6 +817,9 @@ class XSDGDay < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -818,6 +850,9 @@ class XSDGMonth < XSDAnySimpleType
|
|||
|
||||
private
|
||||
|
||||
def set_datetime_init(t)
|
||||
end
|
||||
|
||||
def set_str(t)
|
||||
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
|
||||
unless Regexp.last_match
|
||||
|
@ -935,6 +970,7 @@ private
|
|||
@prefix = $1
|
||||
@localpart = $2
|
||||
@data = _to_s
|
||||
@data.freeze
|
||||
end
|
||||
|
||||
def _to_s
|
||||
|
|
|
@ -38,6 +38,7 @@ 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.
|
||||
|
|
|
@ -369,7 +369,7 @@ module MarshalTestLib
|
|||
class MyTime < Time; def initialize(v, *args) super(*args); @v = v; end end
|
||||
def test_time
|
||||
# once there was a bug caused by usec overflow. try a little harder.
|
||||
10.times do
|
||||
100.times do
|
||||
t = Time.now
|
||||
marshal_equal(t, t.usec.to_s)
|
||||
end
|
||||
|
|
|
@ -351,6 +351,8 @@ class TestSOAP < Test::Unit::TestCase
|
|||
"2002-12-31T23:59:59-00:01",
|
||||
"2002-12-31T23:59:59-23:59",
|
||||
"2002-12-31T23:59:59.00000000000000000001+13:30",
|
||||
"2002-12-31T23:59:59.51375Z",
|
||||
"2002-12-31T23:59:59.51345+12:34",
|
||||
"-2002-05-18T16:52:20Z",
|
||||
"-4711-12-31T23:59:59Z",
|
||||
"-4713-01-01T12:00:00Z",
|
||||
|
@ -414,6 +416,8 @@ class TestSOAP < Test::Unit::TestCase
|
|||
"23:59:59-00:01",
|
||||
"23:59:59-23:59",
|
||||
"23:59:59.00000000000000000001+13:30",
|
||||
"23:59:59.51375Z",
|
||||
"23:59:59.51375+12:34",
|
||||
"23:59:59+00:01",
|
||||
]
|
||||
targets.each do |str|
|
||||
|
|
|
@ -235,20 +235,9 @@ class StringArray < Array
|
|||
end
|
||||
|
||||
# http://xml.apache.org/xml-soap
|
||||
class Map
|
||||
class Map < Array
|
||||
# Contents type should be dumped here...
|
||||
@@schema_type = "Map"
|
||||
@@schema_ns = "http://xml.apache.org/xml-soap"
|
||||
|
||||
def item
|
||||
@item
|
||||
end
|
||||
|
||||
def item=(value)
|
||||
@item = value
|
||||
end
|
||||
|
||||
def initialize(item = nil)
|
||||
@item = item
|
||||
end
|
||||
end
|
||||
|
||||
|
|
99
test/wsdl/raa/RAAServant.rb
Normal file
99
test/wsdl/raa/RAAServant.rb
Normal file
|
@ -0,0 +1,99 @@
|
|||
class RAABaseServicePortType
|
||||
# SYNOPSIS
|
||||
# getAllListings
|
||||
#
|
||||
# ARGS
|
||||
# N/A
|
||||
#
|
||||
# RETURNS
|
||||
# return StringArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}StringArray
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getAllListings
|
||||
#raise NotImplementedError.new
|
||||
["ruby", "soap4r"]
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# getProductTree
|
||||
#
|
||||
# ARGS
|
||||
# N/A
|
||||
#
|
||||
# RETURNS
|
||||
# return Map - {http://xml.apache.org/xml-soap}Map
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getProductTree
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# getInfoFromCategory(category)
|
||||
#
|
||||
# ARGS
|
||||
# category Category - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Category
|
||||
#
|
||||
# RETURNS
|
||||
# return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getInfoFromCategory(category)
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# getModifiedInfoSince(timeInstant)
|
||||
#
|
||||
# ARGS
|
||||
# timeInstant - {http://www.w3.org/2001/XMLSchema}dateTime
|
||||
#
|
||||
# RETURNS
|
||||
# return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getModifiedInfoSince(timeInstant)
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# getInfoFromName(productName)
|
||||
#
|
||||
# ARGS
|
||||
# productName - {http://www.w3.org/2001/XMLSchema}string
|
||||
#
|
||||
# RETURNS
|
||||
# return Info - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Info
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getInfoFromName(productName)
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# getInfoFromOwnerId(ownerId)
|
||||
#
|
||||
# ARGS
|
||||
# ownerId - {http://www.w3.org/2001/XMLSchema}int
|
||||
#
|
||||
# RETURNS
|
||||
# return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
|
||||
#
|
||||
# RAISES
|
||||
# (undefined)
|
||||
#
|
||||
def getInfoFromOwnerId(ownerId)
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'RAAServant.rb'
|
||||
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'RAA.rb'
|
||||
|
||||
class RAABaseServicePortType
|
||||
MappingRegistry = SOAP::Mapping::Registry.new
|
||||
|
@ -13,9 +14,9 @@ class RAABaseServicePortType
|
|||
)
|
||||
MappingRegistry.set(
|
||||
Map,
|
||||
::SOAP::SOAPStruct,
|
||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||
{ :type => XSD::QName.new("http://xml.apache.org/xml-soap", "Map") }
|
||||
::SOAP::SOAPArray,
|
||||
::SOAP::Mapping::Registry::TypedArrayFactory,
|
||||
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType") }
|
||||
)
|
||||
MappingRegistry.set(
|
||||
Category,
|
||||
|
@ -48,47 +49,38 @@ class RAABaseServicePortType
|
|||
{ :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") }
|
||||
)
|
||||
|
||||
|
||||
Methods = [
|
||||
["getAllListings", "getAllListings", [
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
[::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
["getProductTree", "getProductTree", [
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPStruct, "http://xml.apache.org/xml-soap", "Map"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
[::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
["getInfoFromCategory", "getInfoFromCategory", [
|
||||
["in", "category",
|
||||
[::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]],
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
["getModifiedInfoSince", "getModifiedInfoSince", [
|
||||
["in", "timeInstant",
|
||||
[SOAP::SOAPDateTime]],
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
["getInfoFromName", "getInfoFromName", [
|
||||
["in", "productName",
|
||||
[SOAP::SOAPString]],
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
[::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
|
||||
["getInfoFromOwnerId", "getInfoFromOwnerId", [
|
||||
["in", "ownerId",
|
||||
[SOAP::SOAPInt]],
|
||||
["retval", "return",
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
|
||||
"", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"]
|
||||
[::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"]
|
||||
]
|
||||
|
||||
def getAllListings
|
||||
["ruby", "soap4r"]
|
||||
end
|
||||
end
|
||||
|
||||
class RAABaseServiceServer < SOAP::RPC::StandaloneServer
|
||||
class App < SOAP::RPC::StandaloneServer
|
||||
def initialize(*arg)
|
||||
super
|
||||
|
||||
|
@ -102,3 +94,8 @@ class RAABaseServiceServer < SOAP::RPC::StandaloneServer
|
|||
self.mapping_registry = RAABaseServicePortType::MappingRegistry
|
||||
end
|
||||
end
|
||||
|
||||
# Change listen port.
|
||||
if $0 == __FILE__
|
||||
App.new('app', nil, '0.0.0.0', 10080).start
|
||||
end
|
|
@ -1,4 +1,7 @@
|
|||
server.rb: based on RAAService.rb which is generated with the following command;
|
||||
RAAServant.rb: based on the file which is generated with the following command;
|
||||
bin/wsdl2ruby.rb --wsdl raa.wsdl --servant_skelton --force
|
||||
|
||||
RAAService.rb: generated with the following command;
|
||||
bin/wsdl2ruby.rb --wsdl raa.wsdl --standalone_server_stub --force
|
||||
|
||||
RAA.rb: generated with the following command;
|
||||
|
|
|
@ -18,9 +18,11 @@ class TestRAA < Test::Unit::TestCase
|
|||
|
||||
def setup_server
|
||||
$:.push(DIR)
|
||||
require File.join(DIR, 'server.rb')
|
||||
require File.join(DIR, 'RAA.rb')
|
||||
require File.join(DIR, 'RAAServant.rb')
|
||||
require File.join(DIR, 'RAAService.rb')
|
||||
$:.delete(DIR)
|
||||
@server = RAABaseServiceServer.new('RAA server', nil, '0.0.0.0', Port)
|
||||
@server = App.new('RAA server', nil, '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
|
|
|
@ -384,6 +384,9 @@ class TestXSD < Test::Unit::TestCase
|
|||
"2002-12-31T23:59:59-00:01",
|
||||
"2002-12-31T23:59:59-23:59",
|
||||
"2002-12-31T23:59:59.00000000000000000001+13:30",
|
||||
"2002-12-31T23:59:59.5137Z",
|
||||
"2002-12-31T23:59:59.51375Z", # 411/800
|
||||
"2002-12-31T23:59:59.51375+12:34",
|
||||
"-2002-05-18T16:52:20Z",
|
||||
"-4713-01-01T12:00:00Z",
|
||||
"-2002-12-31T23:59:59+00:01",
|
||||
|
@ -445,6 +448,8 @@ class TestXSD < Test::Unit::TestCase
|
|||
"23:59:59-00:01",
|
||||
"23:59:59-23:59",
|
||||
"23:59:59.00000000000000000001+13:30",
|
||||
"23:59:59.51345Z",
|
||||
"23:59:59.51345+12:34",
|
||||
"23:59:59+00:01",
|
||||
]
|
||||
targets.each do |str|
|
||||
|
|
Loading…
Reference in a new issue