mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* added files:
* lib/soap/mapping/wsdl*.rb * lib/wsdl/soap/element.rb * lib/wsdl/xmlSchema/simpleContent.rb * modified files: * lib/soap/* * lib/wsdl/* * lib/xsd/* * test/soap/* * test/wsdl/* * test/xsd/* * sample/soap/* * sample/sdl/* * summary * imported from the soap4r repository. Version: 1.5.3-ruby1.8.2 * added several XSD basetype support: nonPositiveInteger, negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger * HTTP client connection/send/receive timeout support. * HTTP client/server gzipped content encoding support. * improved WSDL schema definition support; still is far from complete, but is making step by step improovement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
330a8e51c5
commit
e8ed175fe0
81 changed files with 2442 additions and 1150 deletions
|
@ -1,11 +1,14 @@
|
|||
# SOAP4R - Ruby type mapping utility.
|
||||
# Copyright (C) 2000, 2001, 2003 NAKAMURA Hiroshi <nahi@ruby-lang.org>.
|
||||
# Copyright (C) 2000, 2001, 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;
|
||||
# either the dual license version in 2003, or any later version.
|
||||
|
||||
|
||||
require 'xsd/codegen/gensupport'
|
||||
|
||||
|
||||
module SOAP
|
||||
|
||||
|
||||
|
@ -101,8 +104,10 @@ module Mapping
|
|||
def self._obj2soap(obj, registry, type = nil)
|
||||
if referent = Thread.current[:SOAPMarshalDataKey][obj.__id__]
|
||||
SOAPReference.new(referent)
|
||||
elsif registry
|
||||
registry.obj2soap(obj, type)
|
||||
else
|
||||
registry.obj2soap(obj.class, obj, type)
|
||||
raise MappingError.new("No mapping registry given.")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -116,9 +121,41 @@ module Mapping
|
|||
return _soap2obj(target, registry)
|
||||
end
|
||||
end
|
||||
return registry.soap2obj(node.class, node)
|
||||
return registry.soap2obj(node)
|
||||
end
|
||||
|
||||
if Object.respond_to?(:allocate)
|
||||
# ruby/1.7 or later.
|
||||
def self.create_empty_object(klass)
|
||||
klass.allocate
|
||||
end
|
||||
else
|
||||
MARSHAL_TAG = {
|
||||
String => ['"', 1],
|
||||
Regexp => ['/', 2],
|
||||
Array => ['[', 1],
|
||||
Hash => ['{', 1]
|
||||
}
|
||||
def self.create_empty_object(klass)
|
||||
if klass <= Struct
|
||||
name = klass.name
|
||||
return ::Marshal.load(sprintf("\004\006S:%c%s\000", name.length + 5, name))
|
||||
end
|
||||
if MARSHAL_TAG.has_key?(klass)
|
||||
tag, terminate = MARSHAL_TAG[klass]
|
||||
return ::Marshal.load(sprintf("\004\006%s%s", tag, "\000" * terminate))
|
||||
end
|
||||
MARSHAL_TAG.each do |k, v|
|
||||
if klass < k
|
||||
name = klass.name
|
||||
tag, terminate = v
|
||||
return ::Marshal.load(sprintf("\004\006C:%c%s%s%s", name.length + 5, name, tag, "\000" * terminate))
|
||||
end
|
||||
end
|
||||
name = klass.name
|
||||
::Marshal.load(sprintf("\004\006o:%c%s\000", name.length + 5, name))
|
||||
end
|
||||
end
|
||||
def self.set_instance_vars(obj, values)
|
||||
values.each do |name, value|
|
||||
setter = name + "="
|
||||
|
@ -200,6 +237,19 @@ module Mapping
|
|||
end
|
||||
end
|
||||
|
||||
def self.find_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
|
||||
obj.instance_eval("@#{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class << Mapping
|
||||
private
|
||||
def add_md_ary(md_ary, ary, indices, registry)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue