Replaced soap4r with Ruby 1.9-compat version

http://github.com/spox/soap4r-spox

Fixes #994.
This commit is contained in:
Eric Allen 2010-03-14 12:35:55 -04:00
parent a2f8327da4
commit b35b48f2bf
356 changed files with 1340 additions and 42219 deletions

View file

@ -1,137 +0,0 @@
#!/usr/bin/env ruby
require 'getoptlong'
require 'logger'
require 'wsdl/soap/wsdl2ruby'
class WSDL2RubyApp < Logger::Application
private
OptSet = [
['--wsdl','-w', GetoptLong::REQUIRED_ARGUMENT],
['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT],
['--type','-t', GetoptLong::REQUIRED_ARGUMENT],
['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT],
['--mapping_registry','-r', GetoptLong::NO_ARGUMENT],
['--client_skelton','-c', GetoptLong::OPTIONAL_ARGUMENT],
['--servant_skelton','-s', GetoptLong::OPTIONAL_ARGUMENT],
['--cgi_stub','-g', GetoptLong::OPTIONAL_ARGUMENT],
['--servlet_stub','-l', GetoptLong::OPTIONAL_ARGUMENT],
['--standalone_server_stub','-a', GetoptLong::OPTIONAL_ARGUMENT],
['--driver','-d', GetoptLong::OPTIONAL_ARGUMENT],
['--drivername_postfix','-n', GetoptLong::REQUIRED_ARGUMENT],
['--force','-f', GetoptLong::NO_ARGUMENT],
['--quiet','-q', GetoptLong::NO_ARGUMENT],
]
def initialize
super('app')
STDERR.sync = true
self.level = Logger::FATAL
end
def run
@worker = WSDL::SOAP::WSDL2Ruby.new
@worker.logger = @log
location, opt = parse_opt(GetoptLong.new(*OptSet))
usage_exit unless location
@worker.location = location
if opt['quiet']
self.level = Logger::FATAL
else
self.level = Logger::INFO
end
@worker.opt.update(opt)
@worker.run
0
end
def usage_exit
puts <<__EOU__
Usage: #{ $0 } --wsdl wsdl_location [options]
wsdl_location: filename or URL
Example:
For server side:
#{ $0 } --wsdl myapp.wsdl --type server
For client side:
#{ $0 } --wsdl myapp.wsdl --type client
Options:
--wsdl wsdl_location
--type server|client
--type server implies;
--classdef --mapping_registry --servant_skelton --standalone_server_stub
--type client implies;
--classdef --mapping_registry --client_skelton --driver
--classdef [filenameprefix]
--mapping_registry
--client_skelton [servicename]
--servant_skelton [porttypename]
--cgi_stub [servicename]
--servlet_stub [servicename]
--standalone_server_stub [servicename]
--driver [porttypename]
--drivername_postfix driver_classname_postfix
--module_path Module::Path::Name
--force
--quiet
Terminology:
Client <-> Driver <-(SOAP)-> Stub <-> Servant
Driver and Stub: Automatically generated
Client and Servant: Skelton generated (you should change)
__EOU__
exit 1
end
def parse_opt(getoptlong)
opt = {}
wsdl = nil
begin
getoptlong.each do |name, arg|
case name
when "--wsdl"
wsdl = arg
when "--module_path"
opt['module_path'] = arg
when "--type"
case arg
when "server"
opt['classdef'] ||= nil
opt['mapping_registry'] ||= nil
opt['servant_skelton'] ||= nil
opt['standalone_server_stub'] ||= nil
when "client"
opt['classdef'] ||= nil
opt['mapping_registry'] ||= nil
opt['driver'] ||= nil
opt['client_skelton'] ||= nil
else
raise ArgumentError.new("Unknown type #{ arg }")
end
when "--classdef", "--mapping_registry",
"--client_skelton", "--servant_skelton",
"--cgi_stub", "--servlet_stub", "--standalone_server_stub",
"--driver"
opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg
when "--drivername_postfix"
opt['drivername_postfix'] = arg
when "--force"
opt['force'] = true
when "--quiet"
opt['quiet'] = true
else
raise ArgumentError.new("Unknown type #{ arg }")
end
end
rescue
usage_exit
end
return wsdl, opt
end
end
WSDL2RubyApp.new.start

View file

@ -1,90 +0,0 @@
#!/usr/bin/env ruby
require 'getoptlong'
require 'logger'
require 'wsdl/xmlSchema/xsd2ruby'
class XSD2RubyApp < Logger::Application
private
OptSet = [
['--xsd','-x', GetoptLong::REQUIRED_ARGUMENT],
['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT],
['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT],
['--mapping_registry','-r', GetoptLong::NO_ARGUMENT],
['--mapper','-p', GetoptLong::NO_ARGUMENT],
['--force','-f', GetoptLong::NO_ARGUMENT],
['--quiet','-q', GetoptLong::NO_ARGUMENT],
]
def initialize
super('app')
STDERR.sync = true
self.level = Logger::FATAL
end
def run
@worker = WSDL::XMLSchema::XSD2Ruby.new
@worker.logger = @log
location, opt = parse_opt(GetoptLong.new(*OptSet))
usage_exit unless location
@worker.location = location
if opt['quiet']
self.level = Logger::FATAL
else
self.level = Logger::INFO
end
@worker.opt.update(opt)
@worker.run
0
end
def usage_exit
puts <<__EOU__
Usage: #{ $0 } --xsd xsd_location [options]
xsd_location: filename or URL
Example:
#{ $0 } --xsd myapp.xsd --classdef foo
Options:
--xsd xsd_location
--classdef [filenameprefix]
--mapping_registry
--mapper
--module_path [Module::Path::Name]
--force
--quiet
__EOU__
exit 1
end
def parse_opt(getoptlong)
opt = {}
xsd = nil
begin
getoptlong.each do |name, arg|
case name
when "--xsd"
xsd = arg
when "--module_path"
opt['module_path'] = arg
when "--classdef", "--mapping_registry", "--mapper"
opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg
when "--force"
opt['force'] = true
when "--quiet"
opt['quiet'] = true
else
raise ArgumentError.new("Unknown type #{ arg }")
end
end
rescue
usage_exit
end
return xsd, opt
end
end
XSD2RubyApp.new.start

View file

@ -1,9 +0,0 @@
# soap/XMLSchemaDatatypes.rb: SOAP4R - XML Schema Datatype implementation.
# Copyright (C) 2000-2007 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/datatypes'

View file

@ -1,10 +0,0 @@
# soap/XMLSchemaDatatypes1999.rb: SOAP4R - XML Schema Datatype 1999 support
# Copyright (C) 2000-2007 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/datatypes1999'
load 'soap/mapping/typeMap.rb'

View file

@ -0,0 +1,34 @@
# SOAP4R - attribute proxy interface.
# Copyright (C) 2000-2007 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.
module SOAP
module AttrProxy
def self.included(klass)
klass.extend(AttrProxyClassSupport)
end
module AttrProxyClassSupport
def attr_proxy(symbol, assignable = false)
name = symbol.to_s
define_method(name) {
attrproxy.__send__(name)
}
if assignable
aname = name + '='
define_method(aname) { |rhs|
attrproxy.__send__(aname, rhs)
}
end
end
end
end
end

View file

@ -48,6 +48,7 @@ module SOAPType
attr_accessor :position attr_accessor :position
attr_reader :extraattr attr_reader :extraattr
attr_accessor :definedtype attr_accessor :definedtype
attr_accessor :force_typed
def initialize(*arg) def initialize(*arg)
super super
@ -60,6 +61,7 @@ module SOAPType
@position = nil @position = nil
@definedtype = nil @definedtype = nil
@extraattr = {} @extraattr = {}
@force_typed = false
end end
def inspect def inspect
@ -1020,7 +1022,7 @@ private
if rank < @rank and data[idx] if rank < @rank and data[idx]
traverse_data(data[idx], rank + 1) do |*v| traverse_data(data[idx], rank + 1) do |*v|
v[1, 0] = idx v[1, 0] = idx
yield(*v) yield(*v)
end end
else else
yield(data[idx], idx) yield(data[idx], idx)
@ -1077,7 +1079,7 @@ private
"#{typename}[" << ',' * (rank - 1) << ']' "#{typename}[" << ',' * (rank - 1) << ']'
end end
TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$', nil, 'NONE') TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$')
def self.parse_type(string) def self.parse_type(string)
TypeParseRegexp =~ string TypeParseRegexp =~ string

View file

@ -1,9 +0,0 @@
# SOAP4R - Charset encoding handler.
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -1,182 +0,0 @@
# SOAP4R - Compatibility definitions.
# Copyright (C) 2003 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.
STDERR.puts "Loading compatibility library..."
require 'xsd/qname'
require 'xsd/ns'
require 'xsd/charset'
require 'soap/mapping'
require 'soap/rpc/rpc'
require 'soap/rpc/element'
require 'soap/rpc/driver'
require 'soap/rpc/cgistub'
require 'soap/rpc/router'
require 'soap/rpc/standaloneServer'
module SOAP
module RPC
RubyTypeNamespace = Mapping::RubyTypeNamespace
RubyTypeInstanceNamespace = Mapping::RubyTypeInstanceNamespace
RubyCustomTypeNamespace = Mapping::RubyCustomTypeNamespace
ApacheSOAPTypeNamespace = Mapping::ApacheSOAPTypeNamespace
DefaultMappingRegistry = Mapping::DefaultRegistry
def self.obj2soap(*arg); Mapping.obj2soap(*arg); end
def self.soap2obj(*arg); Mapping.soap2obj(*arg); end
def self.ary2soap(*arg); Mapping.ary2soap(*arg); end
def self.ary2md(*arg); Mapping.ary2md(*arg); end
def self.fault2exception(*arg); Mapping.fault2exception(*arg); end
def self.defined_methods(obj)
if obj.is_a?(Module)
obj.methods - Module.methods
else
obj.methods - Kernel.instance_methods(true)
end
end
end
NS = XSD::NS
Charset = XSD::Charset
RPCUtils = RPC
RPCServerException = RPC::ServerException
RPCRouter = RPC::Router
class StandaloneServer < RPC::StandaloneServer
def initialize(*arg)
super
@router = @soaplet.app_scope_router
methodDef if respond_to?('methodDef')
end
alias addServant add_servant
alias addMethod add_method
alias addMethodAs add_method_as
end
class CGIStub < RPC::CGIStub
def initialize(*arg)
super
methodDef if respond_to?('methodDef')
end
alias addServant add_servant
def addMethod(receiver, methodName, *paramArg)
addMethodWithNSAs(@default_namespace, receiver, methodName, methodName, *paramArg)
end
def addMethodAs(receiver, methodName, methodNameAs, *paramArg)
addMethodWithNSAs(@default_namespace, receiver, methodName, methodNameAs, *paramArg)
end
def addMethodWithNS(namespace, receiver, methodName, *paramArg)
addMethodWithNSAs(namespace, receiver, methodName, methodName, *paramArg)
end
def addMethodWithNSAs(namespace, receiver, methodName, methodNameAs, *paramArg)
add_method_with_namespace_as(namespace, receiver, methodName, methodNameAs, *paramArg)
end
end
class Driver < RPC::Driver
include Logger::Severity
attr_accessor :logdev
alias logDev= logdev=
alias logDev logdev
alias setWireDumpDev wiredump_dev=
alias setDefaultEncodingStyle default_encodingstyle=
alias mappingRegistry= mapping_registry=
alias mappingRegistry mapping_registry
def initialize(log, logid, namespace, endpoint_url, httpproxy = nil, soapaction = nil)
super(endpoint_url, namespace, soapaction)
@logdev = log
@logid = logid
@logid_prefix = "<#{ @logid }> "
self.httpproxy = httpproxy if httpproxy
log(INFO) { 'initialize: initializing SOAP driver...' }
end
def invoke(headers, body)
log(INFO) { "invoke: invoking message '#{ body.type }'." }
super
end
def call(name, *params)
log(INFO) { "call: calling method '#{ name }'." }
log(DEBUG) { "call: parameters '#{ params.inspect }'." }
log(DEBUG) {
params = Mapping.obj2soap(params, @mapping_registry).to_a
"call: parameters '#{ params.inspect }'."
}
super
end
def addMethod(name, *params)
addMethodWithSOAPActionAs(name, name, nil, *params)
end
def addMethodAs(name_as, name, *params)
addMethodWithSOAPActionAs(name_as, name, nil, *params)
end
def addMethodWithSOAPAction(name, soapaction, *params)
addMethodWithSOAPActionAs(name, name, soapaction, *params)
end
def addMethodWithSOAPActionAs(name_as, name, soapaction, *params)
add_method_with_soapaction_as(name, name_as, soapaction, *params)
end
def setLogDev(logdev)
self.logdev = logdev
end
private
def log(sev)
@logdev.add(sev, nil, self.class) { @logid_prefix + yield } if @logdev
end
end
module RPC
class MappingRegistry < SOAP::Mapping::Registry
def initialize(*arg)
super
end
def add(obj_class, soap_class, factory, info = nil)
if (info.size > 1)
raise RuntimeError.new("Parameter signature changed. [namespace, name] should be { :type => XSD::QName.new(namespace, name) } from 1.5.0.")
end
@map.add(obj_class, soap_class, factory, { :type => info[0] })
end
alias set add
end
class Router
alias mappingRegistry mapping_registry
alias mappingRegistry= mapping_registry=
end
end
end

View file

@ -1,9 +0,0 @@
# SOAP4R - SOAP driver
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -29,8 +29,11 @@ class LiteralHandler < Handler
def encode_data(generator, ns, data, parent) def encode_data(generator, ns, data, parent)
attrs = {} attrs = {}
name = generator.encode_name(ns, data, attrs) name = generator.encode_name(ns, data, attrs)
if data.type and data.type.name and
(@generate_explicit_type or data.force_typed)
data.extraattr[XSD::AttrTypeName] = data.type
end
data.extraattr.each do |key, value| data.extraattr.each do |key, value|
next if !@generate_explicit_type and key == XSD::AttrTypeName
keytag = key keytag = key
if key.is_a?(XSD::QName) if key.is_a?(XSD::QName)
keytag = encode_attr_key(attrs, ns, key) keytag = encode_attr_key(attrs, ns, key)

View file

@ -284,7 +284,7 @@ private
if data.is_a?(SOAPArray) if data.is_a?(SOAPArray)
if data.arytype.namespace if data.arytype.namespace
Generator.assign_ns(attrs, ns, data.arytype.namespace) Generator.assign_ns(attrs, ns, data.arytype.namespace)
end end
Generator.assign_ns(attrs, ns, EncodingNamespace) Generator.assign_ns(attrs, ns, EncodingNamespace)
attrs[ns.name(AttrArrayTypeName)] = ns.name(create_arytype(ns, data)) attrs[ns.name(AttrArrayTypeName)] = ns.name(create_arytype(ns, data))
if data.type.name if data.type.name
@ -542,7 +542,7 @@ private
false false
elsif o = ref.rootnode.external_content[ref.refid] elsif o = ref.rootnode.external_content[ref.refid]
ref.__setobj__(o) ref.__setobj__(o)
false false
else else
raise EncodingStyleError.new("unresolved reference: #{ref.refid}") raise EncodingStyleError.new("unresolved reference: #{ref.refid}")
end end

View file

@ -141,11 +141,8 @@ public
@reftarget = nil @reftarget = nil
else else
if obj.is_a?(SOAPEnvelope) if obj.is_a?(SOAPEnvelope)
# xsi:nil="true" can appear even if dumping without explicit type.
Generator.assign_ns(attrs, ns, XSD::InstanceNamespace) Generator.assign_ns(attrs, ns, XSD::InstanceNamespace)
if @generate_explicit_type Generator.assign_ns(attrs, ns, XSD::Namespace)
Generator.assign_ns(attrs, ns, XSD::Namespace)
end
end end
obj.encode(self, ns, attrs) do |child| obj.encode(self, ns, attrs) do |child|
indent_backup, @indent = @indent, @indent + @indentstr indent_backup, @indent = @indent, @indent + @indentstr
@ -179,7 +176,7 @@ public
def encode_tag(elename, attrs = nil) def encode_tag(elename, attrs = nil)
if attrs.nil? or attrs.empty? if attrs.nil? or attrs.empty?
@buf << "\n#{ @indent }<#{ elename }>" @buf << "\n#{ @indent }<#{ elename }>"
return return
end end
ary = [] ary = []
attrs.each do |key, value| attrs.each do |key, value|
@ -273,7 +270,7 @@ private
def get_encode_char_regexp def get_encode_char_regexp
ENCODE_CHAR_REGEXP[XSD::Charset.encoding] ||= ENCODE_CHAR_REGEXP[XSD::Charset.encoding] ||=
Regexp.new("[#{EncodeMap.keys.join}]", nil, XSD::Charset.encoding) Regexp.new("[#{EncodeMap.keys.join}]")
end end
def find_handler(encodingstyle) def find_handler(encodingstyle)
@ -298,7 +295,5 @@ private
end end
end end
SOAPGenerator = Generator # for backward compatibility
end end

View file

@ -337,7 +337,7 @@ private
return base2soap(obj, type) return base2soap(obj, type)
end end
cause = nil cause = nil
begin begin
if definition = schema_definition_from_class(obj.class) if definition = schema_definition_from_class(obj.class)
return stubobj2soap(obj, definition) return stubobj2soap(obj, definition)
end end
@ -390,7 +390,7 @@ private
cause = $! cause = $!
end end
end end
raise MappingError.new("Cannot map #{ node.type.name } to Ruby object.", cause) raise MappingError.new("Cannot map #{ node.type } to Ruby object.", cause)
end end
def addiv2obj(obj, attr) def addiv2obj(obj, attr)
@ -402,21 +402,10 @@ private
Mapping.set_attributes(obj, vars) Mapping.set_attributes(obj, vars)
end end
if RUBY_VERSION >= '1.8.0' def addextend2obj(obj, attr)
def addextend2obj(obj, attr) return unless attr
return unless attr attr.split(/ /).reverse_each do |mstr|
attr.split(/ /).reverse_each do |mstr| obj.extend(Mapping.module_from_name(mstr))
obj.extend(Mapping.module_from_name(mstr))
end
end
else
# (class < false; self; end).ancestors includes "TrueClass" under 1.6...
def addextend2obj(obj, attr)
return unless attr
attr.split(/ /).reverse_each do |mstr|
m = Mapping.module_from_name(mstr)
obj.extend(m)
end
end end
end end
@ -427,8 +416,8 @@ private
node.extraattr[RubyExtendName] = list.collect { |c| node.extraattr[RubyExtendName] = list.collect { |c|
name = c.name name = c.name
if name.nil? or name.empty? if name.nil? or name.empty?
raise TypeError.new("singleton can't be dumped #{ obj }") raise TypeError.new("singleton can't be dumped #{ obj }")
end end
name name
}.join(" ") }.join(" ")
end end

View file

@ -42,7 +42,7 @@ class Factory
else else
# should we sort instance_variables? how? # should we sort instance_variables? how?
obj.instance_variables.each do |var| obj.instance_variables.each do |var|
name = var.sub(/^@/, '') name = var.to_s.sub(/^@/, '').to_sym
elename = Mapping.name2elename(name) elename = Mapping.name2elename(name)
node.add(elename, node.add(elename,
Mapping._obj2soap(obj.instance_variable_get(var), map)) Mapping._obj2soap(obj.instance_variable_get(var), map))

View file

@ -136,9 +136,12 @@ private
ele = SOAPElement.new(qname) ele = SOAPElement.new(qname)
end end
ele.qualified = definition.qualified ele.qualified = definition.qualified
if definition.type and (definition.basetype or Mapping.root_type_hint) if definition.type
Mapping.reset_root_type_hint ele.type = definition.type
ele.extraattr[XSD::AttrTypeName] = definition.type if definition.basetype or Mapping.root_type_hint
Mapping.reset_root_type_hint
ele.force_typed = true
end
end end
if qname.nil? and definition.elename if qname.nil? and definition.elename
ele.elename = definition.elename ele.elename = definition.elename
@ -243,7 +246,7 @@ private
obj = nil obj = nil
if obj_class == ::String if obj_class == ::String
obj = node.text obj = node.text
elsif obj_class < ::String elsif obj_class < ::String and node.respond_to?(:text)
obj = obj_class.new(node.text) obj = obj_class.new(node.text)
else else
obj = Mapping.create_empty_object(obj_class) obj = Mapping.create_empty_object(obj_class)

View file

@ -91,11 +91,15 @@ module Mapping
def self.fault2exception(fault, registry = nil) def self.fault2exception(fault, registry = nil)
registry ||= Mapping::DefaultRegistry registry ||= Mapping::DefaultRegistry
detail = if fault.detail detail = ""
soap2obj(fault.detail, registry) || "" if fault.detail
else begin
"" fault.detail.type ||= XSD::QName::EMPTY
detail = soap2obj(fault.detail, registry) || ""
rescue MappingError
detail = fault.detail
end end
end
if detail.is_a?(Mapping::SOAPException) if detail.is_a?(Mapping::SOAPException)
begin begin
e = detail.to_e e = detail.to_e
@ -150,37 +154,8 @@ module Mapping
return registry.soap2obj(node, klass) return registry.soap2obj(node, klass)
end end
if Object.respond_to?(:allocate) def self.create_empty_object(klass)
# ruby/1.7 or later. klass.allocate
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 end
# Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here. # Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here.
@ -190,9 +165,10 @@ module Mapping
# ex. a.b => a.2eb # ex. a.b => a.2eb
# #
def self.name2elename(name) def self.name2elename(name)
name = name.to_s
name.gsub(/([^a-zA-Z0-9:_\-]+)/n) { name.gsub(/([^a-zA-Z0-9:_\-]+)/n) {
'.' << $1.unpack('H2' * $1.size).join('.') '.' << $1.unpack('H2' * $1.size).join('.')
}.gsub(/::/n, '..') }.gsub(/::/n, '..').to_sym
end end
def self.elename2name(name) def self.elename2name(name)
@ -469,12 +445,6 @@ module Mapping
schema_type = definition[:schema_type] schema_type = definition[:schema_type]
is_anonymous = definition[:is_anonymous] is_anonymous = definition[:is_anonymous]
schema_basetype = definition[:schema_basetype] schema_basetype = definition[:schema_basetype]
# wrap if needed for backward compatibility
if schema_ns
schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name
schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type
# no need for schema_basetype bacause it's introduced later
end
schema_qualified = definition[:schema_qualified] schema_qualified = definition[:schema_qualified]
schema_element = definition[:schema_element] schema_element = definition[:schema_element]
schema_attributes = definition[:schema_attribute] schema_attributes = definition[:schema_attribute]
@ -497,7 +467,6 @@ module Mapping
definition definition
end end
# for backward compatibility
# returns SchemaComplexTypeDefinition # returns SchemaComplexTypeDefinition
def self.parse_schema_definition(schema_element, default_ns) def self.parse_schema_definition(schema_element, default_ns)
definition = nil definition = nil
@ -526,7 +495,6 @@ module Mapping
if occurrence if occurrence
minoccurs, maxoccurs = occurrence minoccurs, maxoccurs = occurrence
else else
# for backward compatibility
minoccurs, maxoccurs = 1, 1 minoccurs, maxoccurs = 1, 1
end end
as_any = as_array = false as_any = as_array = false

View file

@ -20,7 +20,7 @@ end
module Mapping module Mapping
module MappedException; end module MappedException; end
@ -226,7 +226,7 @@ module RegistrySupport
schema_definition_from_class(obj_class) schema_definition_from_class(obj_class)
end end
end end
def add_attributes2soap(obj, ele) def add_attributes2soap(obj, ele)
if definition = Mapping.schema_definition_classdef(obj.class) if definition = Mapping.schema_definition_classdef(obj.class)
add_definedattributes2soap(obj, ele, definition) add_definedattributes2soap(obj, ele, definition)

View file

@ -5,6 +5,7 @@
# redistribute it and/or modify it under the same terms of Ruby's license; # 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. # either the dual license version in 2003, or any later version.
#require 'continuation'
module SOAP module SOAP
module Mapping module Mapping
@ -124,30 +125,7 @@ class RubytypeFactory < Factory
param.extraattr[RubyTypeName] = obj.class.name param.extraattr[RubyTypeName] = obj.class.name
end end
param.add('source', SOAPBase64.new(obj.source)) param.add('source', SOAPBase64.new(obj.source))
if obj.respond_to?('options') options = obj.options
# Regexp#options is from Ruby/1.7
options = obj.options
else
options = 0
obj.inspect.sub(/^.*\//, '').each_byte do |c|
options += case c
when ?i
1
when ?x
2
when ?m
4
when ?n
16
when ?e
32
when ?s
48
when ?u
64
end
end
end
param.add('options', SOAPInt.new(options)) param.add('options', SOAPInt.new(options))
addiv2soapattr(param, obj, map) addiv2soapattr(param, obj, map)
when ::Range when ::Range
@ -216,8 +194,8 @@ class RubytypeFactory < Factory
addiv2soapattr(param, obj, map) addiv2soapattr(param, obj, map)
end end
when ::IO, ::Binding, ::Continuation, ::Data, ::Dir, ::File::Stat, when ::IO, ::Binding, ::Continuation, ::Data, ::Dir, ::File::Stat,
::MatchData, Method, ::Proc, ::Thread, ::ThreadGroup ::MatchData, Method, ::Proc, ::Process::Status, ::Thread,
# from 1.8: Process::Status, UnboundMethod ::ThreadGroup, ::UnboundMethod
return nil return nil
when ::SOAP::Mapping::Object when ::SOAP::Mapping::Object
param = SOAPStruct.new(XSD::AnyTypeName) param = SOAPStruct.new(XSD::AnyTypeName)
@ -266,7 +244,7 @@ private
raise TypeError.new("can't dump anonymous class #{obj}") raise TypeError.new("can't dump anonymous class #{obj}")
end end
singleton_class = class << obj; self; end singleton_class = class << obj; self; end
if !singleton_methods_true(obj).empty? or if !obj.singleton_methods(true).empty? or
!singleton_class.instance_variables.empty? !singleton_class.instance_variables.empty?
raise TypeError.new("singleton can't be dumped #{obj}") raise TypeError.new("singleton can't be dumped #{obj}")
end end
@ -282,16 +260,6 @@ private
param param
end end
if RUBY_VERSION >= '1.8.0'
def singleton_methods_true(obj)
obj.singleton_methods(true)
end
else
def singleton_methods_true(obj)
obj.singleton_methods
end
end
def rubytype2obj(node, info, map, rubytype) def rubytype2obj(node, info, map, rubytype)
klass = rubytype ? Mapping.class_from_name(rubytype) : nil klass = rubytype ? Mapping.class_from_name(rubytype) : nil
obj = nil obj = nil

View file

@ -102,5 +102,4 @@ TypeMap = {
SOAP::SOAPPositiveInteger::SOAPENCType => SOAPPositiveInteger, SOAP::SOAPPositiveInteger::SOAPENCType => SOAPPositiveInteger,
} }
end end

View file

@ -123,8 +123,8 @@ private
end end
def simpleobj2soap(obj, type) def simpleobj2soap(obj, type)
return SOAPNil.new unless obj
type.check_lexical_format(obj) type.check_lexical_format(obj)
return SOAPNil.new if obj.nil? # TODO: check nillable.
if type.base if type.base
ele = base2soap(obj, TypeMap[type.base]) ele = base2soap(obj, TypeMap[type.base])
ele.type = type.name ele.type = type.name

View file

@ -110,6 +110,11 @@ private
else else
ele = complexobj2soap(obj, type) ele = complexobj2soap(obj, type)
end end
ele.type = type.name
if type.base or Mapping.root_type_hint
Mapping.reset_root_type_hint
ele.force_typed = true
end
add_definedattributes2soap(obj, ele, type) add_definedattributes2soap(obj, ele, type)
end end
ele ele

View file

@ -1,9 +0,0 @@
# SOAP4R - RPC utility -- Mapping registry.
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -67,7 +67,7 @@ class MIMEMessage
def parse_line(line) def parse_line(line)
if /^\A([^\: \t]+):\s*(.+)\z/ =~ line if /^\A([^\: \t]+):\s*(.+)\z/ =~ line
header = parse_rhs($2.strip) header = parse_rhs($2.strip)
header.key = $1.strip header.key = $1.strip
self[header.key.downcase] = header self[header.key.downcase] = header
else else
@ -120,7 +120,7 @@ class MIMEMessage
end end
def parse(str) def parse(str)
headers, body = str.split(/\r\n\r\n/s, 2) headers, body = str.split(/\r\n\r\n/, 2)
if headers != nil and body != nil if headers != nil and body != nil
@headers = Headers.parse(headers) @headers = Headers.parse(headers)
@body = body.sub(/\r\n\z/, '') @body = body.sub(/\r\n\z/, '')

View file

@ -1,9 +0,0 @@
# SOAP4R - Namespace library
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -43,7 +43,7 @@ class NetHttpClient
@no_proxy = @ssl_config = @protocol_version = nil @no_proxy = @ssl_config = @protocol_version = nil
@connect_timeout = @send_timeout = @receive_timeout = nil @connect_timeout = @send_timeout = @receive_timeout = nil
end end
def proxy=(proxy) def proxy=(proxy)
if proxy.nil? if proxy.nil?
@proxy = nil @proxy = nil
@ -137,10 +137,10 @@ private
http.post(url.request_uri, req_body, extra) http.post(url.request_uri, req_body, extra)
} }
case res case res
when Net::HTTPRedirection when Net::HTTPRedirection
if redirect_count > 0 if redirect_count > 0
post_redirect(res['location'], req_body, header, post_redirect(res['location'], req_body, header,
redirect_count - 1) redirect_count - 1)
else else
raise ArgumentError.new("Too many redirects") raise ArgumentError.new("Too many redirects")
end end
@ -176,13 +176,13 @@ private
http.open_timeout = @connect_timeout if @connect_timeout http.open_timeout = @connect_timeout if @connect_timeout
http.read_timeout = @receive_timeout if @receive_timeout http.read_timeout = @receive_timeout if @receive_timeout
case url case url
when URI::HTTPS when URI::HTTPS then
if SSLEnabled if SSLEnabled
http.use_ssl = true http.use_ssl = true
else else
raise RuntimeError.new("Cannot connect to #{url} (OpenSSL is not installed.)") raise RuntimeError.new("Cannot connect to #{url} (OpenSSL is not installed.)")
end end
when URI::HTTP when URI::HTTP then
# OK # OK
else else
raise RuntimeError.new("Cannot connect to #{url} (Not HTTP.)") raise RuntimeError.new("Cannot connect to #{url} (Not HTTP.)")

View file

@ -65,12 +65,12 @@ class Property
KEY_REGSRC = '([^=:\\\\]*(?:\\\\.[^=:\\\\]*)*)' KEY_REGSRC = '([^=:\\\\]*(?:\\\\.[^=:\\\\]*)*)'
DEF_REGSRC = '\\s*' + KEY_REGSRC + '\\s*[=:]\\s*(.*)' DEF_REGSRC = '\\s*' + KEY_REGSRC + '\\s*[=:]\\s*(.*)'
COMMENT_REGEXP = Regexp.new('^(?:#.*|)$', nil, 'u') COMMENT_REGEXP = Regexp.new("^(?:#.*|)$")
CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$", nil, 'u') CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$")
LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$", nil, 'u') LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$")
def load(stream) def load(stream)
key_prefix = "" key_prefix = ""
stream.each_with_index do |line, lineno| stream.readlines.each_with_index do |line, lineno|
line.sub!(/\r?\n\z/u, '') line.sub!(/\r?\n\z/u, '')
case line case line
when COMMENT_REGEXP when COMMENT_REGEXP
@ -320,12 +320,12 @@ end
# for ruby/1.6. # for ruby/1.6.
unless Enumerable.instance_methods.include?('inject') unless Enumerable.method_defined?(:inject)
module Enumerable module Enumerable
def inject(init) def inject(init)
result = init result = init
each do |item| each do |item|
result = yield(result, item) result = yield(result, item)
end end
result result
end end

View file

@ -1,9 +0,0 @@
# SOAP4R - XML QName definition.
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -113,7 +113,7 @@ class CGIStub < Logger::Application
@soaplet = ::SOAP::RPC::SOAPlet.new(@router) @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
on_init on_init
end end
def on_init def on_init
# do extra initialization in a derived class if needed. # do extra initialization in a derived class if needed.
end end

View file

@ -7,6 +7,7 @@
require 'soap/soap' require 'soap/soap'
require 'soap/attrproxy'
require 'soap/mapping' require 'soap/mapping'
require 'soap/rpc/rpc' require 'soap/rpc/rpc'
require 'soap/rpc/proxy' require 'soap/rpc/proxy'
@ -21,52 +22,21 @@ module RPC
class Driver class Driver
class << self include AttrProxy
if RUBY_VERSION >= "1.7.0"
def __attr_proxy(symbol, assignable = false)
name = symbol.to_s
define_method(name) {
@proxy.__send__(name)
}
if assignable
aname = name + '='
define_method(aname) { |rhs|
@proxy.__send__(aname, 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 :endpoint_url, true attr_proxy :endpoint_url, true
__attr_proxy :mapping_registry, true attr_proxy :mapping_registry, true
__attr_proxy :literal_mapping_registry, true attr_proxy :literal_mapping_registry, true
__attr_proxy :allow_unqualified_element, true attr_proxy :allow_unqualified_element, true
__attr_proxy :default_encodingstyle, true attr_proxy :default_encodingstyle, true
__attr_proxy :generate_explicit_type, true attr_proxy :generate_explicit_type, true
__attr_proxy :use_default_namespace, true attr_proxy :use_default_namespace, true
__attr_proxy :return_response_as_xml, true attr_proxy :return_response_as_xml, true
__attr_proxy :headerhandler attr_proxy :headerhandler
__attr_proxy :filterchain attr_proxy :filterchain
__attr_proxy :streamhandler attr_proxy :streamhandler
__attr_proxy :test_loopback_response attr_proxy :test_loopback_response
__attr_proxy :reset_stream attr_proxy :reset_stream
attr_reader :proxy attr_reader :proxy
attr_reader :options attr_reader :options
@ -183,6 +153,10 @@ class Driver
private private
def attrproxy
@proxy
end
def set_wiredump_file_base(name) def set_wiredump_file_base(name)
if @wiredump_file_base if @wiredump_file_base
@proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}") @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}")

View file

@ -7,6 +7,7 @@
require 'soap/baseData' require 'soap/baseData'
require 'soap/rpc/methodDef'
module SOAP module SOAP
@ -69,10 +70,10 @@ class MethodDefinitionError < RPCError; end
class ParameterError < RPCError; end class ParameterError < RPCError; end
class SOAPMethod < SOAPStruct class SOAPMethod < SOAPStruct
RETVAL = 'retval' RETVAL = :retval
IN = 'in' IN = :in
OUT = 'out' OUT = :out
INOUT = 'inout' INOUT = :inout
attr_reader :param_def attr_reader :param_def
attr_reader :inparam attr_reader :inparam
@ -97,7 +98,7 @@ class SOAPMethod < SOAPStruct
@retval_name = nil @retval_name = nil
@retval_class_name = nil @retval_class_name = nil
init_param(@param_def) if @param_def init_params(@param_def) if @param_def
end end
def have_member def have_member
@ -151,8 +152,9 @@ class SOAPMethod < SOAPStruct
def SOAPMethod.param_count(param_def, *type) def SOAPMethod.param_count(param_def, *type)
count = 0 count = 0
param_def.each do |io_type, name, param_type| param_def.each do |param|
if type.include?(io_type) param = MethodDef.to_param(param)
if type.include?(param.io_type.to_sym)
count += 1 count += 1
end end
end end
@ -217,38 +219,41 @@ private
names names
end end
def init_param(param_def) def init_params(param_def)
param_def.each do |io_type, name, param_type| param_def.each do |param|
mapped_class, nsdef, namedef = SOAPMethod.parse_param_type(param_type) param = MethodDef.to_param(param)
if nsdef && namedef init_param(param)
type_qname = XSD::QName.new(nsdef, namedef)
elsif mapped_class
type_qname = TypeMap.index(mapped_class)
end
case io_type
when IN
@signature.push([IN, name, type_qname])
@inparam_names.push(name)
when OUT
@signature.push([OUT, name, type_qname])
@outparam_names.push(name)
when INOUT
@signature.push([INOUT, name, type_qname])
@inoutparam_names.push(name)
when RETVAL
if @retval_name
raise MethodDefinitionError.new('duplicated retval')
end
@retval_name = name
@retval_class_name = mapped_class
else
raise MethodDefinitionError.new("unknown type: #{io_type}")
end
end end
end end
def self.parse_param_type(param_type) def init_param(param)
mapped_class, nsdef, namedef = param_type mapped_class = SOAPMethod.parse_mapped_class(param.mapped_class)
qname = param.qname
if qname.nil? and mapped_class
qname = TypeMap.key(mapped_class)
end
case param.io_type
when IN
@signature.push([IN, param.name, qname])
@inparam_names.push(param.name)
when OUT
@signature.push([OUT, param.name, qname])
@outparam_names.push(param.name)
when INOUT
@signature.push([INOUT, param.name, qname])
@inoutparam_names.push(param.name)
when RETVAL
if @retval_name
raise MethodDefinitionError.new('duplicated retval')
end
@retval_name = param.name
@retval_class_name = mapped_class
else
raise MethodDefinitionError.new("unknown type: #{param.io_type}")
end
end
def self.parse_mapped_class(mapped_class)
# the first element of typedef in param_def can be a String like # the first element of typedef in param_def can be a String like
# "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if # "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if
# we can. # we can.
@ -260,7 +265,7 @@ private
mapped_class = Mapping.class_from_name(mapped_class) mapped_class = Mapping.class_from_name(mapped_class)
end end
end end
[mapped_class, nsdef, namedef] mapped_class
end end
end end

View file

@ -0,0 +1,374 @@
# SOAP4R - RPC element definition.
# Copyright (C) 2000-2007 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 'soap/baseData'
require 'soap/rpc/methodDef'
module SOAP
# Add method definitions for RPC to common definition in element.rb
class SOAPBody < SOAPStruct
public
def request
root_node
end
def response
root = root_node
if !@is_fault
if root.nil?
nil
elsif root.is_a?(SOAPBasetype)
root
else
# Initial element is [retval].
root[0]
end
else
root
end
end
def outparams
root = root_node
if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
op = root[1..-1]
op = nil if op && op.empty?
op
else
nil
end
end
def fault
if @is_fault
self['fault']
else
nil
end
end
def fault=(fault)
@is_fault = true
add('fault', fault)
end
end
module RPC
class RPCError < Error; end
class MethodDefinitionError < RPCError; end
class ParameterError < RPCError; end
class SOAPMethod < SOAPStruct
RETVAL = :retval
IN = :in
OUT = :out
INOUT = :inout
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)
@elename = qname
@encodingstyle = nil
@param_def = param_def
@signature = []
@inparam_names = []
@inoutparam_names = []
@outparam_names = []
@inparam = {}
@outparam = {}
@retval_name = nil
@retval_class_name = nil
init_params(@param_def) if @param_def
end
def have_member
true
end
def have_outparam?
@outparam_names.size > 0
end
def input_params
collect_params(IN, INOUT)
end
def output_params
collect_params(OUT, INOUT)
end
def input_param_types
collect_param_types(IN, INOUT)
end
def output_param_types
collect_param_types(OUT, INOUT)
end
def set_param(params)
params.each do |param, data|
@inparam[param] = data
data.elename = XSD::QName.new(data.elename.namespace, param)
data.parent = self
end
end
def set_outparam(params)
params.each do |param, data|
@outparam[param] = data
data.elename = XSD::QName.new(data.elename.namespace, param)
end
end
def get_paramtypes(names)
types = []
@signature.each do |io_type, name, type_qname|
if type_qname && idx = names.index(name)
types[idx] = type_qname
end
end
types
end
def SOAPMethod.param_count(param_def, *type)
count = 0
param_def.each do |param|
param = MethodDef.to_param(param)
if type.include?(param.io_type.to_sym)
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])
end
param_def.push([RETVAL, 'return', nil])
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 and res_qnames can be nil
if req_qnames
req_qnames.each do |qname|
param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
end
end
if res_qnames
res_qnames.each do |qname|
param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
end
end
param_def
end
private
def collect_param_types(*type)
names = []
@signature.each do |io_type, name, type_qname|
names << type_qname if type.include?(io_type)
end
names
end
def collect_params(*type)
names = []
@signature.each do |io_type, name, type_qname|
names << name if type.include?(io_type)
end
names
end
def init_params(param_def)
param_def.each do |param|
param = MethodDef.to_param(param)
init_param(param)
end
end
def init_param(param)
mapped_class = SOAPMethod.parse_mapped_class(param.mapped_class)
qname = param.qname
if qname.nil? and mapped_class
qname = TypeMap.index(mapped_class)
end
case param.io_type
when IN
@signature.push([IN, param.name, qname])
@inparam_names.push(param.name)
when OUT
@signature.push([OUT, param.name, qname])
@outparam_names.push(param.name)
when INOUT
@signature.push([INOUT, param.name, qname])
@inoutparam_names.push(param.name)
when RETVAL
if @retval_name
raise MethodDefinitionError.new('duplicated retval')
end
@retval_name = param.name
@retval_class_name = mapped_class
else
raise MethodDefinitionError.new("unknown type: #{param.io_type}")
end
end
def self.parse_mapped_class(mapped_class)
# the first element of typedef in param_def can be a String like
# "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if
# we can.
if mapped_class.is_a?(String)
if /\[\]\Z/ =~ mapped_class
# when '[]' is added, ignore this.
mapped_class = nil
else
mapped_class = Mapping.class_from_name(mapped_class)
end
end
mapped_class
end
end
class SOAPMethodRequest < SOAPMethod
attr_accessor :soapaction
def SOAPMethodRequest.create_request(qname, *params)
param_def = []
param_value = []
i = 0
params.each do |param|
param_name = "p#{i}"
i += 1
param_def << [IN, param_name, nil]
param_value << [param_name, param]
end
param_def << [RETVAL, 'return', nil]
o = new(qname, param_def)
o.set_param(param_value)
o
end
def initialize(qname, param_def = nil, soapaction = nil)
super(qname, param_def)
@soapaction = soapaction
end
def each
input_params.each do |name|
unless @inparam[name]
raise ParameterError.new("parameter: #{name} was not given")
end
yield(name, @inparam[name])
end
end
def dup
req = self.class.new(@elename.dup, @param_def, @soapaction)
req.encodingstyle = @encodingstyle
req
end
def create_method_response(response_name = nil)
response_name ||=
XSD::QName.new(@elename.namespace, @elename.name + 'Response')
SOAPMethodResponse.new(response_name, @param_def)
end
end
class SOAPMethodResponse < SOAPMethod
def initialize(qname, param_def = nil)
super(qname, param_def)
@retval = nil
end
def retval
@retval
end
def retval=(retval)
@retval = retval
@retval.elename = @retval.elename.dup_name(@retval_name || 'return')
retval.parent = self
retval
end
def each
if @retval_name and !@retval.is_a?(SOAPVoid)
yield(@retval_name, @retval)
end
output_params.each do |name|
unless @outparam[name]
raise ParameterError.new("parameter: #{name} was not given")
end
yield(name, @outparam[name])
end
end
end
# To return(?) void explicitly.
# def foo(input_var)
# ...
# return SOAP::RPC::SOAPVoid.new
# end
class SOAPVoid < XSD::XSDAnySimpleType
include SOAPBasetype
extend SOAPModuleUtils
Name = XSD::QName.new(Mapping::RubyCustomTypeNamespace, nil)
public
def initialize()
@elename = Name
@id = nil
@precedents = []
@parent = nil
end
end
end
end

View file

@ -7,6 +7,7 @@
require 'logger' require 'logger'
require 'soap/attrproxy'
require 'soap/rpc/soaplet' require 'soap/rpc/soaplet'
require 'soap/streamHandler' require 'soap/streamHandler'
require 'webrick' require 'webrick'
@ -17,46 +18,15 @@ module RPC
class HTTPServer < Logger::Application class HTTPServer < Logger::Application
include AttrProxy
attr_reader :server attr_reader :server
attr_accessor :default_namespace attr_accessor :default_namespace
class << self attr_proxy :mapping_registry, true
if RUBY_VERSION >= "1.7.0" attr_proxy :literal_mapping_registry, true
def __attr_proxy(symbol, assignable = false) attr_proxy :generate_explicit_type, true
name = symbol.to_s attr_proxy :use_default_namespace, true
define_method(name) {
@router.__send__(name)
}
if assignable
aname = name + '='
define_method(aname) { |rhs|
@router.__send__(aname, rhs)
}
end
end
else
def __attr_proxy(symbol, assignable = false)
name = symbol.to_s
module_eval <<-EOS
def #{name}
@router.#{name}
end
EOS
if assignable
module_eval <<-EOS
def #{name}=(value)
@router.#{name} = value
end
EOS
end
end
end
end
__attr_proxy :mapping_registry, true
__attr_proxy :literal_mapping_registry, true
__attr_proxy :generate_explicit_type, true
__attr_proxy :use_default_namespace, true
def initialize(config) def initialize(config)
actor = config[:SOAPHTTPServerApplicationName] || self.class.name actor = config[:SOAPHTTPServerApplicationName] || self.class.name
@ -74,7 +44,6 @@ class HTTPServer < Logger::Application
if wsdldir = config[:WSDLDocumentDirectory] if wsdldir = config[:WSDLDocumentDirectory]
@server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir) @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir)
end end
# for backward compatibility
@server.mount('/', @soaplet) @server.mount('/', @soaplet)
end end
@ -107,7 +76,7 @@ class HTTPServer < Logger::Application
def add_rpc_servant(obj, namespace = @default_namespace) def add_rpc_servant(obj, namespace = @default_namespace)
@router.add_rpc_servant(obj, namespace) @router.add_rpc_servant(obj, namespace)
end end
def add_request_headerhandler(factory) def add_request_headerhandler(factory)
@router.add_request_headerhandler(factory) @router.add_request_headerhandler(factory)
end end
@ -159,6 +128,10 @@ class HTTPServer < Logger::Application
private private
def attrproxy
@router
end
def run def run
@server.start @server.start
end end

View file

@ -0,0 +1,68 @@
# SOAP4R - A method definition
# Copyright (C) 2000-2007 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.
module SOAP
module RPC
class MethodDef
attr_reader :name
attr_reader :soapaction
attr_reader :qname
attr_accessor :style
attr_accessor :inputuse
attr_accessor :outputuse
attr_reader :parameters
attr_reader :faults
def initialize(name, soapaction, qname)
@name = name
@soapaction = soapaction
@qname = qname
@style = @inputuse = @outputuse = nil
@parameters = []
@faults = {}
end
def add_parameter(io_type, name, qname, mapped_class)
@parameters << Parameter.new(io_type, name, qname, mapped_class)
end
def self.to_param(param)
if param.respond_to?(:io_type)
param
else
io_type, name, param_type = param
mapped_class_str, nsdef, namedef = param_type
if nsdef && namedef
qname = XSD::QName.new(nsdef, namedef)
else
qname = nil
end
MethodDef::Parameter.new(io_type.to_sym, name, qname, mapped_class_str)
end
end
class Parameter
attr_reader :io_type
attr_reader :name
attr_reader :qname
attr_reader :mapped_class
def initialize(io_type, name, qname, mapped_class)
@io_type = io_type
@name = name
@qname = qname
@mapped_class = mapped_class
end
end
end
end
end

View file

@ -56,7 +56,7 @@ public
# TODO: set to false by default or drop thie option in 1.6.0 # TODO: set to false by default or drop thie option in 1.6.0
@allow_unqualified_element = true @allow_unqualified_element = true
@default_encodingstyle = nil @default_encodingstyle = nil
@generate_explicit_type = true @generate_explicit_type = nil
@use_default_namespace = false @use_default_namespace = false
@return_response_as_xml = false @return_response_as_xml = false
@headerhandler = Header::HandlerSet.new @headerhandler = Header::HandlerSet.new
@ -140,6 +140,12 @@ public
:default_encodingstyle => :default_encodingstyle =>
@default_encodingstyle || op_info.response_default_encodingstyle @default_encodingstyle || op_info.response_default_encodingstyle
) )
if reqopt[:generate_explicit_type].nil?
reqopt[:generate_explicit_type] = (op_info.request_use == :encoded)
end
if resopt[:generate_explicit_type].nil?
resopt[:generate_explicit_type] = (op_info.response_use == :encoded)
end
env = route(req_header, req_body, reqopt, resopt) env = route(req_header, req_body, reqopt, resopt)
if op_info.response_use.nil? if op_info.response_use.nil?
return nil return nil
@ -169,15 +175,15 @@ public
if ext = reqopt[:external_content] if ext = reqopt[:external_content]
mime = MIMEMessage.new mime = MIMEMessage.new
ext.each do |k, v| ext.each do |k, v|
mime.add_attachment(v.data) mime.add_attachment(v.data)
end end
mime.add_part(conn_data.send_string + "\r\n") mime.add_part(conn_data.send_string + "\r\n")
mime.close mime.close
conn_data.send_string = mime.content_str conn_data.send_string = mime.content_str
conn_data.send_contenttype = mime.headers['content-type'].str conn_data.send_contenttype = mime.headers['content-type'].str
end end
conn_data = @streamhandler.send(@endpoint_url, conn_data, conn_data.soapaction = reqopt[:soapaction]
reqopt[:soapaction]) conn_data = @streamhandler.send(@endpoint_url, conn_data)
if conn_data.receive_string.empty? if conn_data.receive_string.empty?
return nil return nil
end end
@ -377,25 +383,17 @@ private
RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction) RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
else else
@doc_request_qnames = [] @doc_request_qnames = []
@doc_request_qualified = []
@doc_response_qnames = [] @doc_response_qnames = []
@doc_response_qualified = [] param_def.each do |param|
param_def.each do |inout, paramname, typeinfo, eleinfo| param = MethodDef.to_param(param)
klass_not_used, nsdef, namedef = typeinfo case param.io_type
qualified = eleinfo
if namedef.nil?
raise MethodDefinitionError.new("qname must be given")
end
case inout
when SOAPMethod::IN when SOAPMethod::IN
@doc_request_qnames << XSD::QName.new(nsdef, namedef) @doc_request_qnames << param.qname
@doc_request_qualified << qualified
when SOAPMethod::OUT when SOAPMethod::OUT
@doc_response_qnames << XSD::QName.new(nsdef, namedef) @doc_response_qnames << param.qname
@doc_response_qualified << qualified
else else
raise MethodDefinitionError.new( raise MethodDefinitionError.new(
"illegal inout definition for document style: #{inout}") "illegal inout definition for document style: #{param.io_type}")
end end
end end
end end
@ -490,7 +488,7 @@ private
params = {} params = {}
idx = 0 idx = 0
names.each do |name| names.each do |name|
params[name] = Mapping.obj2soap(values[idx], mapping_registry, params[name] = Mapping.obj2soap(values[idx], mapping_registry,
types[idx], opt) types[idx], opt)
params[name].elename = XSD::QName.new(nil, name) params[name].elename = XSD::QName.new(nil, name)
idx += 1 idx += 1
@ -503,7 +501,6 @@ private
(0...values.size).collect { |idx| (0...values.size).collect { |idx|
ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt) ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt)
ele.elename = @doc_request_qnames[idx] ele.elename = @doc_request_qnames[idx]
ele.qualified = @doc_request_qualified[idx]
ele ele
} }
end end
@ -513,7 +510,6 @@ private
ele = Mapping.obj2soap(values[idx], mapping_registry, ele = Mapping.obj2soap(values[idx], mapping_registry,
@doc_request_qnames[idx], opt) @doc_request_qnames[idx], opt)
ele.encodingstyle = LiteralNamespace ele.encodingstyle = LiteralNamespace
ele.qualified = @doc_request_qualified[idx]
ele ele
} }
end end

View file

@ -217,10 +217,10 @@ class Router
private private
def first_input_part_qname(param_def) def first_input_part_qname(param_def)
param_def.each do |inout, paramname, typeinfo| param_def.each do |param|
if inout == SOAPMethod::IN param = MethodDef.to_param(param)
klass, nsdef, namedef = typeinfo if param.io_type == SOAPMethod::IN
return XSD::QName.new(nsdef, namedef) return param.qname
end end
end end
nil nil
@ -423,22 +423,17 @@ private
@rpc_response_qname = opt[:response_qname] @rpc_response_qname = opt[:response_qname]
else else
@doc_request_qnames = [] @doc_request_qnames = []
@doc_request_qualified = []
@doc_response_qnames = [] @doc_response_qnames = []
@doc_response_qualified = [] param_def.each do |param|
param_def.each do |inout, paramname, typeinfo, eleinfo| param = MethodDef.to_param(param)
klass, nsdef, namedef = typeinfo case param.io_type
qualified = eleinfo
case inout
when SOAPMethod::IN when SOAPMethod::IN
@doc_request_qnames << XSD::QName.new(nsdef, namedef) @doc_request_qnames << param.qname
@doc_request_qualified << qualified
when SOAPMethod::OUT when SOAPMethod::OUT
@doc_response_qnames << XSD::QName.new(nsdef, namedef) @doc_response_qnames << param.qname
@doc_response_qualified << qualified
else else
raise ArgumentError.new( raise ArgumentError.new(
"illegal inout definition for document style: #{inout}") "illegal inout definition for document style: #{param.io_type}")
end end
end end
end end
@ -605,7 +600,6 @@ private
(0...result.size).collect { |idx| (0...result.size).collect { |idx|
ele = Mapping.obj2soap(result[idx], mapping_registry, nil, opt) ele = Mapping.obj2soap(result[idx], mapping_registry, nil, opt)
ele.elename = @doc_response_qnames[idx] ele.elename = @doc_response_qnames[idx]
ele.qualified = @doc_response_qualified[idx]
ele ele
} }
end end
@ -615,7 +609,6 @@ private
ele = Mapping.obj2soap(result[idx], mapping_registry, ele = Mapping.obj2soap(result[idx], mapping_registry,
@doc_response_qnames[idx]) @doc_response_qnames[idx])
ele.encodingstyle = LiteralNamespace ele.encodingstyle = LiteralNamespace
ele.qualified = @doc_response_qualified[idx]
ele ele
} }
end end

View file

@ -50,16 +50,6 @@ public
@config = {} @config = {}
end end
# for backward compatibility
def app_scope_router
@router
end
# for backward compatibility
def add_servant(obj, namespace)
@router.add_rpc_servant(obj, namespace)
end
def allow_content_encoding_gzip=(allow) def allow_content_encoding_gzip=(allow)
@options[:allow_content_encoding_gzip] = allow @options[:allow_content_encoding_gzip] = allow
end end

View file

@ -14,7 +14,7 @@ module RPC
class StandaloneServer < HTTPServer class StandaloneServer < HTTPServer
def initialize(appname, default_namespace, host = "0.0.0.0", port = 8080) def initialize(appname, default_namespace, host = "0.0.0.0", port = 8089)
@appname = appname @appname = appname
@default_namespace = default_namespace @default_namespace = default_namespace
@host = host @host = host

View file

@ -1,9 +0,0 @@
# SOAP4R - RPC Routing library
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -1,9 +0,0 @@
# SOAP4R - RPC utility.
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -1,9 +1,13 @@
# SOAP4R - CGI stub library # SOAP4R - Extensions for Ruby 1.8.X compatibility
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can # 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; # 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. # either the dual license version in 2003, or any later version.
unless RUBY_VERSION >= "1.9.0"
require 'soap/compat' class Hash
def key(value)
index(value)
end
end
end

View file

@ -1,9 +0,0 @@
# SOAP4R - Server implementation
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -5,7 +5,7 @@
# redistribute it and/or modify it under the same terms of Ruby's license; # 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. # either the dual license version in 2003, or any later version.
require 'soap/ruby18ext'
require 'xsd/qname' require 'xsd/qname'
require 'xsd/charset' require 'xsd/charset'
require 'soap/nestedexception' require 'soap/nestedexception'
@ -14,7 +14,7 @@ require 'soap/nestedexception'
module SOAP module SOAP
VERSION = Version = '1.5.8' VERSION = Version = '1.6.1-SNAPSHOT'
PropertyName = 'soap/property' PropertyName = 'soap/property'
EnvelopeNamespace = 'http://schemas.xmlsoap.org/soap/envelope/' EnvelopeNamespace = 'http://schemas.xmlsoap.org/soap/envelope/'

View file

@ -1,9 +0,0 @@
# SOAP4R - Standalone Server
# Copyright (C) 2000-2007 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 'soap/compat'

View file

@ -130,10 +130,10 @@ class HTTPStreamHandler < StreamHandler
end end
public public
attr_reader :client attr_reader :client
attr_accessor :wiredump_file_base attr_accessor :wiredump_file_base
MAX_RETRY_COUNT = 10 # [times] MAX_RETRY_COUNT = 10 # [times]
def self.create(options) def self.create(options)
@ -167,8 +167,7 @@ public
"#<#{self.class}>" "#<#{self.class}>"
end end
def send(url, conn_data, soapaction = nil, charset = @charset) def send(url, conn_data, charset = @charset)
conn_data.soapaction ||= soapaction # for backward conpatibility
conn_data = send_post(url, conn_data, charset) conn_data = send_post(url, conn_data, charset)
@client.save_cookie_store if @cookie_store @client.save_cookie_store if @cookie_store
conn_data conn_data

View file

@ -5,11 +5,12 @@
# redistribute it and/or modify it under the same terms of Ruby's license; # 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. # either the dual license version in 2003, or any later version.
require 'soap/ruby18ext'
require 'wsdl/parser' require 'wsdl/parser'
require 'wsdl/importer' require 'wsdl/importer'
require 'xsd/qname' require 'xsd/qname'
require 'xsd/codegen/gensupport' require 'xsd/codegen/gensupport'
require 'soap/attrproxy'
require 'soap/mapping/wsdlencodedregistry' require 'soap/mapping/wsdlencodedregistry'
require 'soap/mapping/wsdlliteralregistry' require 'soap/mapping/wsdlliteralregistry'
require 'soap/rpc/driver' require 'soap/rpc/driver'
@ -30,12 +31,8 @@ class WSDLDriverFactory
def initialize(wsdl) def initialize(wsdl)
@wsdl = import(wsdl) @wsdl = import(wsdl)
name_creator = WSDL::SOAP::ClassNameCreator.new
@modulepath = 'WSDLDriverFactory'
@methoddefcreator =
WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, @modulepath, {})
end end
def inspect def inspect
sprintf("#<%s:%s:0x%x\n\n%s>", self.class.name, @wsdl.name, __id__, dump_method_signatures) sprintf("#<%s:%s:0x%x\n\n%s>", self.class.name, @wsdl.name, __id__, dump_method_signatures)
end end
@ -43,21 +40,13 @@ class WSDLDriverFactory
def create_rpc_driver(servicename = nil, portname = nil) def create_rpc_driver(servicename = nil, portname = nil)
port = find_port(servicename, portname) port = find_port(servicename, portname)
drv = SOAP::RPC::Driver.new(port.soap_address.location) drv = SOAP::RPC::Driver.new(port.soap_address.location)
init_driver(drv, port) if binding = port.find_binding
add_operation(drv, port) init_driver(drv, binding)
add_operation(drv, binding)
end
drv drv
end end
# deprecated old interface
def create_driver(servicename = nil, portname = nil)
warn("WSDLDriverFactory#create_driver is deprecated. Use create_rpc_driver instead.")
port = find_port(servicename, portname)
WSDLDriver.new(@wsdl, port, nil)
end
# Backward compatibility.
alias createDriver create_driver
def dump_method_signatures(servicename = nil, portname = nil) def dump_method_signatures(servicename = nil, portname = nil)
targetservice = XSD::QName.new(@wsdl.targetnamespace, servicename) if servicename targetservice = XSD::QName.new(@wsdl.targetnamespace, servicename) if servicename
targetport = XSD::QName.new(@wsdl.targetnamespace, portname) if portname targetport = XSD::QName.new(@wsdl.targetnamespace, portname) if portname
@ -67,9 +56,18 @@ class WSDLDriverFactory
next if targetservice and service.name != targetservice next if targetservice and service.name != targetservice
service.ports.each do |port| service.ports.each do |port|
next if targetport and port.name != targetport next if targetport and port.name != targetport
sig << port.porttype.operations.collect { |operation| if porttype = port.porttype
dump_method_signature(operation, element_definitions).gsub(/^#/, ' ') assigned_method = collect_assigned_method(porttype.name)
}.join("\n") if binding = port.porttype.find_binding
sig << binding.operations.collect { |op_bind|
operation = op_bind.find_operation
name = assigned_method[op_bind.boundid] || op_bind.name
str = "= #{safemethodname(name)}\n\n"
str << dump_method_signature(name, operation, element_definitions)
str.gsub(/^#/, " ")
}.join("\n")
end
end
end end
end end
sig.join("\n") sig.join("\n")
@ -77,6 +75,14 @@ class WSDLDriverFactory
private private
def collect_assigned_method(porttypename)
name_creator = WSDL::SOAP::ClassNameCreator.new
methoddefcreator =
WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, nil, {})
methoddefcreator.dump(porttypename)
methoddefcreator.assigned_method
end
def find_port(servicename = nil, portname = nil) def find_port(servicename = nil, portname = nil)
service = port = nil service = port = nil
if servicename if servicename
@ -105,35 +111,42 @@ private
port port
end end
def init_driver(drv, port) def init_driver(drv, binding)
wsdl_elements = @wsdl.collect_elements wsdl_elements = @wsdl.collect_elements
wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
rpc_decode_typemap = wsdl_types + rpc_decode_typemap = wsdl_types +
@wsdl.soap_rpc_complextypes(port.find_binding) @wsdl.soap_rpc_complextypes(binding)
drv.proxy.mapping_registry = drv.proxy.mapping_registry =
Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap) Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap)
drv.proxy.literal_mapping_registry = drv.proxy.literal_mapping_registry =
Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements) Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements)
end end
def add_operation(drv, port) def add_operation(drv, binding)
port.find_binding.operations.each do |op_bind| name_creator = WSDL::SOAP::ClassNameCreator.new
op_name = op_bind.soapoperation_name modulepath = 'WSDLDriverFactory'
soapaction = op_bind.soapaction || '' methoddefcreator =
orgname = op_name.name WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, modulepath, {})
name = XSD::CodeGen::GenSupport.safemethodname(orgname) mdefs = methoddefcreator.create(binding.name)
param_def = create_param_def(op_bind) if mdefs.nil?
raise FactoryError.new("no method definition found in WSDL")
end
mdefs.each do |mdef|
opt = { opt = {
:request_style => op_bind.soapoperation_style, :request_style => mdef.style,
:response_style => op_bind.soapoperation_style, :response_style => mdef.style,
:request_use => op_bind.soapbody_use_input, :request_use => mdef.inputuse,
:response_use => op_bind.soapbody_use_output :response_use => mdef.outputuse
} }
if op_bind.soapoperation_style == :rpc qname = mdef.qname
drv.add_rpc_operation(op_name, soapaction, name, param_def, opt) soapaction = mdef.soapaction
name = mdef.name
if mdef.style == :rpc
drv.add_rpc_operation(qname, soapaction, name, mdef.parameters, opt)
else else
drv.add_document_operation(soapaction, name, param_def, opt) drv.add_document_operation(soapaction, name, mdef.parameters, opt)
end end
orgname = mdef.qname.name
if orgname != name and orgname.capitalize == name.capitalize if orgname != name and orgname.capitalize == name.capitalize
::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg| ::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg|
__send__(name, *arg) __send__(name, *arg)
@ -145,452 +158,6 @@ private
def import(location) def import(location)
WSDL::Importer.import(location) WSDL::Importer.import(location)
end 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_type, name, param_type|
[io_type, name, ::SOAP::RPC::SOAPMethod.parse_param_type(param_type)]
}
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
if RUBY_VERSION >= "1.7.0"
def __attr_proxy(symbol, assignable = false)
name = symbol.to_s
define_method(name) {
@servant.__send__(name)
}
if assignable
aname = name + '='
define_method(aname) { |rhs|
@servant.__send__(aname, 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
__attr_proxy :options
__attr_proxy :headerhandler
__attr_proxy :streamhandler
__attr_proxy :test_loopback_response
__attr_proxy :endpoint_url, true
__attr_proxy :mapping_registry, true # for RPC unmarshal
__attr_proxy :wsdl_mapping_registry, true # for RPC marshal
__attr_proxy :default_encodingstyle, true
__attr_proxy :generate_explicit_type, true
__attr_proxy :allow_unqualified_element, true
def httpproxy
@servant.options["protocol.http.proxy"]
end
def httpproxy=(httpproxy)
@servant.options["protocol.http.proxy"] = httpproxy
end
def wiredump_dev
@servant.options["protocol.http.wiredump_dev"]
end
def wiredump_dev=(wiredump_dev)
@servant.options["protocol.http.wiredump_dev"] = wiredump_dev
end
def mandatorycharset
@servant.options["protocol.mandatorycharset"]
end
def mandatorycharset=(mandatorycharset)
@servant.options["protocol.mandatorycharset"] = mandatorycharset
end
def wiredump_file_base
@servant.options["protocol.wiredump_file_base"]
end
def wiredump_file_base=(wiredump_file_base)
@servant.options["protocol.wiredump_file_base"] = wiredump_file_base
end
def initialize(wsdl, port, logdev)
@servant = Servant__.new(self, wsdl, port, logdev)
end
def inspect
"#<#{self.class}:#{@servant.port.name}>"
end
def reset_stream
@servant.reset_stream
end
# Backward compatibility.
alias generateEncodeType= generate_explicit_type=
class Servant__
include SOAP
attr_reader :options
attr_reader :port
attr_accessor :soapaction
attr_accessor :default_encodingstyle
attr_accessor :allow_unqualified_element
attr_accessor :generate_explicit_type
attr_accessor :mapping_registry
attr_accessor :wsdl_mapping_registry
def initialize(host, wsdl, port, logdev)
@host = host
@wsdl = wsdl
@port = port
@logdev = logdev
@soapaction = nil
@options = setup_options
@default_encodingstyle = nil
@allow_unqualified_element = nil
@generate_explicit_type = false
@mapping_registry = nil # for rpc unmarshal
@wsdl_mapping_registry = nil # for rpc marshal
@wiredump_file_base = nil
@mandatorycharset = nil
@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)
@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 = {}
@port.inputoperation_map.each do |op_name, op_info|
orgname = op_name.name
name = XSD::CodeGen::GenSupport.safemethodname(orgname)
@operation[name] = @operation[orgname] = op_info
add_method_interface(op_info)
end
@proxy = ::SOAP::RPC::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 headerhandler
@proxy.headerhandler
end
def streamhandler
@proxy.streamhandler
end
def test_loopback_response
@proxy.test_loopback_response
end
def reset_stream
@proxy.reset_stream
end
def rpc_call(name, *values)
set_wiredump_file_base(name)
unless op_info = @operation[name]
raise RuntimeError, "method: #{name} not defined"
end
req_header = create_request_header
req_body = create_request_body(op_info, *values)
reqopt = create_options({
:soapaction => op_info.soapaction || @soapaction})
resopt = create_options({
:decode_typemap => @rpc_decode_typemap})
env = @proxy.route(req_header, req_body, reqopt, resopt)
raise EmptyResponseError unless env
receive_headers(env.header)
begin
@proxy.check_fault(env.body)
rescue ::SOAP::FaultError => e
Mapping.fault2exception(e)
end
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)
}
return [ret].concat(outparams)
else
return ret
end
end
# req_header: [[element, mustunderstand, encodingstyle(QName/String)], ...]
# req_body: SOAPBasetype/SOAPCompoundtype
def document_send(name, header_obj, body_obj)
set_wiredump_file_base(name)
unless op_info = @operation[name]
raise RuntimeError, "method: #{name} not defined"
end
req_header = header_obj ? header_from_obj(header_obj, op_info) : nil
req_body = body_from_obj(body_obj, op_info)
opt = create_options({
:soapaction => op_info.soapaction || @soapaction,
:decode_typemap => @wsdl_types})
env = @proxy.invoke(req_header, req_body, opt)
raise EmptyResponseError 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
private
def create_options(hash = nil)
opt = {}
opt[:default_encodingstyle] = @default_encodingstyle
opt[:allow_unqualified_element] = @allow_unqualified_element
opt[:generate_explicit_type] = @generate_explicit_type
opt.update(hash) if hash
opt
end
def set_wiredump_file_base(name)
if @wiredump_file_base
@proxy.set_wiredump_file_base(@wiredump_file_base + "_#{name}")
end
end
def create_request_header
header = SOAPHeader.new
items = @proxy.headerhandler.on_outbound(header)
items.each do |item|
header.add(item.elename.name, item)
end
header
end
def receive_headers(header)
@proxy.headerhandler.on_inbound(header) if header
end
def create_request_body(op_info, *values)
method = create_method_struct(op_info, *values)
SOAPBody.new(method)
end
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.op_name)
if method.members.size != parts_names.size
new_method = SOAPStruct.new
method.each do |key, value|
if parts_names.include?(key)
new_method.add(key, value)
end
end
method = new_method
end
method.elename = op_info.op_name
method.type = XSD::QName.new # Request should not be typed.
method
end
def create_method_obj(names, params)
o = Object.new
idx = 0
while idx < params.length
o.instance_variable_set('@' + names[idx], params[idx])
idx += 1
end
o
end
def header_from_obj(obj, op_info)
if obj.is_a?(SOAPHeader)
obj
elsif op_info.headerparts.empty?
if obj.nil?
nil
else
raise RuntimeError.new("no header definition in schema: #{obj}")
end
elsif op_info.headerparts.size == 1
part = op_info.headerparts[0]
header = SOAPHeader.new()
header.add(headeritem_from_obj(obj, part.element || part.eletype))
header
else
header = SOAPHeader.new()
op_info.headerparts.each do |part|
child = Mapping.get_attribute(obj, part.name)
ele = headeritem_from_obj(child, part.element || part.eletype)
header.add(part.name, ele)
end
header
end
end
def headeritem_from_obj(obj, name)
if obj.nil?
SOAPElement.new(name)
elsif obj.is_a?(SOAPHeaderItem)
obj
else
Mapping.obj2soap(obj, @doc_mapper, name)
end
end
def body_from_obj(obj, op_info)
if obj.is_a?(SOAPBody)
obj
elsif op_info.bodyparts.empty?
if obj.nil?
nil
else
raise RuntimeError.new("no body found in schema")
end
elsif op_info.bodyparts.size == 1
part = op_info.bodyparts[0]
ele = bodyitem_from_obj(obj, part.element || part.type)
SOAPBody.new(ele)
else
body = SOAPBody.new
op_info.bodyparts.each do |part|
child = Mapping.get_attribute(obj, part.name)
ele = bodyitem_from_obj(child, part.element || part.type)
body.add(ele.elename.name, ele)
end
body
end
end
def bodyitem_from_obj(obj, name)
if obj.nil?
SOAPElement.new(name)
elsif obj.is_a?(SOAPElement)
obj
else
Mapping.obj2soap(obj, @doc_mapper, name)
end
end
def add_method_interface(op_info)
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
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
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}")
end
end
def add_rpc_method_interface(name, parts_names)
param_count = parts_names.size
@host.instance_eval <<-EOS
def #{name}(*arg)
unless arg.size == #{param_count}
raise ArgumentError.new(
"wrong number of arguments (\#{arg.size} for #{param_count})")
end
@servant.rpc_call(#{name.dump}, *arg)
end
EOS
@host.method(name)
end
def add_document_method_interface(name, parts_names)
@host.instance_eval <<-EOS
def #{name}(h, b)
@servant.document_send(#{name.dump}, h, b)
end
EOS
@host.method(name)
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|
@mandatorycharset = value
end
opt.add_hook("protocol.wiredump_file_base") do |key, value|
@wiredump_file_base = value
end
opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label
opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
opt
end
end
end end

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,7 @@ class Info
end end
def parse_element(element); end # abstract def parse_element(element); end # abstract
def parse_attr(attr, value); end # abstract def parse_attr(attr, value); end # abstract
def parse_epilogue; end # abstract def parse_epilogue; end # abstract

View file

@ -13,17 +13,6 @@ module WSDL
class Operation < Info class Operation < Info
class NameInfo
attr_reader :op_name
attr_reader :optype_name
attr_reader :parts
def initialize(op_name, optype_name, parts)
@op_name = op_name
@optype_name = optype_name
@parts = parts
end
end
attr_reader :name # required attr_reader :name # required
attr_reader :parameter_order # optional attr_reader :parameter_order # optional
attr_reader :input attr_reader :input
@ -49,25 +38,8 @@ class Operation < Info
as_operationname(@name) as_operationname(@name)
end end
def input_info
if message = input_message
typename = message.name
else
typename = nil
end
NameInfo.new(operationname, typename, inputparts)
end
def output_info
if message = output_message
typename = message.name
else
typename = nil
end
NameInfo.new(operationname, typename, outputparts)
end
EMPTY = [].freeze EMPTY = [].freeze
# TODO: remove once after OperationInfo created
def inputparts def inputparts
if message = input_message if message = input_message
sort_parts(message.parts) sort_parts(message.parts)
@ -84,6 +56,7 @@ class Operation < Info
end end
end end
# TODO: remove once after OperationInfo created
def outputparts def outputparts
if message = output_message if message = output_message
sort_parts(message.parts) sort_parts(message.parts)

View file

@ -19,6 +19,62 @@ class OperationBinding < Info
attr_reader :fault attr_reader :fault
attr_reader :soapoperation attr_reader :soapoperation
class OperationInfo
attr_reader :boundid
attr_reader :qname
attr_reader :style
attr_accessor :inputuse
attr_accessor :outputuse
attr_reader :parts
attr_reader :faults
def initialize(boundid, qname, style, inputuse, outputuse)
@boundid = boundid
@qname = qname
@style = style
@inputuse = inputuse
@outputuse = outputuse
@parts = []
@faults = {}
end
end
class Part
attr_reader :io_type
attr_reader :name
attr_reader :type
attr_reader :element
def initialize(io_type, name, type, element)
@io_type = io_type
@name = name
@type = type
@element = element
end
end
class BoundId
attr_reader :name
attr_reader :soapaction
def initialize(name, soapaction)
@name = name
@soapaction = soapaction
end
def ==(rhs)
!rhs.nil? and @name == rhs.name and @soapaction == rhs.soapaction
end
def eql?(rhs)
(self == rhs)
end
def hash
@name.hash ^ @soapaction.hash
end
end
def initialize def initialize
super super
@name = nil @name = nil
@ -28,6 +84,32 @@ class OperationBinding < Info
@soapoperation = nil @soapoperation = nil
end end
def operation_info
qname = soapoperation_name()
style = soapoperation_style()
use_input = soapbody_use(@input)
use_output = soapbody_use(@output)
info = OperationInfo.new(boundid, qname, style, use_input, use_output)
op = find_operation()
if style == :rpc
info.parts.concat(collect_rpcparameter(op))
else
info.parts.concat(collect_documentparameter(op))
end
@fault.each do |fault|
op_fault = {}
soapfault = fault.soapfault
next if soapfault.nil?
op_fault[:ns] = fault.name.namespace
op_fault[:name] = fault.name.name
op_fault[:namespace] = soapfault.namespace
op_fault[:use] = soapfault.use || "literal"
op_fault[:encodingstyle] = soapfault.encodingstyle || "document"
info.faults[fault.name] = op_fault
end
info
end
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
@ -36,6 +118,10 @@ class OperationBinding < Info
root.porttype(parent.type) root.porttype(parent.type)
end end
def boundid
BoundId.new(name, soapaction)
end
def find_operation def find_operation
porttype.operations.each do |op| porttype.operations.each do |op|
next if op.name != @name next if op.name != @name
@ -68,14 +154,6 @@ class OperationBinding < Info
style || :document style || :document
end end
def soapbody_use_input
soapbody_use(@input)
end
def soapbody_use_output
soapbody_use(@output)
end
def soapaction def soapaction
if @soapoperation if @soapoperation
@soapoperation.soapaction @soapoperation.soapaction
@ -124,6 +202,38 @@ private
def soapbody_use(param) def soapbody_use(param)
param ? param.soapbody_use : nil param ? param.soapbody_use : nil
end end
def collect_rpcparameter(operation)
result = operation.inputparts.collect { |part|
Part.new(:in, part.name, part.type, part.element)
}
outparts = operation.outputparts
if outparts.size > 0
retval = outparts[0]
result << Part.new(:retval, retval.name, retval.type, retval.element)
cdr(outparts).each { |part|
result << Part.new(:out, part.name, part.type, part.element)
}
end
result
end
def collect_documentparameter(operation)
param = []
operation.inputparts.each do |input|
param << Part.new(:in, input.name, input.type, input.element)
end
operation.outputparts.each do |output|
param << Part.new(:out, output.name, output.type, output.element)
end
param
end
def cdr(ary)
result = ary.dup
result.shift
result
end
end end

View file

@ -113,10 +113,10 @@ private
elename = ns.parse(name) elename = ns.parse(name)
if !parent if !parent
if elename == DefinitionsName if elename == DefinitionsName
o = Definitions.parse_element(elename) o = Definitions.parse_element(elename)
o.location = @location o.location = @location
else else
raise UnknownElementError.new("unknown element: #{elename}") raise UnknownElementError.new("unknown element: #{elename}")
end end
o.root = @originalroot if @originalroot # o.root = o otherwise o.root = @originalroot if @originalroot # o.root = o otherwise
else else
@ -128,10 +128,10 @@ private
end end
if o.nil? if o.nil?
unless @ignored.key?(elename) unless @ignored.key?(elename)
warn("ignored element: #{elename}") warn("ignored element: #{elename} : #{parent.inspect}")
@ignored[elename] = elename @ignored[elename] = elename
end end
o = Documentation.new # which accepts any element. o = Documentation.new # which accepts any element.
end end
# node could be a pseudo element. pseudo element has its own parent. # node could be a pseudo element. pseudo element has its own parent.
o.root = parent.root o.root = parent.root

View file

@ -36,24 +36,6 @@ class Port < Info
root.binding(@binding) or raise RuntimeError.new("#{@binding} not found") root.binding(@binding) or raise RuntimeError.new("#{@binding} not found")
end end
def inputoperation_map
result = {}
find_binding.operations.each do |op_bind|
op_info = op_bind.soapoperation.input_info
result[op_info.op_name] = op_info
end
result
end
def outputoperation_map
result = {}
find_binding.operations.each do |op_bind|
op_info = op_bind.soapoperation.output_info
result[op_info.op_name] = op_info
end
result
end
def parse_element(element) def parse_element(element)
case element case element
when SOAPAddressName when SOAPAddressName

View file

@ -49,8 +49,7 @@ private
def dump_porttype(porttype) def dump_porttype(porttype)
class_name = mapped_class_name(porttype.name, @modulepath) class_name = mapped_class_name(porttype.name, @modulepath)
defined_const = {} defined_const = {}
result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
methoddef = result[:methoddef]
wsdl_name = @definitions.name ? @definitions.name.name : 'default' wsdl_name = @definitions.name ? @definitions.name.name : 'default'
mrname = safeconstname(wsdl_name + 'MappingRegistry') mrname = safeconstname(wsdl_name + 'MappingRegistry')
c1 = XSD::CodeGen::ClassDef.new(class_name) c1 = XSD::CodeGen::ClassDef.new(class_name)

View file

@ -49,34 +49,30 @@ class ClassDefCreator
result << modulepath_split(@modulepath).collect { |ele| "module #{ele}" }.join("; ") result << modulepath_split(@modulepath).collect { |ele| "module #{ele}" }.join("; ")
result << "\n\n" result << "\n\n"
end end
if type str = dump_group(type)
result << dump_classdef(type.name, type) unless str.empty?
else result << "\n" unless result.empty?
str = dump_group result << str
unless str.empty? end
result << "\n" unless result.empty? str = dump_complextype(type)
result << str unless str.empty?
end result << "\n" unless result.empty?
str = dump_complextype result << str
unless str.empty? end
result << "\n" unless result.empty? str = dump_simpletype(type)
result << str unless str.empty?
end result << "\n" unless result.empty?
str = dump_simpletype result << str
unless str.empty? end
result << "\n" unless result.empty? str = dump_element(type)
result << str unless str.empty?
end result << "\n" unless result.empty?
str = dump_element result << str
unless str.empty? end
result << "\n" unless result.empty? str = dump_attribute(type)
result << str unless str.empty?
end result << "\n" unless result.empty?
str = dump_attribute result << str
unless str.empty?
result << "\n" unless result.empty?
result << str
end
end end
if @modulepath if @modulepath
result << "\n\n" result << "\n\n"
@ -88,16 +84,18 @@ class ClassDefCreator
private private
def dump_element def dump_element(target = nil)
@elements.collect { |ele| @elements.collect { |ele|
next if @complextypes[ele.name] next if @complextypes[ele.name]
next if target and target != ele.name
c = create_elementdef(@modulepath, ele) c = create_elementdef(@modulepath, ele)
c ? c.dump : nil c ? c.dump : nil
}.compact.join("\n") }.compact.join("\n")
end end
def dump_attribute def dump_attribute(target = nil)
@attributes.collect { |attribute| @attributes.collect { |attribute|
next if target and target != attribute.name
if attribute.local_simpletype if attribute.local_simpletype
c = create_simpletypedef(@modulepath, attribute.name, attribute.local_simpletype) c = create_simpletypedef(@modulepath, attribute.name, attribute.local_simpletype)
end end
@ -105,21 +103,23 @@ private
}.compact.join("\n") }.compact.join("\n")
end end
def dump_simpletype def dump_simpletype(target = nil)
@simpletypes.collect { |type| @simpletypes.collect { |type|
next if target and target != type.name
c = create_simpletypedef(@modulepath, type.name, type) c = create_simpletypedef(@modulepath, type.name, type)
c ? c.dump : nil c ? c.dump : nil
}.compact.join("\n") }.compact.join("\n")
end end
def dump_complextype def dump_complextype(target = nil)
definitions = sort_dependency(@complextypes).collect { |type| definitions = sort_dependency(@complextypes).collect { |type|
next if target and target != type.name
c = create_complextypedef(@modulepath, type.name, type) c = create_complextypedef(@modulepath, type.name, type)
c ? c.dump : nil c ? c.dump : nil
}.compact.join("\n") }.compact.join("\n")
end end
def dump_group def dump_group(target = nil)
definitions = @modelgroups.collect { |group| definitions = @modelgroups.collect { |group|
# TODO: not dumped for now but may be useful in the future # TODO: not dumped for now but may be useful in the future
}.compact.join("\n") }.compact.join("\n")
@ -216,7 +216,7 @@ private
if (const[constname] += 1) > 1 if (const[constname] += 1) > 1
constname += "_#{const[constname]}" constname += "_#{const[constname]}"
end end
c.def_const(constname, "#{classname}.new(#{ndq(value)})") c.def_const(constname, "new(#{ndq(value)})")
end end
end end

View file

@ -33,15 +33,15 @@ module ClassDefCreatorSupport
::SOAP::TypeMap[name] ::SOAP::TypeMap[name]
end end
def dump_method_signature(operation, element_definitions) def dump_method_signature(name, operation, element_definitions)
name = operation.name methodname = safemethodname(name)
input = operation.input input = operation.input
output = operation.output output = operation.output
fault = operation.fault fault = operation.fault
signature = "#{ name }#{ dump_inputparam(input) }" signature = "#{methodname}#{dump_inputparam(input)}"
str = <<__EOD__ str = <<__EOD__
# SYNOPSIS # SYNOPSIS
# #{name}#{dump_inputparam(input)} # #{methodname}#{dump_inputparam(input)}
# #
# ARGS # ARGS
#{dump_inout_type(input, element_definitions).chomp} #{dump_inout_type(input, element_definitions).chomp}
@ -213,16 +213,26 @@ private
end end
def name_element(element) def name_element(element)
return element.name if element.name return element.name if element.name
return element.ref if element.ref return element.ref if element.ref
raise RuntimeError.new("cannot define name of #{element}") raise RuntimeError.new("cannot define name of #{element}")
end end
def name_attribute(attribute) def name_attribute(attribute)
return attribute.name if attribute.name return attribute.name if attribute.name
return attribute.ref if attribute.ref return attribute.ref if attribute.ref
raise RuntimeError.new("cannot define name of #{attribute}") raise RuntimeError.new("cannot define name of #{attribute}")
end end
# TODO: run MethodDefCreator just once in 1.6.X.
# MethodDefCreator should return parsed struct, not a String.
def collect_assigned_method(wsdl, porttypename, modulepath = nil)
name_creator = WSDL::SOAP::ClassNameCreator.new
methoddefcreator =
WSDL::SOAP::MethodDefCreator.new(wsdl, name_creator, modulepath, {})
methoddefcreator.dump(porttypename)
methoddefcreator.assigned_method
end
end end

View file

@ -51,6 +51,7 @@ class ClientSkeltonCreator
private private
def dump_porttype(porttype) def dump_porttype(porttype)
assigned_method = collect_assigned_method(@definitions, porttype.name, @modulepath)
drv_name = mapped_class_basename(porttype.name, @modulepath) drv_name = mapped_class_basename(porttype.name, @modulepath)
result = "" result = ""
@ -63,16 +64,24 @@ obj.wiredump_dev = STDERR if $DEBUG
__EOD__ __EOD__
element_definitions = @definitions.collect_elements element_definitions = @definitions.collect_elements
porttype.operations.each do |operation| binding = porttype.find_binding
result << dump_method_signature(operation, element_definitions) if binding
result << dump_input_init(operation.input) << "\n" binding.operations.each do |op_bind|
result << dump_operation(operation) << "\n\n" operation = op_bind.find_operation
if operation.nil?
warn("operation not found for binding: #{op_bind}")
next
end
name = assigned_method[op_bind.boundid] || operation.name
result << dump_method_signature(name, operation, element_definitions)
result << dump_input_init(operation.input) << "\n"
result << dump_operation(name, operation) << "\n\n"
end
end end
result result
end end
def dump_operation(operation) def dump_operation(name, operation)
name = operation.name
input = operation.input input = operation.input
"puts obj.#{ safemethodname(name) }#{ dump_inputparam(input) }" "puts obj.#{ safemethodname(name) }#{ dump_inputparam(input) }"
end end

View file

@ -73,9 +73,9 @@ class ComplexType < Info
case compoundtype case compoundtype
when :TYPE_STRUCT, :TYPE_MAP when :TYPE_STRUCT, :TYPE_MAP
unless ele = find_element(name) unless ele = find_element(name)
if name.namespace.nil? if name.namespace.nil?
ele = find_element_by_name(name.name) ele = find_element_by_name(name.name)
end end
end end
when :TYPE_ARRAY when :TYPE_ARRAY
e = elements e = elements
@ -106,6 +106,7 @@ class ComplexType < Info
end end
end end
end end
nil
end end
def find_arytype def find_arytype
@ -137,7 +138,7 @@ private
case element case element
when XMLSchema::Element when XMLSchema::Element
if element.type if element.type
element.type element.type
elsif element.local_simpletype elsif element.local_simpletype
element.local_simpletype.base element.local_simpletype.base
else else

View file

@ -41,10 +41,10 @@ class Definitions < Info
=begin =begin
<xs:complexType name="Fault" final="extension"> <xs:complexType name="Fault" final="extension">
<xs:sequence> <xs:sequence>
<xs:element name="faultcode" type="xs:QName" /> <xs:element name="faultcode" type="xs:QName" />
<xs:element name="faultstring" type="xs:string" /> <xs:element name="faultstring" type="xs:string" />
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0" /> <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
<xs:element name="detail" type="tns:detail" minOccurs="0" /> <xs:element name="detail" type="tns:detail" minOccurs="0" />
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
=end =end
@ -85,7 +85,7 @@ class Definitions < Info
raise RuntimeError.new("Expecting fault message \"#{name}\" to have ONE part") raise RuntimeError.new("Expecting fault message \"#{name}\" to have ONE part")
end end
fault_part = faultparts[0] fault_part = faultparts[0]
# WS-I Basic Profile Version 1.1 (R2205) requires fault message parts # WS-I Basic Profile Version 1.1 (R2205) requires fault message parts
# to refer to elements rather than types # to refer to elements rather than types
faulttype = fault_part.element faulttype = fault_part.element
if not faulttype if not faulttype
@ -129,7 +129,7 @@ private
# Make sure that portType fault has a corresponding soap:fault # Make sure that portType fault has a corresponding soap:fault
# definition in binding section. # definition in binding section.
if not op_binding_declares_fault(op_binding, fault.name) if not op_binding_declares_fault(op_binding, fault.name)
warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": no corresponding wsdl:fault binding found with a matching \"name\" attribute") warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": no corresponding wsdl:fault binding found with a matching \"name\" attribute")
next next
end end
fault_binding = get_fault_binding(op_binding, fault.name) fault_binding = get_fault_binding(op_binding, fault.name)
@ -142,10 +142,10 @@ private
next next
end end
# According to WS-I (R2723): if in a wsdl:binding the use attribute # According to WS-I (R2723): if in a wsdl:binding the use attribute
# on a contained soapbind:fault element is present, its value MUST # on a contained soapbind:fault element is present, its value MUST
# be "literal". # be "literal".
if fault_binding.soapfault.use and fault_binding.soapfault.use != "literal" if fault_binding.soapfault.use and fault_binding.soapfault.use != "literal"
warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": soap:fault \"use\" attribute must be \"literal\"") warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": soap:fault \"use\" attribute must be \"literal\"")
end end
if result.index(fault.message).nil? if result.index(fault.message).nil?
result << fault.message result << fault.message

View file

@ -62,11 +62,11 @@ private
qname = XSD::QName.new(porttype.namespace, drivername) qname = XSD::QName.new(porttype.namespace, drivername)
class_name = mapped_class_basename(qname, @modulepath) class_name = mapped_class_basename(qname, @modulepath)
defined_const = {} defined_const = {}
result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype) mdcreator = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const)
methoddef = result[:methoddef] methoddef = mdcreator.dump(porttype)
binding = @definitions.bindings.find { |item| item.type == porttype } binding = @definitions.bindings.find { |item| item.type == porttype }
if binding.nil? or binding.soapbinding.nil? if binding.nil? or binding.soapbinding.nil?
# not bind or not a SOAP binding # not bound or not a SOAP binding
return '' return ''
end end
address = @definitions.porttype(porttype).locations[0] address = @definitions.porttype(porttype).locations[0]

View file

@ -1,4 +1,4 @@
# WSDL4R - Creating driver code from WSDL. # WSDL4R - Creating method definition from WSDL
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
@ -9,6 +9,7 @@
require 'wsdl/info' require 'wsdl/info'
require 'wsdl/soap/classDefCreatorSupport' require 'wsdl/soap/classDefCreatorSupport'
require 'soap/rpc/element' require 'soap/rpc/element'
require 'soap/rpc/methodDef'
module WSDL module WSDL
@ -19,6 +20,9 @@ class MethodDefCreator
include ClassDefCreatorSupport include ClassDefCreatorSupport
attr_reader :definitions attr_reader :definitions
# TODO: should not export this kind of stateful information.
# will be rewwritten in 1.6.1
attr_reader :assigned_method
def initialize(definitions, name_creator, modulepath, defined_const) def initialize(definitions, name_creator, modulepath, defined_const)
@definitions = definitions @definitions = definitions
@ -27,123 +31,82 @@ class MethodDefCreator
@simpletypes = @definitions.collect_simpletypes @simpletypes = @definitions.collect_simpletypes
@complextypes = @definitions.collect_complextypes @complextypes = @definitions.collect_complextypes
@elements = @definitions.collect_elements @elements = @definitions.collect_elements
@types = []
@encoded = false
@literal = false
@defined_const = defined_const @defined_const = defined_const
@assigned_method = {}
end end
def dump(name) def dump(name)
@types.clear
@encoded = false
@literal = false
methoddef = "" methoddef = ""
porttype = @definitions.porttype(name) porttype = @definitions.porttype(name)
binding = porttype.find_binding binding = porttype.find_binding
if binding if binding
binding.operations.each do |op_bind| create(binding.name).each do |mdef|
next unless op_bind # no binding is defined
next unless op_bind.soapoperation # not a SOAP operation binding
op = op_bind.find_operation
methoddef << ",\n" unless methoddef.empty? methoddef << ",\n" unless methoddef.empty?
methoddef << dump_method(op, op_bind).chomp methoddef << dump_method(mdef).chomp
end end
end end
result = { methoddef
:methoddef => methoddef,
:types => @types,
:encoded => @encoded,
:literal => @literal
}
result
end end
def collect_rpcparameter(operation) def create(bindingname)
result = operation.inputparts.collect { |part| binding = @definitions.binding(bindingname)
collect_type(part.type) if binding
param_set(::SOAP::RPC::SOAPMethod::IN, part.name, rpcdefinedtype(part)) return binding.operations.collect { |op_bind|
} next unless op_bind.soapoperation # not a SOAP operation binding
outparts = operation.outputparts create_methoddef(op_bind)
if outparts.size > 0
retval = outparts[0]
collect_type(retval.type)
result << param_set(::SOAP::RPC::SOAPMethod::RETVAL, retval.name,
rpcdefinedtype(retval))
cdr(outparts).each { |part|
collect_type(part.type)
result << param_set(::SOAP::RPC::SOAPMethod::OUT, part.name,
rpcdefinedtype(part))
} }
end end
result nil
end
def collect_documentparameter(operation)
param = []
operation.inputparts.each do |input|
param << param_set(::SOAP::RPC::SOAPMethod::IN, input.name,
documentdefinedtype(input))
end
operation.outputparts.each do |output|
param << param_set(::SOAP::RPC::SOAPMethod::OUT, output.name,
documentdefinedtype(output))
end
param
end end
private private
def dump_method(operation, binding) def create_methoddef(op_bind)
op_faults = {} op_info = op_bind.operation_info
binding.fault.each do |fault| name = assign_method_name(op_bind)
op_fault = {} soapaction = op_info.boundid.soapaction
soapfault = fault.soapfault qname = op_bind.soapoperation_name
next if soapfault.nil? mdef = ::SOAP::RPC::MethodDef.new(name, soapaction, qname)
faultclass = mapped_class_name(fault.name, @modulepath) op_info.parts.each do |part|
op_fault[:ns] = fault.name.namespace if op_info.style == :rpc
op_fault[:name] = fault.name.name mapped_class, qname = rpcdefinedtype(part)
op_fault[:namespace] = soapfault.namespace else
op_fault[:use] = soapfault.use || "literal" mapped_class, qname = documentdefinedtype(part)
op_fault[:encodingstyle] = soapfault.encodingstyle || "document" end
op_faults[faultclass] = op_fault mdef.add_parameter(part.io_type, part.name, qname, mapped_class)
end end
op_faults_str = op_faults.inspect op_info.faults.each do |name, faultinfo|
faultclass = mapped_class_name(name, @modulepath)
mdef.faults[faultclass] = faultinfo
end
mdef.style = op_info.style
mdef.inputuse = op_info.inputuse
mdef.outputuse = op_info.outputuse
mdef
end
name = safemethodname(operation.name) def dump_method(mdef)
name_as = operation.name style = mdef.style
style = binding.soapoperation_style inputuse = mdef.inputuse
inputuse = binding.soapbody_use_input outputuse = mdef.outputuse
outputuse = binding.soapbody_use_output paramstr = param2str(mdef.parameters)
if style == :rpc
qname = binding.soapoperation_name
paramstr = param2str(collect_rpcparameter(operation))
else
qname = nil
paramstr = param2str(collect_documentparameter(operation))
end
if paramstr.empty? if paramstr.empty?
paramstr = '[]' paramstr = '[]'
else else
paramstr = "[ " << paramstr.split(/\r?\n/).join("\n ") << " ]" paramstr = "[ " << paramstr.split(/\r?\n/).join("\n ") << " ]"
end end
definitions = <<__EOD__ definitions = <<__EOD__
#{ndq(binding.soapaction)}, #{ndq(mdef.soapaction)},
#{dq(name)}, #{dq(mdef.name)},
#{paramstr}, #{paramstr},
{ :request_style => #{nsym(style)}, :request_use => #{nsym(inputuse)}, { :request_style => #{nsym(style)}, :request_use => #{nsym(inputuse)},
:response_style => #{nsym(style)}, :response_use => #{nsym(outputuse)}, :response_style => #{nsym(style)}, :response_use => #{nsym(outputuse)},
:faults => #{op_faults_str} } :faults => #{mdef.faults.inspect} }
__EOD__ __EOD__
if inputuse == :encoded or outputuse == :encoded
@encoded = true
end
if inputuse == :literal or outputuse == :literal
@literal = true
end
if style == :rpc if style == :rpc
assign_const(qname.namespace, 'Ns') assign_const(mdef.qname.namespace, 'Ns')
return <<__EOD__ return <<__EOD__
[ #{dqname(qname)}, [ #{dqname(mdef.qname)},
#{definitions}] #{definitions}]
__EOD__ __EOD__
else else
@ -153,25 +116,36 @@ __EOD__
end end
end end
def assign_method_name(op_bind)
method_name = safemethodname(op_bind.name)
i = 1 # starts from _2
while @assigned_method.value?(method_name)
i += 1
method_name = safemethodname("#{op_bind.name}_#{i}")
end
@assigned_method[op_bind.boundid] = method_name
method_name
end
def rpcdefinedtype(part) def rpcdefinedtype(part)
if mapped = basetype_mapped_class(part.type) if mapped = basetype_mapped_class(part.type)
['::' + mapped.name] return ['::' + mapped.name, nil]
elsif definedtype = @simpletypes[part.type] elsif definedtype = @simpletypes[part.type]
[nil, definedtype.name.namespace, definedtype.name.name] return [nil, definedtype.name]
elsif definedtype = @elements[part.element] elsif definedtype = @elements[part.element]
[nil, part.element.namespace, part.element.name] return [nil, part.element]
elsif definedtype = @complextypes[part.type] elsif definedtype = @complextypes[part.type]
case definedtype.compoundtype case definedtype.compoundtype
when :TYPE_STRUCT, :TYPE_EMPTY, :TYPE_ARRAY, :TYPE_SIMPLE when :TYPE_STRUCT, :TYPE_EMPTY, :TYPE_ARRAY, :TYPE_SIMPLE
type = mapped_class_name(part.type, @modulepath) type = mapped_class_name(part.type, @modulepath)
[type, part.type.namespace, part.type.name] return [type, part.type]
when :TYPE_MAP when :TYPE_MAP
[Hash.name, part.type.namespace, part.type.name] return [Hash.name, part.type]
else else
raise NotImplementedError.new("must not reach here: #{definedtype.compoundtype}") raise NotImplementedError.new("must not reach here: #{definedtype.compoundtype}")
end end
elsif part.type == XSD::AnyTypeName elsif part.type == XSD::AnyTypeName
[nil] return [nil, nil]
else else
raise RuntimeError.new("part: #{part.name} cannot be resolved") raise RuntimeError.new("part: #{part.name} cannot be resolved")
end end
@ -179,66 +153,34 @@ __EOD__
def documentdefinedtype(part) def documentdefinedtype(part)
if mapped = basetype_mapped_class(part.type) if mapped = basetype_mapped_class(part.type)
['::' + mapped.name, nil, part.name] return ['::' + mapped.name, XSD::QName.new(nil, part.name)]
elsif definedtype = @simpletypes[part.type] elsif definedtype = @simpletypes[part.type]
if definedtype.base if definedtype.base
['::' + basetype_mapped_class(definedtype.base).name, nil, part.name] return ['::' + basetype_mapped_class(definedtype.base).name, XSD::QName.new(nil, part.name)]
else else
raise RuntimeError.new("unsupported simpleType: #{definedtype}") raise RuntimeError.new("unsupported simpleType: #{definedtype}")
end end
elsif definedtype = @elements[part.element] elsif definedtype = @elements[part.element]
['::SOAP::SOAPElement', part.element.namespace, part.element.name] return ['::SOAP::SOAPElement', part.element]
elsif definedtype = @complextypes[part.type] elsif definedtype = @complextypes[part.type]
['::SOAP::SOAPElement', part.type.namespace, part.type.name] return ['::SOAP::SOAPElement', part.type]
else else
raise RuntimeError.new("part: #{part.name} cannot be resolved") raise RuntimeError.new("part: #{part.name} cannot be resolved")
end end
end end
def param_set(io_type, name, type, ele = nil)
[io_type, name, type, ele]
end
def collect_type(type)
# ignore inline type definition.
return if type.nil?
return if @types.include?(type)
@types << type
return unless @complextypes[type]
collect_elements_type(@complextypes[type].elements)
end
def collect_elements_type(elements)
elements.each do |element|
case element
when WSDL::XMLSchema::Any
# nothing to do
when WSDL::XMLSchema::Element
collect_type(element.type)
when WSDL::XMLSchema::Sequence, WSDL::XMLSchema::Choice
collect_elements_type(element.elements)
else
raise RuntimeError.new("unknown type: #{element}")
end
end
end
def param2str(params) def param2str(params)
params.collect { |param| params.collect { |param|
io, name, type, ele = param mappingstr = mapping_info2str(param.mapped_class, param.qname)
unless ele.nil? "[:#{param.io_type.id2name}, #{dq(param.name)}, #{mappingstr}]"
"[#{dq(io)}, #{dq(name)}, #{type2str(type)}, #{ele2str(ele)}]"
else
"[#{dq(io)}, #{dq(name)}, #{type2str(type)}]"
end
}.join(",\n") }.join(",\n")
end end
def type2str(type) def mapping_info2str(mapped_class, qname)
if type.size == 1 if qname.nil?
"[#{ndq(type[0])}]" "[#{ndq(mapped_class)}]"
else else
"[#{ndq(type[0])}, #{ndq(type[1])}, #{dq(type[2])}]" "[#{ndq(mapped_class)}, #{ndq(qname.namespace)}, #{dq(qname.name)}]"
end end
end end
@ -250,12 +192,6 @@ __EOD__
"false" "false"
end end
end end
def cdr(ary)
result = ary.dup
result.shift
result
end
end end

View file

@ -14,7 +14,7 @@ module SOAP
class Operation < Info class Operation < Info
class OperationInfo class ParamInfo
attr_reader :style attr_reader :style
attr_reader :op_name attr_reader :op_name
attr_reader :optype_name attr_reader :optype_name
@ -23,7 +23,7 @@ class Operation < Info
attr_reader :bodyparts attr_reader :bodyparts
attr_reader :faultpart attr_reader :faultpart
attr_reader :soapaction attr_reader :soapaction
def initialize(style, use, encodingstyle, op_name, optype_name, def initialize(style, use, encodingstyle, op_name, optype_name,
headerparts, bodyparts, faultpart, soapaction) headerparts, bodyparts, faultpart, soapaction)
@style = style @style = style
@ -67,16 +67,6 @@ class Operation < Info
end end
end end
def input_info
name_info = parent.find_operation.input_info
param_info(name_info, parent.input)
end
def output_info
name_info = parent.find_operation.output_info
param_info(name_info, parent.output)
end
def operation_style def operation_style
return @style if @style return @style if @style
if parent_binding.soapbinding if parent_binding.soapbinding
@ -91,7 +81,7 @@ private
parent.parent parent.parent
end end
def param_info(name_info, param) def create_param_info(name_info, param)
op_style = operation_style() op_style = operation_style()
op_use = param.soapbody_use op_use = param.soapbody_use
op_encodingstyle = param.soapbody_encodingstyle op_encodingstyle = param.soapbody_encodingstyle
@ -112,7 +102,7 @@ private
bodyparts = name_info.parts bodyparts = name_info.parts
end end
faultpart = nil faultpart = nil
OperationInfo.new(op_style, op_use, op_encodingstyle, op_name, optype_name, ParamInfo.new(op_style, op_use, op_encodingstyle, op_name, optype_name,
headerparts, bodyparts, faultpart, parent.soapaction) headerparts, bodyparts, faultpart, parent.soapaction)
end end
end end

View file

@ -35,8 +35,8 @@ class ServantSkeltonCreator
result << "\n\n" result << "\n\n"
end end
if porttype.nil? if porttype.nil?
@definitions.porttypes.each do |type| @definitions.porttypes.each do |porttype|
result << dump_porttype(type.name) result << dump_porttype(porttype)
result << "\n" result << "\n"
end end
else else
@ -52,24 +52,33 @@ class ServantSkeltonCreator
private private
def dump_porttype(name) def dump_porttype(porttype)
class_name = mapped_class_basename(name, @modulepath) assigned_method = collect_assigned_method(@definitions, porttype.name, @modulepath)
class_name = mapped_class_basename(porttype.name, @modulepath)
c = XSD::CodeGen::ClassDef.new(class_name) c = XSD::CodeGen::ClassDef.new(class_name)
element_definitions = @definitions.collect_elements element_definitions = @definitions.collect_elements
operations = @definitions.porttype(name).operations binding = porttype.find_binding
operations.each do |operation| if binding
name = safemethodname(operation.name) binding.operations.each do |op_bind|
input = operation.input operation = op_bind.find_operation
params = input.find_message.parts.collect { |part| if operation.nil?
safevarname(part.name) warn("operation not found for binding: #{op_bind}")
} next
m = XSD::CodeGen::MethodDef.new(name, params) do <<-EOD
p [#{params.join(", ")}]
raise NotImplementedError.new
EOD
end end
m.comment = dump_method_signature(operation, element_definitions) name = assigned_method[op_bind.boundid] || operation.name
c.add_method(m) methodname = safemethodname(name)
input = operation.input
params = input.find_message.parts.collect { |part|
safevarname(part.name)
}
m = XSD::CodeGen::MethodDef.new(methodname, params) do <<-EOD
p [#{params.join(", ")}]
raise NotImplementedError.new
EOD
end
m.comment = dump_method_signature(methodname, operation, element_definitions)
c.add_method(m)
end
end end
c.dump c.dump
end end

View file

@ -49,12 +49,9 @@ private
def dump_porttype(porttype) def dump_porttype(porttype)
class_name = mapped_class_name(porttype.name, @modulepath) class_name = mapped_class_name(porttype.name, @modulepath)
defined_const = {} defined_const = {}
result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
methoddef = result[:methoddef]
wsdl_name = @definitions.name ? @definitions.name.name : 'default' wsdl_name = @definitions.name ? @definitions.name.name : 'default'
mrname = safeconstname(wsdl_name + 'MappingRegistry') mrname = safeconstname(wsdl_name + 'MappingRegistry')
c1 = XSD::CodeGen::ClassDef.new(class_name) c1 = XSD::CodeGen::ClassDef.new(class_name)
c1.def_require("soap/rpc/soaplet") c1.def_require("soap/rpc/soaplet")
c1.def_code <<-EOD c1.def_code <<-EOD

View file

@ -50,12 +50,9 @@ private
def dump_porttype(porttype) def dump_porttype(porttype)
class_name = mapped_class_name(porttype.name, @modulepath) class_name = mapped_class_name(porttype.name, @modulepath)
defined_const = {} defined_const = {}
result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) methoddef = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name)
methoddef = result[:methoddef]
wsdl_name = @definitions.name ? @definitions.name.name : 'default' wsdl_name = @definitions.name ? @definitions.name.name : 'default'
mrname = safeconstname(wsdl_name + 'MappingRegistry') mrname = safeconstname(wsdl_name + 'MappingRegistry')
c1 = XSD::CodeGen::ClassDef.new(class_name) c1 = XSD::CodeGen::ClassDef.new(class_name)
c1.def_require("soap/rpc/standaloneServer") c1.def_require("soap/rpc/standaloneServer")
c1.def_code <<-EOD c1.def_code <<-EOD

View file

@ -7,6 +7,7 @@
require 'wsdl/info' require 'wsdl/info'
require 'wsdl/xmlSchema/ref'
module WSDL module WSDL
@ -14,26 +15,7 @@ module XMLSchema
class Attribute < Info class Attribute < Info
class << self include Ref
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
define_method(name) {
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 :use
attr_writer :form attr_writer :form
@ -51,7 +33,6 @@ class Attribute < Info
attr_reader_ref :default attr_reader_ref :default
attr_reader_ref :fixed attr_reader_ref :fixed
attr_accessor :ref
attr_accessor :arytype attr_accessor :arytype
def initialize def initialize
@ -68,10 +49,6 @@ class Attribute < Info
@arytype = nil @arytype = nil
end end
def refelement
@refelement ||= root.collect_attributes[@ref]
end
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
@ -116,6 +93,10 @@ private
def directelement? def directelement?
parent.is_a?(Schema) parent.is_a?(Schema)
end end
def refelement
@refelement ||= root.collect_attributes[@ref]
end
end end

View file

@ -7,6 +7,7 @@
require 'wsdl/info' require 'wsdl/info'
require 'wsdl/xmlSchema/ref'
module WSDL module WSDL
@ -14,26 +15,7 @@ module XMLSchema
class AttributeGroup < Info class AttributeGroup < Info
class << self include Ref
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
define_method(name) {
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 :name # required
attr_writer :attributes attr_writer :attributes
@ -41,8 +23,6 @@ class AttributeGroup < Info
attr_reader_ref :name attr_reader_ref :name
attr_reader_ref :attributes attr_reader_ref :attributes
attr_accessor :ref
def initialize def initialize
super super
@name = nil @name = nil
@ -51,10 +31,6 @@ class AttributeGroup < Info
@refelement = nil @refelement = nil
end end
def refelement
@refelement ||= root.collect_attributegroups[@ref]
end
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
@ -79,6 +55,12 @@ class AttributeGroup < Info
nil nil
end end
end end
private
def refelement
@refelement ||= root.collect_attributegroups[@ref]
end
end end

View file

@ -69,7 +69,7 @@ class ComplexExtension < Info
basetype.check_type basetype.check_type
end end
end end
def parse_element(element) def parse_element(element)
case element case element
when AllName when AllName

View file

@ -58,7 +58,7 @@ class ComplexRestriction < Info
basetype.check_type if basetype basetype.check_type if basetype
end end
end end
def parse_element(element) def parse_element(element)
case element case element
when AllName when AllName

View file

@ -7,6 +7,7 @@
require 'wsdl/info' require 'wsdl/info'
require 'wsdl/xmlSchema/ref'
module WSDL module WSDL
@ -14,26 +15,7 @@ module XMLSchema
class Element < Info class Element < Info
class << self include Ref
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
define_method(name) {
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 :name # required
attr_writer :form attr_writer :form
@ -55,8 +37,6 @@ class Element < Info
attr_reader_ref :default attr_reader_ref :default
attr_reader_ref :abstract attr_reader_ref :abstract
attr_accessor :ref
def initialize(name = nil, type = nil) def initialize(name = nil, type = nil)
super() super()
@name = name @name = name
@ -77,10 +57,6 @@ class Element < Info
!(local_simpletype || local_complextype || constraint || type) !(local_simpletype || local_complextype || constraint || type)
end end
def refelement
@refelement ||= (@ref ? root.collect_elements[@ref] : nil)
end
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
@ -166,6 +142,10 @@ private
def directelement? def directelement?
parent.is_a?(Schema) parent.is_a?(Schema)
end end
def refelement
@refelement ||= (@ref ? root.collect_elements[@ref] : nil)
end
end end

View file

@ -7,6 +7,7 @@
require 'wsdl/info' require 'wsdl/info'
require 'wsdl/xmlSchema/ref'
module WSDL module WSDL
@ -14,26 +15,7 @@ module XMLSchema
class Group < Info class Group < Info
class << self include Ref
if RUBY_VERSION > "1.7.0"
def attr_reader_ref(symbol)
name = symbol.to_s
define_method(name) {
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 :name # required
attr_accessor :maxoccurs attr_accessor :maxoccurs
@ -43,8 +25,6 @@ class Group < Info
attr_reader_ref :name attr_reader_ref :name
attr_reader_ref :content attr_reader_ref :content
attr_accessor :ref
def initialize(name = nil) def initialize(name = nil)
super() super()
@name = name @name = name
@ -55,10 +35,6 @@ class Group < Info
@refelement = nil @refelement = nil
end end
def refelement
@refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil)
end
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
@ -111,6 +87,12 @@ class Group < Info
nil nil
end end
end end
private
def refelement
@refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil)
end
end end

View file

@ -111,10 +111,10 @@ private
elename = ns.parse(name) elename = ns.parse(name)
if !parent if !parent
if elename == SchemaName if elename == SchemaName
o = Schema.parse_element(elename) o = Schema.parse_element(elename)
o.location = @location o.location = @location
else else
raise UnknownElementError.new("unknown element: #{elename}") raise UnknownElementError.new("unknown element: #{elename}")
end end
o.root = @originalroot if @originalroot # o.root = o otherwise o.root = @originalroot if @originalroot # o.root = o otherwise
else else
@ -129,7 +129,7 @@ private
warn("ignored element: #{elename} of #{parent.class}") warn("ignored element: #{elename} of #{parent.class}")
@ignored[elename] = elename @ignored[elename] = elename
end end
o = Documentation.new # which accepts any element. o = Documentation.new # which accepts any element.
end end
# node could be a pseudo element. pseudo element has its own parent. # node could be a pseudo element. pseudo element has its own parent.
o.root = parent.root o.root = parent.root
@ -140,7 +140,7 @@ private
value_ele = ns.parse(value, false) value_ele = ns.parse(value, false)
value_ele.source = value # for recovery; value may not be a QName value_ele.source = value # for recovery; value may not be a QName
if attr_ele == IdAttrName if attr_ele == IdAttrName
o.id = value_ele o.id = value_ele
else else
if o.parse_attr(attr_ele, value_ele).nil? if o.parse_attr(attr_ele, value_ele).nil?
unless @ignored.key?(attr_ele) unless @ignored.key?(attr_ele)

View file

@ -0,0 +1,33 @@
# WSDL4R - XMLSchema ref support.
# Copyright (C) 2000-2007 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.
module WSDL
module XMLSchema
module Ref
def self.included(klass)
klass.extend(RefClassSupport)
end
module RefClassSupport
def attr_reader_ref(symbol)
name = symbol.to_s
define_method(name) {
instance_variable_get("@#{name}") ||
(refelement ? refelement.__send__(name) : nil)
}
end
end
attr_accessor :ref
end
end
end

View file

@ -27,7 +27,7 @@ class SimpleExtension < Info
def targetnamespace def targetnamespace
parent.targetnamespace parent.targetnamespace
end end
def valid?(value) def valid?(value)
true true
end end

View file

@ -23,8 +23,8 @@ class SimpleRestriction < Info
attr_reader :enumeration attr_reader :enumeration
attr_accessor :whitespace attr_accessor :whitespace
attr_accessor :maxinclusive attr_accessor :maxinclusive
attr_accessor :maxexlusive attr_accessor :maxexclusive
attr_accessor :minexlusive attr_accessor :minexclusive
attr_accessor :mininclusive attr_accessor :mininclusive
attr_accessor :totaldigits attr_accessor :totaldigits
attr_accessor :fractiondigits attr_accessor :fractiondigits
@ -42,7 +42,7 @@ class SimpleRestriction < Info
@fixed = {} @fixed = {}
@attributes = XSD::NamedElements.new @attributes = XSD::NamedElements.new
end end
def valid?(value) def valid?(value)
return false unless check_restriction(value) return false unless check_restriction(value)
return false unless check_length(value) return false unless check_length(value)
@ -73,9 +73,9 @@ class SimpleRestriction < Info
when MaxInclusiveName when MaxInclusiveName
MaxInclusive.new MaxInclusive.new
when MaxExclusiveName when MaxExclusiveName
MaxExlusive.new MaxExclusive.new
when MinExclusiveName when MinExclusiveName
MinExlusive.new MinExclusive.new
when MinInclusiveName when MinInclusiveName
MinInclusive.new MinInclusive.new
when TotalDigitsName when TotalDigitsName

View file

@ -10,7 +10,7 @@ module XSD
module Charset module Charset
@internal_encoding = $KCODE @internal_encoding = "UTF8" #$KCODE
class XSDError < StandardError; end class XSDError < StandardError; end
class CharsetError < XSDError; end class CharsetError < XSDError; end
@ -47,14 +47,14 @@ public
Proc.new { |str| IconvCharset.safe_iconv("euc-jp", sjtag, str) } Proc.new { |str| IconvCharset.safe_iconv("euc-jp", sjtag, str) }
rescue LoadError rescue LoadError
begin begin
require 'nkf' require 'nkf'
EncodingConvertMap[['EUC' , 'SJIS']] = EncodingConvertMap[['EUC' , 'SJIS']] =
Proc.new { |str| NKF.nkf('-sXm0', str) } Proc.new { |str| NKF.nkf('-sXm0', str) }
EncodingConvertMap[['SJIS', 'EUC' ]] = EncodingConvertMap[['SJIS', 'EUC' ]] =
Proc.new { |str| NKF.nkf('-eXm0', str) } Proc.new { |str| NKF.nkf('-eXm0', str) }
rescue LoadError rescue LoadError
end end
begin begin
require 'uconv' require 'uconv'
@internal_encoding = 'UTF8' @internal_encoding = 'UTF8'
@ -129,18 +129,18 @@ public
# us_ascii = '[\x00-\x7F]' # us_ascii = '[\x00-\x7F]'
us_ascii = '[\x9\xa\xd\x20-\x7F]' # XML 1.0 restricted. us_ascii = '[\x9\xa\xd\x20-\x7F]' # XML 1.0 restricted.
USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z", nil, 'NONE') USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z")
twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])' twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])'
threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])' threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])'
character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})" character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})"
EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, 'NONE') EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, 'n')
# onebyte_sjis = '[\x00-\x7F\xA1-\xDF]' # onebyte_sjis = '[\x00-\x7F\xA1-\xDF]'
onebyte_sjis = '[\x9\xa\xd\x20-\x7F\xA1-\xDF]' # XML 1.0 restricted. onebyte_sjis = '[\x9\xa\xd\x20-\x7F\xA1-\xDF]' # XML 1.0 restricted.
twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])' twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])'
character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})" character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})"
SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, 'NONE') SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, 'n')
# 0xxxxxxx # 0xxxxxxx
# 110yyyyy 10xxxxxx # 110yyyyy 10xxxxxx
@ -149,9 +149,8 @@ public
threebytes_utf8 = '(?:[\xE0-\xEF][\x80-\xBF][\x80-\xBF])' threebytes_utf8 = '(?:[\xE0-\xEF][\x80-\xBF][\x80-\xBF])'
# 11110uuu 10uuuzzz 10yyyyyy 10xxxxxx # 11110uuu 10uuuzzz 10yyyyyy 10xxxxxx
fourbytes_utf8 = '(?:[\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])' fourbytes_utf8 = '(?:[\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])'
character_utf8 = character_utf8 = "(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})"
"(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})" UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, 'n')
UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, 'NONE')
def Charset.is_us_ascii(str) def Charset.is_us_ascii(str)
USASCIIRegexp =~ str USASCIIRegexp =~ str

View file

@ -43,7 +43,7 @@ class ClassDef < ModuleDef
def dump def dump
buf = "" buf = ""
unless @requirepath.empty? unless @requirepath.empty?
buf << dump_requirepath buf << dump_requirepath
end end
buf << dump_emptyline unless buf.empty? buf << dump_emptyline unless buf.empty?
package = @name.split(/::/)[0..-2] package = @name.split(/::/)[0..-2]

View file

@ -236,22 +236,22 @@ module GenSupport
private private
def trim_eol(str) def trim_eol(str)
str.collect { |line| str.lines.collect { |line|
line.sub(/\r?\n\z/, "") + "\n" line.sub(/\r?\n\z/, "") + "\n"
}.join }.join
end end
def trim_indent(str) def trim_indent(str)
indent = nil indent = nil
str = str.collect { |line| untab(line) }.join str = str.lines.collect { |line| untab(line) }.join
str.each do |line| str.each_line do |line|
head = line.index(/\S/) head = line.index(/\S/)
if !head.nil? and (indent.nil? or head < indent) if !head.nil? and (indent.nil? or head < indent)
indent = head indent = head
end end
end end
return str unless indent return str unless indent
str.collect { |line| str.lines.collect { |line|
line.sub(/^ {0,#{indent}}/, "") line.sub(/^ {0,#{indent}}/, "")
}.join }.join
end end

View file

@ -68,7 +68,7 @@ class ModuleDef
def dump def dump
buf = "" buf = ""
unless @requirepath.empty? unless @requirepath.empty?
buf << dump_requirepath buf << dump_requirepath
end end
buf << dump_emptyline unless buf.empty? buf << dump_emptyline unless buf.empty?
package = @name.split(/::/)[0..-2] package = @name.split(/::/)[0..-2]

View file

@ -10,7 +10,7 @@ require 'xsd/qname'
require 'xsd/charset' require 'xsd/charset'
require 'soap/nestedexception' require 'soap/nestedexception'
require 'uri' require 'uri'
require 'date'
### ###
## XMLSchamaDatatypes general definitions. ## XMLSchamaDatatypes general definitions.
@ -342,9 +342,9 @@ private
# Float("-1.4E") might fail on some system. # Float("-1.4E") might fail on some system.
str << '0' if /e$/i =~ str str << '0' if /e$/i =~ str
begin begin
return narrow32bit(Float(str)) return narrow32bit(Float(str))
rescue ArgumentError rescue ArgumentError
raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!) raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.", $!)
end end
end end
end end
@ -569,7 +569,7 @@ module XSDDateTimeImpl
'Z' 'Z'
else else
((diffmin < 0) ? '-' : '+') << format('%02d:%02d', ((diffmin < 0) ? '-' : '+') << format('%02d:%02d',
(diffmin.abs / 60.0).to_i, (diffmin.abs % 60.0).to_i) (diffmin.abs / 60.0).to_i, (diffmin.abs % 60.0).to_i)
end end
end end
@ -652,7 +652,7 @@ private
year, @data.mon, @data.mday, @data.hour, @data.min, @data.sec) year, @data.mon, @data.mday, @data.hour, @data.min, @data.sec)
if @data.sec_fraction.nonzero? if @data.sec_fraction.nonzero?
if @secfrac if @secfrac
s << ".#{ @secfrac }" s << ".#{ @secfrac }"
else else
s << sprintf("%.16f", s << sprintf("%.16f",
(@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '') (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '')
@ -702,7 +702,7 @@ private
s = format('%02d:%02d:%02d', @data.hour, @data.min, @data.sec) s = format('%02d:%02d:%02d', @data.hour, @data.min, @data.sec)
if @data.sec_fraction.nonzero? if @data.sec_fraction.nonzero?
if @secfrac if @secfrac
s << ".#{ @secfrac }" s << ".#{ @secfrac }"
else else
s << sprintf("%.16f", s << sprintf("%.16f",
(@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '') (@data.sec_fraction * DayInSec).to_f).sub(/^0/, '').sub(/0*$/, '')
@ -816,7 +816,7 @@ class XSDGMonthDay < XSDAnySimpleType
private private
def screen_data_str(t) def screen_data_str(t)
/^(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip /^--(\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
@ -827,7 +827,7 @@ private
end end
def _to_s def _to_s
s = format('%02d-%02d', @data.mon, @data.mday) s = format('--%02d-%02d', @data.mon, @data.mday)
add_tz(s) add_tz(s)
end end
end end
@ -843,7 +843,7 @@ class XSDGDay < XSDAnySimpleType
private private
def screen_data_str(t) def screen_data_str(t)
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip /^---(\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
@ -853,7 +853,7 @@ private
end end
def _to_s def _to_s
s = format('%02d', @data.mday) s = format('---%02d', @data.mday)
add_tz(s) add_tz(s)
end end
end end
@ -869,7 +869,7 @@ class XSDGMonth < XSDAnySimpleType
private private
def screen_data_str(t) def screen_data_str(t)
/^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip /^--(\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
@ -879,7 +879,7 @@ private
end end
def _to_s def _to_s
s = format('%02d', @data.mon) s = format('--%02d', @data.mon)
add_tz(s) add_tz(s)
end end
end end

View file

@ -30,6 +30,7 @@ module Mapping
class Mapper class Mapper
MAPPING_OPT = { MAPPING_OPT = {
:default_encodingstyle => SOAP::LiteralNamespace, :default_encodingstyle => SOAP::LiteralNamespace,
:generate_explicit_type => false,
:root_type_hint => true :root_type_hint => true
}.freeze }.freeze

View file

@ -63,7 +63,7 @@ class NamedElements
@elements << rhs @elements << rhs
self self
end end
def delete(rhs) def delete(rhs)
rv = @elements.delete(rhs) rv = @elements.delete(rhs)
@cache.clear @cache.clear

View file

@ -123,7 +123,7 @@ public
end end
# $1 and $2 are necessary. # $1 and $2 are necessary.
ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z', nil, 'NONE') ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z')
def parse(str, local = false) def parse(str, local = false)
if ParseRegexp =~ str if ParseRegexp =~ str

View file

@ -56,7 +56,7 @@ class QName
def hash def hash
@namespace.hash ^ @name.hash @namespace.hash ^ @name.hash
end end
def to_s def to_s
"{#{ namespace }}#{ name }" "{#{ namespace }}#{ name }"
end end

View file

@ -7,6 +7,7 @@
require 'xsd/xmlparser/parser' require 'xsd/xmlparser/parser'
require 'soap/property'
module XSD module XSD
@ -19,7 +20,7 @@ module XMLParser
module_function :create_parser module_function :create_parser
# $1 is necessary. # $1 is necessary.
NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE') NSParseRegexp = Regexp.new("^xmlns:?(.*)$")
def filter_ns(ns, attrs) def filter_ns(ns, attrs)
ns_updated = false ns_updated = false
@ -50,20 +51,25 @@ end
end end
PARSER_LIBS = [
'libxmlparser',
'xmlparser',
'xmlscanner',
'rexmlparser'
]
# Get library prefs
opt = ::SOAP::Property.loadproperty('soap/property')
use_libxml = (opt and opt['parser'] and opt['parser']['use_libxml'] and opt['parser']['use_libxml'] == 'false') ? false : true
# Try to load XML processor. # Try to load XML processor.
loaded = false loaded = false
[ PARSER_LIBS.each do |name|
'xsd/xmlparser/xmlparser',
'xsd/xmlparser/xmlscanner',
'xsd/xmlparser/rexmlparser',
].each do |lib|
begin begin
require lib lib = "xsd/xmlparser/#{name}"
require lib unless !use_libxml && name == 'libxmlparser'
# XXX: for a workaround of rubygems' require inconsistency # XXX: for a workaround of rubygems' require inconsistency
# XXX: MUST BE REMOVED IN THE FUTURE # XXX: MUST BE REMOVED IN THE FUTURE
name = lib.sub(/^.*\//, '')
raise LoadError unless XSD::XMLParser.constants.find { |c| raise LoadError unless XSD::XMLParser.constants.find { |c|
c.downcase == name c.to_s.downcase == name.downcase
} }
loaded = true loaded = true
break break
@ -73,3 +79,4 @@ end
unless loaded unless loaded
raise RuntimeError.new("XML processor module not found.") raise RuntimeError.new("XML processor module not found.")
end end

View file

@ -0,0 +1,76 @@
# XSD4R - XML Instance parser library.
# Copyright (C) 2000-2007 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/xmlparser/parser'
module XSD
module XMLParser
def create_parser(host, opt)
XSD::XMLParser::Parser.create_parser(host, opt)
end
module_function :create_parser
# $1 is necessary.
NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE')
def filter_ns(ns, attrs)
ns_updated = false
if attrs.nil? or attrs.empty?
return [ns, attrs]
end
newattrs = {}
attrs.each do |key, value|
if NSParseRegexp =~ key
unless ns_updated
ns = ns.clone_ns
ns_updated = true
end
# tag == '' means 'default namespace'
# value == '' means 'no default namespace'
tag = $1 || ''
ns.assign(value, tag)
else
newattrs[key] = value
end
end
return [ns, newattrs]
end
module_function :filter_ns
end
end
# Try to load XML processor.
loaded = false
[
'xsd/xmlparser/libxmlparser',
'xsd/xmlparser/xmlparser',
'xsd/xmlparser/xmlscanner',
'xsd/xmlparser/rexmlparser',
].each do |lib|
begin
require lib
# XXX: for a workaround of rubygems' require inconsistency
# XXX: MUST BE REMOVED IN THE FUTURE
name = lib.sub(/^.*\//, '')
raise LoadError unless XSD::XMLParser.constants.find { |c|
c.downcase == name
}
loaded = true
break
rescue LoadError
end
end
unless loaded
raise RuntimeError.new("XML processor module not found.")
end

View file

@ -0,0 +1,119 @@
# XSD4R - XMLParser XML parser library.
# Copyright (C) 2000-2007 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/xmlparser'
require 'xml/libxml'
module XSD
module XMLParser
class LibXMLParser < XSD::XMLParser::Parser
include XML::SaxParser::Callbacks
def do_parse(string_or_readable)
if string_or_readable.respond_to?(:read)
string = string_or_readable.read
else
string = string_or_readable
end
# XMLParser passes a String in utf-8.
@charset = 'utf-8'
@parser = XML::SaxParser.string(string)
@parser.callbacks = self
@parser.parse
end
ENTITY_REF_MAP = {
'lt' => '<',
'gt' => '>',
'amp' => '&',
'quot' => '"',
'apos' => '\''
}
#def on_internal_subset(name, external_id, system_id)
# nil
#end
#def on_is_standalone()
# nil
#end
#def on_has_internal_subset()
# nil
#end
#def on_has_external_subset()
# nil
#end
#def on_start_document()
# nil
#end
#def on_end_document()
# nil
#end
def on_start_element_ns(name, attributes, prefix, uri, namespaces)
name = "#{prefix}:#{name}" unless prefix.nil?
namespaces.each do |key,value|
nsprefix = key.nil? ? "xmlns" : "xmlns:#{key}"
attributes[nsprefix] = value
end
start_element(name, attributes)
end
def on_end_element(name)
end_element(name)
end
def on_reference(name)
characters(ENTITY_REF_MAP[name])
end
def on_characters(chars)
characters(chars)
end
#def on_processing_instruction(target, data)
# nil
#end
#def on_comment(msg)
# nil
#end
def on_parser_warning(msg)
warn(msg)
end
def on_parser_error(msg)
raise ParseError.new(msg)
end
def on_parser_fatal_error(msg)
raise ParseError.new(msg)
end
def on_cdata_block(cdata)
characters(cdata)
end
def on_external_subset(name, external_id, system_id)
nil
end
add_factory(self)
end
end
end

View file

@ -51,7 +51,7 @@ class XMLScanner < XSD::XMLParser::Parser
end end
def warning(msg) def warning(msg)
p msg if $DEBUG warn(msg)
end end
# def on_xmldecl; end # def on_xmldecl; end

View file

@ -1,68 +0,0 @@
require 'test/unit/testsuite'
require 'test/unit/testcase'
$KCODE = 'UTF8'
rcsid = %w$Id: 16runner.rb 1541 2005-05-10 11:28:20Z nahi $
Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
Release = rcsid[3].freeze
module Test
module Unit
module Assertions
alias assert_raise assert_raises
end
end
end
class BulkTestSuite < Test::Unit::TestSuite
def self.suite
suite = Test::Unit::TestSuite.new
ObjectSpace.each_object(Class) do |klass|
suite << klass.suite if (Test::Unit::TestCase > klass)
end
suite
end
end
runners_map = {
'console' => proc do |suite|
require 'test/unit/ui/console/testrunner'
passed = Test::Unit::UI::Console::TestRunner.run(suite).passed?
exit(passed ? 0 : 1)
end,
'gtk' => proc do |suite|
require 'test/unit/ui/gtk/testrunner'
Test::Unit::UI::GTK::TestRunner.run(suite)
end,
'fox' => proc do |suite|
require 'test/unit/ui/fox/testrunner'
Test::Unit::UI::Fox::TestRunner.run(suite)
end,
}
def test_require(list)
list.each do |tc_name|
if File.directory?(tc_name)
newlist = Dir.glob(File.join(tc_name, "**", "test_*.rb")).sort
test_require(newlist)
else
dir = File.expand_path(File.dirname(tc_name))
backup = $:.dup
$:.push(dir)
require tc_name
$:.replace(backup)
end
end
end
argv = ARGV
if argv.empty?
argv = Dir.glob(File.join(File.dirname(__FILE__), "**", "test_*.rb")).sort
end
test_require(argv)
runner = 'console'
GC.start
runners_map[runner].call(BulkTestSuite.suite)

View file

@ -1,83 +0,0 @@
require 'xsd/qname'
# {http://soapinterop.org/xsd}ArrayOfstring
class ArrayOfstring < ::Array
@@schema_type = "string"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOfint
class ArrayOfint < ::Array
@@schema_type = "int"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOffloat
class ArrayOffloat < ::Array
@@schema_type = "float"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOfSOAPStruct
class ArrayOfSOAPStruct < ::Array
@@schema_type = "SOAPStruct"
@@schema_ns = "http://soapinterop.org/xsd"
end
# {http://soapinterop.org/xsd}SOAPStruct
class SOAPStruct
@@schema_type = "SOAPStruct"
@@schema_ns = "http://soapinterop.org/xsd"
@@schema_element = [["varString", "String"], ["varInt", "Int"], ["varFloat", "Float"]]
attr_accessor :varString
attr_accessor :varInt
attr_accessor :varFloat
def initialize(varString = nil, varInt = nil, varFloat = nil)
@varString = varString
@varInt = varInt
@varFloat = varFloat
end
end
# {http://soapinterop.org/xsd}ArrayOfstring
class ArrayOfstring < ::Array
@@schema_type = "string"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOfint
class ArrayOfint < ::Array
@@schema_type = "int"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOffloat
class ArrayOffloat < ::Array
@@schema_type = "float"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
end
# {http://soapinterop.org/xsd}ArrayOfSOAPStruct
class ArrayOfSOAPStruct < ::Array
@@schema_type = "SOAPStruct"
@@schema_ns = "http://soapinterop.org/xsd"
end
# {http://soapinterop.org/xsd}SOAPStruct
class SOAPStruct
@@schema_type = "SOAPStruct"
@@schema_ns = "http://soapinterop.org/xsd"
@@schema_element = [["varString", "String"], ["varInt", "Int"], ["varFloat", "Float"]]
attr_accessor :varString
attr_accessor :varInt
attr_accessor :varFloat
def initialize(varString = nil, varInt = nil, varFloat = nil)
@varString = varString
@varInt = varInt
@varFloat = varFloat
end
end

View file

@ -1,315 +0,0 @@
<?xml version="1.0"?>
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapinterop.org/xsd">
<import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOfstring">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfint">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOffloat">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="float[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfSOAPStruct">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="s:SOAPStruct[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="SOAPStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
</all>
</complexType>
</schema>
</types>
<message name="echoStringRequest">
<part name="inputString" type="xsd:string"/>
</message>
<message name="echoStringResponse">
<part name="return" type="xsd:string"/>
</message>
<message name="echoStringArrayRequest">
<part name="inputStringArray" type="s:ArrayOfstring"/>
</message>
<message name="echoStringArrayResponse">
<part name="return" type="s:ArrayOfstring"/>
</message>
<message name="echoIntegerRequest">
<part name="inputInteger" type="xsd:int"/>
</message>
<message name="echoIntegerResponse">
<part name="return" type="xsd:int"/>
</message>
<message name="echoIntegerArrayRequest">
<part name="inputIntegerArray" type="s:ArrayOfint"/>
</message>
<message name="echoIntegerArrayResponse">
<part name="return" type="s:ArrayOfint"/>
</message>
<message name="echoFloatRequest">
<part name="inputFloat" type="xsd:float"/>
</message>
<message name="echoFloatResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="echoFloatArrayRequest">
<part name="inputFloatArray" type="s:ArrayOffloat"/>
</message>
<message name="echoFloatArrayResponse">
<part name="return" type="s:ArrayOffloat"/>
</message>
<message name="echoStructRequest">
<part name="inputStruct" type="s:SOAPStruct"/>
</message>
<message name="echoStructResponse">
<part name="return" type="s:SOAPStruct"/>
</message>
<message name="echoStructArrayRequest">
<part name="inputStructArray" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoStructArrayResponse">
<part name="return" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoVoidRequest"/>
<message name="echoVoidResponse"/>
<message name="echoBase64Request">
<part name="inputBase64" type="xsd:base64Binary"/>
</message>
<message name="echoBase64Response">
<part name="return" type="xsd:base64Binary"/>
</message>
<message name="echoDateRequest">
<part name="inputDate" type="xsd:dateTime"/>
</message>
<message name="echoDateResponse">
<part name="return" type="xsd:dateTime"/>
</message>
<message name="echoHexBinaryRequest">
<part name="inputHexBinary" type="xsd:hexBinary"/>
</message>
<message name="echoHexBinaryResponse">
<part name="return" type="xsd:hexBinary"/>
</message>
<message name="echoDecimalRequest">
<part name="inputDecimal" type="xsd:decimal"/>
</message>
<message name="echoDecimalResponse">
<part name="return" type="xsd:decimal"/>
</message>
<message name="echoBooleanRequest">
<part name="inputBoolean" type="xsd:boolean"/>
</message>
<message name="echoBooleanResponse">
<part name="return" type="xsd:boolean"/>
</message>
<portType name="InteropTestPortType">
<operation name="echoString" parameterOrder="inputString">
<input message="tns:echoStringRequest"/>
<output message="tns:echoStringResponse"/>
</operation>
<operation name="echoStringArray" parameterOrder="inputStringArray">
<input message="tns:echoStringArrayRequest"/>
<output message="tns:echoStringArrayResponse"/>
</operation>
<operation name="echoInteger" parameterOrder="inputInteger">
<input message="tns:echoIntegerRequest"/>
<output message="tns:echoIntegerResponse"/>
</operation>
<operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
<input message="tns:echoIntegerArrayRequest"/>
<output message="tns:echoIntegerArrayResponse"/>
</operation>
<operation name="echoFloat" parameterOrder="inputFloat">
<input message="tns:echoFloatRequest"/>
<output message="tns:echoFloatResponse"/>
</operation>
<operation name="echoFloatArray" parameterOrder="inputFloatArray">
<input message="tns:echoFloatArrayRequest"/>
<output message="tns:echoFloatArrayResponse"/>
</operation>
<operation name="echoStruct" parameterOrder="inputStruct">
<input message="tns:echoStructRequest"/>
<output message="tns:echoStructResponse"/>
</operation>
<operation name="echoStructArray" parameterOrder="inputStructArray">
<input message="tns:echoStructArrayRequest"/>
<output message="tns:echoStructArrayResponse"/>
</operation>
<operation name="echoVoid">
<input message="tns:echoVoidRequest"/>
<output message="tns:echoVoidResponse"/>
</operation>
<operation name="echoBase64" parameterOrder="inputBase64">
<input message="tns:echoBase64Request"/>
<output message="tns:echoBase64Response"/>
</operation>
<operation name="echoDate" parameterOrder="inputDate">
<input message="tns:echoDateRequest"/>
<output message="tns:echoDateResponse"/>
</operation>
<operation name="echoHexBinary" parameterOrder="inputHexBinary">
<input message="tns:echoHexBinaryRequest"/>
<output message="tns:echoHexBinaryResponse"/>
</operation>
<operation name="echoDecimal" parameterOrder="inputDecimal">
<input message="tns:echoDecimalRequest"/>
<output message="tns:echoDecimalResponse"/>
</operation>
<operation name="echoBoolean" parameterOrder="inputBoolean">
<input message="tns:echoBooleanRequest"/>
<output message="tns:echoBooleanResponse"/>
</operation>
</portType>
<binding name="InteropTestSoapBinding" type="tns:InteropTestPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoString">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoInteger">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoIntegerArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloat">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloatArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStructArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoVoid">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBase64">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDate">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoHexBinary">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDecimal">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBoolean">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
</definitions>

View file

@ -1,208 +0,0 @@
<?xml version="1.0"?>
<definitions name="InteropTest" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://soapinterop.org/" xmlns:s="http://soapinterop.org/xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<import location="InteropTest.wsdl" namespace="http://soapinterop.org/"/>
<import location="InteropTest.wsdl" namespace="http://soapinterop.org/xsd"/>
<message name="echoHeaderString_Request">
<part name="echoMeStringRequest" type="xsd:string"/>
</message>
<message name="echoHeaderString_Response">
<part name="echoMeStringResponse" type="xsd:string"/>
</message>
<message name="echoHeaderStruct_Request">
<part name="echoMeStructRequest" type="s:SOAPStruct"/>
</message>
<message name="echoHeaderStruct_Response">
<part name="echoMeStructResponse" type="s:SOAPStruct"/>
</message>
<binding name="InteropEchoHeaderBinding" type="tns:InteropTestPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoString">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoInteger">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoIntegerArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloat">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloatArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStructArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoVoid">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBase64">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDate">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoHexBinary">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDecimal">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBoolean">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Request" part="echoMeStringRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Request" part="echoMeStructRequest" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderString_Response" part="echoMeStringResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:header use="encoded" message="tns:echoHeaderStruct_Response" part="echoMeStructResponse" namespace="http://soapinterop.org/echoheader/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
</definitions>

View file

@ -1,327 +0,0 @@
require 'InteropTest.rb'
require 'soap/rpc/driver'
class InteropTestPortType < ::SOAP::RPC::Driver
DefaultEndpointUrl = "http://dev.ctor.org/soapsrv"
MappingRegistry = ::SOAP::Mapping::Registry.new
MappingRegistry.set(
ArrayOfstring,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
)
MappingRegistry.set(
ArrayOfint,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "int") }
)
MappingRegistry.set(
ArrayOffloat,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "float") }
)
MappingRegistry.set(
SOAPStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") }
)
MappingRegistry.set(
ArrayOfSOAPStruct,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") }
)
Methods = [
["echoString", "echoString",
[
["in", "inputString", ["::SOAP::SOAPString"]],
["retval", "return", ["::SOAP::SOAPString"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStringArray", "echoStringArray",
[
["in", "inputStringArray", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]],
["retval", "return", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoInteger", "echoInteger",
[
["in", "inputInteger", ["::SOAP::SOAPInt"]],
["retval", "return", ["::SOAP::SOAPInt"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoIntegerArray", "echoIntegerArray",
[
["in", "inputIntegerArray", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]],
["retval", "return", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoFloat", "echoFloat",
[
["in", "inputFloat", ["::SOAP::SOAPFloat"]],
["retval", "return", ["::SOAP::SOAPFloat"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoFloatArray", "echoFloatArray",
[
["in", "inputFloatArray", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]],
["retval", "return", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStruct", "echoStruct",
[
["in", "inputStruct", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]],
["retval", "return", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStructArray", "echoStructArray",
[
["in", "inputStructArray", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]],
["retval", "return", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoVoid", "echoVoid",
[],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoBase64", "echoBase64",
[
["in", "inputBase64", ["::SOAP::SOAPBase64"]],
["retval", "return", ["::SOAP::SOAPBase64"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoDate", "echoDate",
[
["in", "inputDate", ["::SOAP::SOAPDateTime"]],
["retval", "return", ["::SOAP::SOAPDateTime"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoHexBinary", "echoHexBinary",
[
["in", "inputHexBinary", ["::SOAP::SOAPHexBinary"]],
["retval", "return", ["::SOAP::SOAPHexBinary"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoDecimal", "echoDecimal",
[
["in", "inputDecimal", ["::SOAP::SOAPDecimal"]],
["retval", "return", ["::SOAP::SOAPDecimal"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoBoolean", "echoBoolean",
[
["in", "inputBoolean", ["::SOAP::SOAPBoolean"]],
["retval", "return", ["::SOAP::SOAPBoolean"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
]
]
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, style|
qname = XSD::QName.new(namespace, name_as)
if style == :document
@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
end
end
require 'soap/rpc/driver'
class InteropTestPortType < ::SOAP::RPC::Driver
DefaultEndpointUrl = "http://dev.ctor.org/soapsrv"
MappingRegistry = ::SOAP::Mapping::Registry.new
MappingRegistry.set(
ArrayOfstring,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
)
MappingRegistry.set(
ArrayOfint,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "int") }
)
MappingRegistry.set(
ArrayOffloat,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "float") }
)
MappingRegistry.set(
SOAPStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") }
)
MappingRegistry.set(
ArrayOfSOAPStruct,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") }
)
Methods = [
["echoString", "echoString",
[
["in", "inputString", ["::SOAP::SOAPString"]],
["retval", "return", ["::SOAP::SOAPString"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStringArray", "echoStringArray",
[
["in", "inputStringArray", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]],
["retval", "return", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoInteger", "echoInteger",
[
["in", "inputInteger", ["::SOAP::SOAPInt"]],
["retval", "return", ["::SOAP::SOAPInt"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoIntegerArray", "echoIntegerArray",
[
["in", "inputIntegerArray", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]],
["retval", "return", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoFloat", "echoFloat",
[
["in", "inputFloat", ["::SOAP::SOAPFloat"]],
["retval", "return", ["::SOAP::SOAPFloat"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoFloatArray", "echoFloatArray",
[
["in", "inputFloatArray", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]],
["retval", "return", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStruct", "echoStruct",
[
["in", "inputStruct", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]],
["retval", "return", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoStructArray", "echoStructArray",
[
["in", "inputStructArray", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]],
["retval", "return", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoVoid", "echoVoid",
[],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoBase64", "echoBase64",
[
["in", "inputBase64", ["::SOAP::SOAPBase64"]],
["retval", "return", ["::SOAP::SOAPBase64"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoDate", "echoDate",
[
["in", "inputDate", ["::SOAP::SOAPDateTime"]],
["retval", "return", ["::SOAP::SOAPDateTime"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoHexBinary", "echoHexBinary",
[
["in", "inputHexBinary", ["::SOAP::SOAPHexBinary"]],
["retval", "return", ["::SOAP::SOAPHexBinary"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoDecimal", "echoDecimal",
[
["in", "inputDecimal", ["::SOAP::SOAPDecimal"]],
["retval", "return", ["::SOAP::SOAPDecimal"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
],
["echoBoolean", "echoBoolean",
[
["in", "inputBoolean", ["::SOAP::SOAPBoolean"]],
["retval", "return", ["::SOAP::SOAPBoolean"]]
],
"http://soapinterop.org/", "http://soapinterop.org/", :rpc
]
]
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, style|
qname = XSD::QName.new(namespace, name_as)
if style == :document
@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
end
end

View file

@ -1,2 +0,0 @@
Clients/Server for SOAPBuilders Interoperability Lab "Round 2"
http://www.whitemesa.com/interop.htm

View file

@ -1,461 +0,0 @@
<?xml version="1.0"?>
<definitions name="SOAP4R_SOAPBuildersInteropTest_R2base"
targetNamespace="http://soapinterop.org/"
xmlns:tns="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://soapinterop.org/xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapinterop.org/xsd">
<import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOfstring">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfint">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOffloat">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="float[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfSOAPStruct">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="s:SOAPStruct[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="SOAPStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
</all>
</complexType>
<complexType name="SOAPStructStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
<element name="varStruct" type="s:SOAPStruct"/>
</all>
</complexType>
<complexType name="SOAPArrayStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
<element name="varArray" type="s:ArrayOfstring"/>
</all>
</complexType>
<complexType name="ArrayOfString2D">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[,]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</types>
<message name="echoStringRequest">
<part name="inputString" type="xsd:string"/>
</message>
<message name="echoStringResponse">
<part name="return" type="xsd:string"/>
</message>
<message name="echoStringArrayRequest">
<part name="inputStringArray" type="s:ArrayOfstring"/>
</message>
<message name="echoStringArrayResponse">
<part name="return" type="s:ArrayOfstring"/>
</message>
<message name="echoIntegerRequest">
<part name="inputInteger" type="xsd:int"/>
</message>
<message name="echoIntegerResponse">
<part name="return" type="xsd:int"/>
</message>
<message name="echoIntegerArrayRequest">
<part name="inputIntegerArray" type="s:ArrayOfint"/>
</message>
<message name="echoIntegerArrayResponse">
<part name="return" type="s:ArrayOfint"/>
</message>
<message name="echoFloatRequest">
<part name="inputFloat" type="xsd:float"/>
</message>
<message name="echoFloatResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="echoFloatArrayRequest">
<part name="inputFloatArray" type="s:ArrayOffloat"/>
</message>
<message name="echoFloatArrayResponse">
<part name="return" type="s:ArrayOffloat"/>
</message>
<message name="echoStructRequest">
<part name="inputStruct" type="s:SOAPStruct"/>
</message>
<message name="echoStructResponse">
<part name="return" type="s:SOAPStruct"/>
</message>
<message name="echoStructArrayRequest">
<part name="inputStructArray" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoStructArrayResponse">
<part name="return" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoVoidRequest"/>
<message name="echoVoidResponse"/>
<message name="echoBase64Request">
<part name="inputBase64" type="xsd:base64Binary"/>
</message>
<message name="echoBase64Response">
<part name="return" type="xsd:base64Binary"/>
</message>
<message name="echoDateRequest">
<part name="inputDate" type="xsd:dateTime"/>
</message>
<message name="echoDateResponse">
<part name="return" type="xsd:dateTime"/>
</message>
<message name="echoHexBinaryRequest">
<part name="inputHexBinary" type="xsd:hexBinary"/>
</message>
<message name="echoHexBinaryResponse">
<part name="return" type="xsd:hexBinary"/>
</message>
<message name="echoDecimalRequest">
<part name="inputDecimal" type="xsd:decimal"/>
</message>
<message name="echoDecimalResponse">
<part name="return" type="xsd:decimal"/>
</message>
<message name="echoBooleanRequest">
<part name="inputBoolean" type="xsd:boolean"/>
</message>
<message name="echoBooleanResponse">
<part name="return" type="xsd:boolean"/>
</message>
<message name="echoStructAsSimpleTypesRequest">
<part name="inputStruct" type="s:SOAPStruct"/>
</message>
<message name="echoStructAsSimpleTypesResponse">
<part name="outputString" type="xsd:string"/>
<part name="outputInteger" type="xsd:int"/>
<part name="outputFloat" type="xsd:float"/>
</message>
<message name="echoSimpleTypesAsStructRequest">
<part name="inputString" type="xsd:string"/>
<part name="inputInteger" type="xsd:int"/>
<part name="inputFloat" type="xsd:float"/>
</message>
<message name="echoSimpleTypesAsStructResponse">
<part name="return" type="s:SOAPStruct"/>
</message>
<message name="echo2DStringArrayRequest">
<part name="input2DStringArray" type="s:ArrayOfString2D"/>
</message>
<message name="echo2DStringArrayResponse">
<part name="return" type="s:ArrayOfString2D"/>
</message>
<message name="echoNestedStructRequest">
<part name="inputStruct" type="s:SOAPStructStruct"/>
</message>
<message name="echoNestedStructResponse">
<part name="return" type="s:SOAPStructStruct"/>
</message>
<message name="echoNestedArrayRequest">
<part name="inputStruct" type="s:SOAPArrayStruct"/>
</message>
<message name="echoNestedArrayResponse">
<part name="return" type="s:SOAPArrayStruct"/>
</message>
<portType name="InteropTestPortType">
<operation name="echoString" parameterOrder="inputString">
<input message="tns:echoStringRequest"/>
<output message="tns:echoStringResponse"/>
</operation>
<operation name="echoStringArray" parameterOrder="inputStringArray">
<input message="tns:echoStringArrayRequest"/>
<output message="tns:echoStringArrayResponse"/>
</operation>
<operation name="echoInteger" parameterOrder="inputInteger">
<input message="tns:echoIntegerRequest"/>
<output message="tns:echoIntegerResponse"/>
</operation>
<operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
<input message="tns:echoIntegerArrayRequest"/>
<output message="tns:echoIntegerArrayResponse"/>
</operation>
<operation name="echoFloat" parameterOrder="inputFloat">
<input message="tns:echoFloatRequest"/>
<output message="tns:echoFloatResponse"/>
</operation>
<operation name="echoFloatArray" parameterOrder="inputFloatArray">
<input message="tns:echoFloatArrayRequest"/>
<output message="tns:echoFloatArrayResponse"/>
</operation>
<operation name="echoStruct" parameterOrder="inputStruct">
<input message="tns:echoStructRequest"/>
<output message="tns:echoStructResponse"/>
</operation>
<operation name="echoStructArray" parameterOrder="inputStructArray">
<input message="tns:echoStructArrayRequest"/>
<output message="tns:echoStructArrayResponse"/>
</operation>
<operation name="echoVoid">
<input message="tns:echoVoidRequest"/>
<output message="tns:echoVoidResponse"/>
</operation>
<operation name="echoBase64" parameterOrder="inputBase64">
<input message="tns:echoBase64Request"/>
<output message="tns:echoBase64Response"/>
</operation>
<operation name="echoDate" parameterOrder="inputDate">
<input message="tns:echoDateRequest"/>
<output message="tns:echoDateResponse"/>
</operation>
<operation name="echoHexBinary" parameterOrder="inputHexBinary">
<input message="tns:echoHexBinaryRequest"/>
<output message="tns:echoHexBinaryResponse"/>
</operation>
<operation name="echoDecimal" parameterOrder="inputDecimal">
<input message="tns:echoDecimalRequest"/>
<output message="tns:echoDecimalResponse"/>
</operation>
<operation name="echoBoolean" parameterOrder="inputBoolean">
<input message="tns:echoBooleanRequest"/>
<output message="tns:echoBooleanResponse"/>
</operation>
</portType>
<portType name="InteropTestPortTypeB">
<operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
<input message="tns:echoStructAsSimpleTypesRequest"/>
<output message="tns:echoStructAsSimpleTypesResponse"/>
</operation>
<operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
<input message="tns:echoSimpleTypesAsStructRequest"/>
<output message="tns:echoSimpleTypesAsStructResponse"/>
</operation>
<operation name="echo2DStringArray" parameterOrder="input2DStringArray">
<input message="tns:echo2DStringArrayRequest"/>
<output message="tns:echo2DStringArrayResponse"/>
</operation>
<operation name="echoNestedStruct" parameterOrder="inputStruct">
<input message="tns:echoNestedStructRequest"/>
<output message="tns:echoNestedStructResponse"/>
</operation>
<operation name="echoNestedArray" parameterOrder="inputStruct">
<input message="tns:echoNestedArrayRequest"/>
<output message="tns:echoNestedArrayResponse"/>
</operation>
</portType>
<binding name="InteropTestSoapBinding" type="tns:InteropTestPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoString">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoInteger">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoIntegerArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloat">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloatArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStructArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoVoid">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBase64">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDate">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoHexBinary">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDecimal">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBoolean">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<binding name="InteropTestSoapBindingB" type="tns:InteropTestPortTypeB">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoStructAsSimpleTypes">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoSimpleTypesAsStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echo2DStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoNestedStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoNestedArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="SOAP4R_SOAPBuildersInteropTest_R2">
<port name="InteropTestSoapPort" binding="tns:InteropTestSoapBinding">
<soap:address location="http://localhost:10080"/>
</port>
<port name="InteropTestSoapPortB" binding="tns:InteropTestSoapBindingB">
<soap:address location="http://localhost:10080"/>
</port>
</service>
</definitions>

View file

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<definitions name="SOAP4R_SOAPBuildersInteropTest_R2GroupB"
targetNamespace="http://soapinterop.org/"
xmlns:tns="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<import
namespace="http://soapinterop.org/"
location="http://www.whitemesa.com/interop/InteropTestB.wsdl"/>
<service name="SOAP4R_SOAPBuildersInteropTest_R2GroupB">
<port name="InteropTestSoapPort"
binding="tns:InteropTestSoapBindingB">
<soap:address
location="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/"/>
</port>
</service>
</definitions>

View file

@ -1,176 +0,0 @@
#!/usr/bin/env ruby
require 'InteropTestDriver.rb'
endpoint_url = ARGV.shift
obj = InteropTestPortType.new(endpoint_url)
# Uncomment the below line to see SOAP wiredumps.
# obj.wiredump_dev = STDERR
# SYNOPSIS
# echoString(inputString)
#
# ARGS
# inputString String - {http://www.w3.org/2001/XMLSchema}string
#
# RETURNS
# v_return String - {http://www.w3.org/2001/XMLSchema}string
#
inputString = nil
puts obj.echoString(inputString)
# SYNOPSIS
# echoStringArray(inputStringArray)
#
# ARGS
# inputStringArray ArrayOfstring - {http://soapinterop.org/xsd}ArrayOfstring
#
# RETURNS
# v_return ArrayOfstring - {http://soapinterop.org/xsd}ArrayOfstring
#
inputStringArray = nil
puts obj.echoStringArray(inputStringArray)
# SYNOPSIS
# echoInteger(inputInteger)
#
# ARGS
# inputInteger Int - {http://www.w3.org/2001/XMLSchema}int
#
# RETURNS
# v_return Int - {http://www.w3.org/2001/XMLSchema}int
#
inputInteger = nil
puts obj.echoInteger(inputInteger)
# SYNOPSIS
# echoIntegerArray(inputIntegerArray)
#
# ARGS
# inputIntegerArray ArrayOfint - {http://soapinterop.org/xsd}ArrayOfint
#
# RETURNS
# v_return ArrayOfint - {http://soapinterop.org/xsd}ArrayOfint
#
inputIntegerArray = nil
puts obj.echoIntegerArray(inputIntegerArray)
# SYNOPSIS
# echoFloat(inputFloat)
#
# ARGS
# inputFloat Float - {http://www.w3.org/2001/XMLSchema}float
#
# RETURNS
# v_return Float - {http://www.w3.org/2001/XMLSchema}float
#
inputFloat = nil
puts obj.echoFloat(inputFloat)
# SYNOPSIS
# echoFloatArray(inputFloatArray)
#
# ARGS
# inputFloatArray ArrayOffloat - {http://soapinterop.org/xsd}ArrayOffloat
#
# RETURNS
# v_return ArrayOffloat - {http://soapinterop.org/xsd}ArrayOffloat
#
inputFloatArray = nil
puts obj.echoFloatArray(inputFloatArray)
# SYNOPSIS
# echoStruct(inputStruct)
#
# ARGS
# inputStruct SOAPStruct - {http://soapinterop.org/xsd}SOAPStruct
#
# RETURNS
# v_return SOAPStruct - {http://soapinterop.org/xsd}SOAPStruct
#
inputStruct = nil
puts obj.echoStruct(inputStruct)
# SYNOPSIS
# echoStructArray(inputStructArray)
#
# ARGS
# inputStructArray ArrayOfSOAPStruct - {http://soapinterop.org/xsd}ArrayOfSOAPStruct
#
# RETURNS
# v_return ArrayOfSOAPStruct - {http://soapinterop.org/xsd}ArrayOfSOAPStruct
#
inputStructArray = nil
puts obj.echoStructArray(inputStructArray)
# SYNOPSIS
# echoVoid
#
# ARGS
# N/A
#
# RETURNS
# N/A
#
puts obj.echoVoid
# SYNOPSIS
# echoBase64(inputBase64)
#
# ARGS
# inputBase64 Base64Binary - {http://www.w3.org/2001/XMLSchema}base64Binary
#
# RETURNS
# v_return Base64Binary - {http://www.w3.org/2001/XMLSchema}base64Binary
#
inputBase64 = nil
puts obj.echoBase64(inputBase64)
# SYNOPSIS
# echoDate(inputDate)
#
# ARGS
# inputDate DateTime - {http://www.w3.org/2001/XMLSchema}dateTime
#
# RETURNS
# v_return DateTime - {http://www.w3.org/2001/XMLSchema}dateTime
#
inputDate = nil
puts obj.echoDate(inputDate)
# SYNOPSIS
# echoHexBinary(inputHexBinary)
#
# ARGS
# inputHexBinary HexBinary - {http://www.w3.org/2001/XMLSchema}hexBinary
#
# RETURNS
# v_return HexBinary - {http://www.w3.org/2001/XMLSchema}hexBinary
#
inputHexBinary = nil
puts obj.echoHexBinary(inputHexBinary)
# SYNOPSIS
# echoDecimal(inputDecimal)
#
# ARGS
# inputDecimal Decimal - {http://www.w3.org/2001/XMLSchema}decimal
#
# RETURNS
# v_return Decimal - {http://www.w3.org/2001/XMLSchema}decimal
#
inputDecimal = nil
puts obj.echoDecimal(inputDecimal)
# SYNOPSIS
# echoBoolean(inputBoolean)
#
# ARGS
# inputBoolean Boolean - {http://www.w3.org/2001/XMLSchema}boolean
#
# RETURNS
# v_return Boolean - {http://www.w3.org/2001/XMLSchema}boolean
#
inputBoolean = nil
puts obj.echoBoolean(inputBoolean)

View file

@ -1,461 +0,0 @@
<?xml version="1.0"?>
<definitions name="SOAP4R_SOAPBuildersInteropTest_R2base"
targetNamespace="http://soapinterop.org/"
xmlns:tns="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://soapinterop.org/xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapinterop.org/xsd">
<import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOfstring">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfint">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOffloat">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="float[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfSOAPStruct">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="s:SOAPStruct[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="SOAPStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
</all>
</complexType>
<complexType name="SOAPStructStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
<element name="varStruct" type="s:SOAPStruct"/>
</all>
</complexType>
<complexType name="SOAPArrayStruct">
<all>
<element name="varString" type="string"/>
<element name="varInt" type="int"/>
<element name="varFloat" type="float"/>
<element name="varArray" type="s:ArrayOfstring"/>
</all>
</complexType>
<complexType name="ArrayOfString2D">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[,]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</types>
<message name="echoStringRequest">
<part name="inputString" type="xsd:string"/>
</message>
<message name="echoStringResponse">
<part name="return" type="xsd:string"/>
</message>
<message name="echoStringArrayRequest">
<part name="inputStringArray" type="s:ArrayOfstring"/>
</message>
<message name="echoStringArrayResponse">
<part name="return" type="s:ArrayOfstring"/>
</message>
<message name="echoIntegerRequest">
<part name="inputInteger" type="xsd:int"/>
</message>
<message name="echoIntegerResponse">
<part name="return" type="xsd:int"/>
</message>
<message name="echoIntegerArrayRequest">
<part name="inputIntegerArray" type="s:ArrayOfint"/>
</message>
<message name="echoIntegerArrayResponse">
<part name="return" type="s:ArrayOfint"/>
</message>
<message name="echoFloatRequest">
<part name="inputFloat" type="xsd:float"/>
</message>
<message name="echoFloatResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="echoFloatArrayRequest">
<part name="inputFloatArray" type="s:ArrayOffloat"/>
</message>
<message name="echoFloatArrayResponse">
<part name="return" type="s:ArrayOffloat"/>
</message>
<message name="echoStructRequest">
<part name="inputStruct" type="s:SOAPStruct"/>
</message>
<message name="echoStructResponse">
<part name="return" type="s:SOAPStruct"/>
</message>
<message name="echoStructArrayRequest">
<part name="inputStructArray" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoStructArrayResponse">
<part name="return" type="s:ArrayOfSOAPStruct"/>
</message>
<message name="echoVoidRequest"/>
<message name="echoVoidResponse"/>
<message name="echoBase64Request">
<part name="inputBase64" type="xsd:base64Binary"/>
</message>
<message name="echoBase64Response">
<part name="return" type="xsd:base64Binary"/>
</message>
<message name="echoDateRequest">
<part name="inputDate" type="xsd:dateTime"/>
</message>
<message name="echoDateResponse">
<part name="return" type="xsd:dateTime"/>
</message>
<message name="echoHexBinaryRequest">
<part name="inputHexBinary" type="xsd:hexBinary"/>
</message>
<message name="echoHexBinaryResponse">
<part name="return" type="xsd:hexBinary"/>
</message>
<message name="echoDecimalRequest">
<part name="inputDecimal" type="xsd:decimal"/>
</message>
<message name="echoDecimalResponse">
<part name="return" type="xsd:decimal"/>
</message>
<message name="echoBooleanRequest">
<part name="inputBoolean" type="xsd:boolean"/>
</message>
<message name="echoBooleanResponse">
<part name="return" type="xsd:boolean"/>
</message>
<message name="echoStructAsSimpleTypesRequest">
<part name="inputStruct" type="s:SOAPStruct"/>
</message>
<message name="echoStructAsSimpleTypesResponse">
<part name="outputString" type="xsd:string"/>
<part name="outputInteger" type="xsd:int"/>
<part name="outputFloat" type="xsd:float"/>
</message>
<message name="echoSimpleTypesAsStructRequest">
<part name="inputString" type="xsd:string"/>
<part name="inputInteger" type="xsd:int"/>
<part name="inputFloat" type="xsd:float"/>
</message>
<message name="echoSimpleTypesAsStructResponse">
<part name="return" type="s:SOAPStruct"/>
</message>
<message name="echo2DStringArrayRequest">
<part name="input2DStringArray" type="s:ArrayOfString2D"/>
</message>
<message name="echo2DStringArrayResponse">
<part name="return" type="s:ArrayOfString2D"/>
</message>
<message name="echoNestedStructRequest">
<part name="inputStruct" type="s:SOAPStructStruct"/>
</message>
<message name="echoNestedStructResponse">
<part name="return" type="s:SOAPStructStruct"/>
</message>
<message name="echoNestedArrayRequest">
<part name="inputStruct" type="s:SOAPArrayStruct"/>
</message>
<message name="echoNestedArrayResponse">
<part name="return" type="s:SOAPArrayStruct"/>
</message>
<portType name="InteropTestPortType">
<operation name="echoString" parameterOrder="inputString">
<input message="tns:echoStringRequest"/>
<output message="tns:echoStringResponse"/>
</operation>
<operation name="echoStringArray" parameterOrder="inputStringArray">
<input message="tns:echoStringArrayRequest"/>
<output message="tns:echoStringArrayResponse"/>
</operation>
<operation name="echoInteger" parameterOrder="inputInteger">
<input message="tns:echoIntegerRequest"/>
<output message="tns:echoIntegerResponse"/>
</operation>
<operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
<input message="tns:echoIntegerArrayRequest"/>
<output message="tns:echoIntegerArrayResponse"/>
</operation>
<operation name="echoFloat" parameterOrder="inputFloat">
<input message="tns:echoFloatRequest"/>
<output message="tns:echoFloatResponse"/>
</operation>
<operation name="echoFloatArray" parameterOrder="inputFloatArray">
<input message="tns:echoFloatArrayRequest"/>
<output message="tns:echoFloatArrayResponse"/>
</operation>
<operation name="echoStruct" parameterOrder="inputStruct">
<input message="tns:echoStructRequest"/>
<output message="tns:echoStructResponse"/>
</operation>
<operation name="echoStructArray" parameterOrder="inputStructArray">
<input message="tns:echoStructArrayRequest"/>
<output message="tns:echoStructArrayResponse"/>
</operation>
<operation name="echoVoid">
<input message="tns:echoVoidRequest"/>
<output message="tns:echoVoidResponse"/>
</operation>
<operation name="echoBase64" parameterOrder="inputBase64">
<input message="tns:echoBase64Request"/>
<output message="tns:echoBase64Response"/>
</operation>
<operation name="echoDate" parameterOrder="inputDate">
<input message="tns:echoDateRequest"/>
<output message="tns:echoDateResponse"/>
</operation>
<operation name="echoHexBinary" parameterOrder="inputHexBinary">
<input message="tns:echoHexBinaryRequest"/>
<output message="tns:echoHexBinaryResponse"/>
</operation>
<operation name="echoDecimal" parameterOrder="inputDecimal">
<input message="tns:echoDecimalRequest"/>
<output message="tns:echoDecimalResponse"/>
</operation>
<operation name="echoBoolean" parameterOrder="inputBoolean">
<input message="tns:echoBooleanRequest"/>
<output message="tns:echoBooleanResponse"/>
</operation>
</portType>
<portType name="InteropTestPortTypeB">
<operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
<input message="tns:echoStructAsSimpleTypesRequest"/>
<output message="tns:echoStructAsSimpleTypesResponse"/>
</operation>
<operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
<input message="tns:echoSimpleTypesAsStructRequest"/>
<output message="tns:echoSimpleTypesAsStructResponse"/>
</operation>
<operation name="echo2DStringArray" parameterOrder="input2DStringArray">
<input message="tns:echo2DStringArrayRequest"/>
<output message="tns:echo2DStringArrayResponse"/>
</operation>
<operation name="echoNestedStruct" parameterOrder="inputStruct">
<input message="tns:echoNestedStructRequest"/>
<output message="tns:echoNestedStructResponse"/>
</operation>
<operation name="echoNestedArray" parameterOrder="inputStruct">
<input message="tns:echoNestedArrayRequest"/>
<output message="tns:echoNestedArrayResponse"/>
</operation>
</portType>
<binding name="InteropTestSoapBinding" type="tns:InteropTestPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoString">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoInteger">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoIntegerArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloat">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoFloatArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoStructArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoVoid">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBase64">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDate">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoHexBinary">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoDecimal">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoBoolean">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<binding name="InteropTestSoapBindingB" type="tns:InteropTestPortTypeB">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="echoStructAsSimpleTypes">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoSimpleTypesAsStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echo2DStringArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoNestedStruct">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="echoNestedArray">
<soap:operation soapAction="http://soapinterop.org/"/>
<input>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="SOAP4R_SOAPBuildersInteropTest_R2">
<port name="InteropTestSoapPort" binding="tns:InteropTestSoapBinding">
<soap:address location="http://localhost:10080"/>
</port>
<port name="InteropTestSoapPortB" binding="tns:InteropTestSoapBindingB">
<soap:address location="http://localhost:10080"/>
</port>
</service>
</definitions>

View file

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<definitions name="SOAP4R_SOAPBuildersInteropTest_R2GroupB"
targetNamespace="http://soapinterop.org/"
xmlns:tns="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<import
namespace="http://soapinterop.org/"
location="http://www.whitemesa.com/interop/InteropTestB.wsdl"/>
<service name="SOAP4R_SOAPBuildersInteropTest_R2GroupB">
<port name="InteropTestSoapPort"
binding="tns:InteropTestSoapBindingB">
<soap:address location="http://dev.ctor.org/soapsrv"/>
</port>
</service>
</definitions>

View file

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<definitions name="InteropTest"
targetNamespace="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://soapinterop.org/">
<import location="http://www.whitemesa.com/interop/InteropTestC.wsdl"
namespace="http://soapinterop.org/"/>
<service name="SOAP4R_SOAPBuildersInteropTest_R2GroupC">
<port name="InteropEchoHeaderService"
binding="tns:InteropEchoHeaderBinding">
<soap:address location="http://dev.ctor.org/soapsrv"/>
</port>
</service>
</definitions>

View file

@ -1,288 +0,0 @@
require 'soap/soap'
require 'soap/mapping'
InterfaceNS = 'http://soapinterop.org/'
TypeNS = 'http://soapinterop.org/xsd'
ApacheNS = 'http://xml.apache.org/xml-soap'
module SOAPBuildersInterop
extend SOAP
MethodsBase = [
['echoVoid'],
['echoString',
['in', 'inputString', nil], ['retval', 'return', nil]],
['echoStringArray',
['in', 'inputStringArray', nil], ['retval', 'return', nil]],
['echoInteger',
['in', 'inputInteger', nil], ['retval', 'return', nil]],
['echoIntegerArray',
['in', 'inputIntegerArray', nil], ['retval', 'return', nil]],
['echoFloat',
['in', 'inputFloat', nil], ['retval', 'return', nil]],
['echoFloatArray',
['in', 'inputFloatArray', nil], ['retval', 'return', nil]],
['echoStruct',
['in', 'inputStruct', nil], ['retval', 'return', nil]],
['echoStructArray',
['in', 'inputStructArray', nil], ['retval', 'return', nil]],
['echoDate',
['in', 'inputDate', nil], ['retval', 'return', nil]],
['echoBase64',
['in', 'inputBase64', nil], ['retval', 'return', nil]],
['echoHexBinary',
['in', 'inputHexBinary', nil], ['retval', 'return', nil]],
['echoBoolean',
['in', 'inputBoolean', nil], ['retval', 'return', nil]],
['echoDecimal',
['in', 'inputDecimal', nil], ['retval', 'return', nil]],
['echoMap',
['in', 'inputMap', nil], ['retval', 'return', nil]],
['echoMapArray',
['in', 'inputMapArray', nil], ['retval', 'return', nil]],
['echoDouble',
['in', 'inputDouble', nil], ['retval', 'return', nil]],
['echoXSDDateTime',
['in', 'inputXSDDateTime', nil], ['retval', 'return', nil]],
['echoXSDDate',
['in', 'inputXSDDate', nil], ['retval', 'return', nil]],
['echoXSDTime',
['in', 'inputXSDTime', nil], ['retval', 'return', nil]],
]
MethodsGroupB = [
['echoStructAsSimpleTypes',
['in', 'inputStruct', nil], ['out', 'outputString', nil], ['out', 'outputInteger', nil], ['out', 'outputFloat', nil]],
['echoSimpleTypesAsStruct',
['in', 'inputString', nil], ['in', 'inputInteger', nil], ['in', 'inputFloat', nil], ['retval', 'return', nil]],
['echo2DStringArray',
['in', 'input2DStringArray', nil], ['retval', 'return', nil]],
['echoNestedStruct',
['in', 'inputStruct', nil], ['retval', 'return', nil]],
['echoNestedArray',
['in', 'inputStruct', nil], ['retval', 'return', nil]],
]
MethodsPolyMorph = [
['echoPolyMorph',
['in', 'inputPolyMorph', nil], ['retval', 'return', nil]],
['echoPolyMorphStruct',
['in', 'inputPolyMorphStruct', nil], ['retval', 'return', nil]],
['echoPolyMorphArray',
['in', 'inputPolyMorphArray', nil], ['retval', 'return', nil]],
]
module FloatSupport
def floatEquals( lhs, rhs )
lhsVar = lhs.is_a?( SOAP::SOAPFloat )? lhs.data : lhs
rhsVar = rhs.is_a?( SOAP::SOAPFloat )? rhs.data : rhs
lhsVar == rhsVar
end
end
class SOAPStruct
include SOAP::Marshallable
include FloatSupport
attr_accessor :varInt, :varFloat, :varString
def initialize( varInt, varFloat, varString )
@varInt = varInt
@varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil
@varString = varString
end
def ==( rhs )
r = if rhs.is_a?( self.class )
( self.varInt == rhs.varInt &&
floatEquals( self.varFloat, rhs.varFloat ) &&
self.varString == rhs.varString )
else
false
end
r
end
def to_s
"#{ varInt }:#{ varFloat }:#{ varString }"
end
end
class SOAPStructStruct
include SOAP::Marshallable
include FloatSupport
attr_accessor :varInt, :varFloat, :varString, :varStruct
def initialize( varInt, varFloat, varString, varStruct = nil )
@varInt = varInt
@varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil
@varString = varString
@varStruct = varStruct
end
def ==( rhs )
r = if rhs.is_a?( self.class )
( self.varInt == rhs.varInt &&
floatEquals( self.varFloat, rhs.varFloat ) &&
self.varString == rhs.varString &&
self.varStruct == rhs.varStruct )
else
false
end
r
end
def to_s
"#{ varInt }:#{ varFloat }:#{ varString }:#{ varStruct }"
end
end
class PolyMorphStruct
include SOAP::Marshallable
attr_reader :varA, :varB, :varC
def initialize( varA, varB, varC )
@varA = varA
@varB = varB
@varC = varC
end
def ==( rhs )
r = if rhs.is_a?( self.class )
( self.varA == rhs.varA &&
self.varB == rhs.varB &&
self.varC == rhs.varC )
else
false
end
r
end
def to_s
"#{ varA }:#{ varB }:#{ varC }"
end
end
class SOAPArrayStruct
include SOAP::Marshallable
include FloatSupport
attr_accessor :varInt, :varFloat, :varString, :varArray
def initialize( varInt, varFloat, varString, varArray = nil )
@varInt = varInt
@varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil
@varString = varString
@varArray = varArray
end
def ==( rhs )
r = if rhs.is_a?( self.class )
( self.varInt == rhs.varInt &&
floatEquals( self.varFloat, rhs.varFloat ) &&
self.varString == rhs.varString &&
self.varArray == rhs.varArray )
else
false
end
r
end
def to_s
"#{ varInt }:#{ varFloat }:#{ varString }:#{ varArray }"
end
end
class StringArray < Array; end
class IntArray < Array; end
class FloatArray < Array; end
class SOAPStructArray < Array; end
class SOAPMapArray < Array; end
class ArrayOfanyType < Array; end
MappingRegistry = SOAP::Mapping::Registry.new
MappingRegistry.set(
::SOAPBuildersInterop::SOAPStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new( TypeNS, "SOAPStruct" ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::SOAPStructStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new( TypeNS, "SOAPStructStruct" ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::PolyMorphStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new( TypeNS, "PolyMorphStruct" ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::SOAPArrayStruct,
::SOAP::SOAPStruct,
::SOAP::Mapping::Registry::TypedStructFactory,
{ :type => XSD::QName.new( TypeNS, "SOAPArrayStruct" ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::StringArray,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new( XSD::Namespace, XSD::StringLiteral ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::IntArray,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new( XSD::Namespace, XSD::IntLiteral ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::FloatArray,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new( XSD::Namespace, XSD::FloatLiteral ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::SOAPStructArray,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new( TypeNS, 'SOAPStruct' ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::SOAPMapArray,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::QName.new( ApacheNS, 'Map' ) }
)
MappingRegistry.set(
::SOAPBuildersInterop::ArrayOfanyType,
::SOAP::SOAPArray,
::SOAP::Mapping::Registry::TypedArrayFactory,
{ :type => XSD::AnyTypeName }
)
end

View file

@ -1,17 +0,0 @@
#!/usr/bin/env ruby
$serverName = 'dotNetRemotingWebServices'
$serverBase = 'http://www.mssoapinterop.org/remoting/ServiceA.soap'
$serverGroupB = 'http://www.mssoapinterop.org/remoting/ServiceB.soap'
require 'clientBase'
drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS)
methodDefBase(drvBase)
drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS)
methodDefGroupB(drvGroupB)
doTestBase(drvBase)
doTestGroupB(drvGroupB)
submitTestResult

Some files were not shown because too many files have changed in this diff Show more