soap4r 1.5.6 → 1.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/wsdl2ruby.rb +1 -1
- data/bin/xsd2ruby.rb +12 -4
- data/lib/soap/baseData.rb +3 -1
- data/lib/soap/encodingstyle/literalHandler.rb +3 -2
- data/lib/soap/encodingstyle/soapHandler.rb +7 -4
- data/lib/soap/filter.rb +4 -1
- data/lib/soap/filter/filterchain.rb +1 -1
- data/lib/soap/filter/streamhandler.rb +29 -0
- data/lib/soap/generator.rb +6 -0
- data/lib/soap/httpconfigloader.rb +21 -6
- data/lib/soap/mapping/encodedregistry.rb +2 -1
- data/lib/soap/mapping/literalregistry.rb +31 -16
- data/lib/soap/mapping/registry.rb +5 -1
- data/lib/soap/mapping/rubytypeFactory.rb +3 -0
- data/lib/soap/mapping/wsdlliteralregistry.rb +3 -3
- data/lib/soap/netHttpClient.rb +6 -0
- data/lib/soap/rpc/router.rb +26 -17
- data/lib/soap/soap.rb +4 -4
- data/lib/soap/streamHandler.rb +61 -26
- data/lib/wsdl/soap/classDefCreator.rb +4 -2
- data/lib/wsdl/soap/literalMappingRegistryCreator.rb +7 -2
- data/lib/wsdl/soap/mappingRegistryCreator.rb +0 -2
- data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +2 -0
- data/lib/wsdl/soap/methodDefCreator.rb +6 -3
- data/lib/wsdl/xmlSchema/element.rb +4 -0
- data/lib/wsdl/xmlSchema/importer.rb +21 -9
- data/lib/wsdl/xmlSchema/xsd2ruby.rb +56 -3
- data/lib/xsd/mapping.rb +30 -13
- data/test/interopR2/client.log +5 -0
- data/test/interopR2/client.rb +9 -3
- data/test/interopR2/server.rb +1 -0
- data/test/soap/asp.net/test_aspdotnet.rb +1 -1
- data/test/soap/auth/htdigest +2 -0
- data/test/soap/auth/htpasswd +2 -0
- data/test/soap/auth/test_basic.rb +116 -0
- data/test/soap/auth/test_digest.rb +117 -0
- data/test/soap/htpasswd +2 -0
- data/test/soap/ssl/README +1 -1
- data/test/soap/ssl/test_ssl.rb +9 -9
- data/test/soap/test_cookie.rb +112 -0
- data/test/soap/test_custom_ns.rb +63 -0
- data/test/soap/test_httpconfigloader.rb +20 -5
- data/test/soap/test_mapping.rb +62 -0
- data/test/soap/test_nil.rb +55 -0
- data/test/soap/test_no_indent.rb +1 -1
- data/test/soap/test_streamhandler.rb +26 -14
- data/test/wsdl/datetime/datetimeServant.rb +1 -0
- data/test/wsdl/datetime/test_datetime.rb +4 -0
- data/test/wsdl/document/array/double.wsdl +50 -0
- data/test/wsdl/document/array/test_array.rb +34 -7
- data/test/wsdl/qualified/test_qualified.rb +1 -1
- data/test/wsdl/qualified/test_unqualified.rb +2 -16
- data/test/wsdl/rpc/test_rpc.rb +3 -0
- data/test/wsdl/rpc/test_rpc_lit.rb +1 -1
- data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +2 -2
- data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +2 -2
- data/test/wsdl/soap/wsdl2ruby/section/test_section.rb +1 -1
- data/test/xsd/xsd2ruby/expected_mysample.rb +54 -0
- data/test/xsd/xsd2ruby/expected_mysample_mapper.rb +11 -0
- data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +57 -0
- data/test/xsd/xsd2ruby/section.xsd +41 -0
- data/test/xsd/xsd2ruby/test_xsd2ruby.rb +90 -0
- metadata +31 -12
- data/lib/soap/mapping/encodedregistry.rb~ +0 -531
- data/lib/tags +0 -5144
- data/lib/xsd/classloader.rb +0 -26
- data/test/interopR2/result_client.NetRemoting.txt +0 -0
- data/test/wsdl/rpc/test-rpc-lit-qualified.wsdl +0 -74
- data/test/wsdl/rpc/test-rpc-lit12.wsdl +0 -455
data/bin/wsdl2ruby.rb
CHANGED
@@ -13,7 +13,7 @@ private
|
|
13
13
|
['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT],
|
14
14
|
['--type','-t', GetoptLong::REQUIRED_ARGUMENT],
|
15
15
|
['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT],
|
16
|
-
['--mapping_registry','-r', GetoptLong::
|
16
|
+
['--mapping_registry','-r', GetoptLong::NO_ARGUMENT],
|
17
17
|
['--client_skelton','-c', GetoptLong::OPTIONAL_ARGUMENT],
|
18
18
|
['--servant_skelton','-s', GetoptLong::OPTIONAL_ARGUMENT],
|
19
19
|
['--cgi_stub','-g', GetoptLong::OPTIONAL_ARGUMENT],
|
data/bin/xsd2ruby.rb
CHANGED
@@ -10,7 +10,10 @@ private
|
|
10
10
|
|
11
11
|
OptSet = [
|
12
12
|
['--xsd','-x', GetoptLong::REQUIRED_ARGUMENT],
|
13
|
-
['--
|
13
|
+
['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT],
|
14
|
+
['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT],
|
15
|
+
['--mapping_registry','-r', GetoptLong::NO_ARGUMENT],
|
16
|
+
['--mapper','-p', GetoptLong::NO_ARGUMENT],
|
14
17
|
['--force','-f', GetoptLong::NO_ARGUMENT],
|
15
18
|
['--quiet','-q', GetoptLong::NO_ARGUMENT],
|
16
19
|
]
|
@@ -43,11 +46,14 @@ Usage: #{ $0 } --xsd xsd_location [options]
|
|
43
46
|
xsd_location: filename or URL
|
44
47
|
|
45
48
|
Example:
|
46
|
-
#{ $0 } --xsd myapp.xsd --
|
49
|
+
#{ $0 } --xsd myapp.xsd --classdef foo
|
47
50
|
|
48
51
|
Options:
|
49
52
|
--xsd xsd_location
|
50
|
-
--
|
53
|
+
--classdef [filenameprefix]
|
54
|
+
--mapping_registry
|
55
|
+
--mapper
|
56
|
+
--module_path [Module::Path::Name]
|
51
57
|
--force
|
52
58
|
--quiet
|
53
59
|
__EOU__
|
@@ -62,7 +68,9 @@ __EOU__
|
|
62
68
|
case name
|
63
69
|
when "--xsd"
|
64
70
|
xsd = arg
|
65
|
-
|
71
|
+
when "--module_path"
|
72
|
+
opt['module_path'] = arg
|
73
|
+
when "--classdef", "--mapping_registry", "--mapper"
|
66
74
|
opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg
|
67
75
|
when "--force"
|
68
76
|
opt['force'] = true
|
data/lib/soap/baseData.rb
CHANGED
@@ -580,7 +580,9 @@ class SOAPElement
|
|
580
580
|
|
581
581
|
def initialize(elename, text = nil)
|
582
582
|
super()
|
583
|
-
if
|
583
|
+
if elename.nil?
|
584
|
+
elename = XSD::QName::EMPTY
|
585
|
+
elsif !elename.is_a?(XSD::QName)
|
584
586
|
elename = XSD::QName.new(nil, elename)
|
585
587
|
end
|
586
588
|
@encodingstyle = LiteralNamespace
|
@@ -32,13 +32,14 @@ class LiteralHandler < Handler
|
|
32
32
|
data.extraattr.each do |key, value|
|
33
33
|
next if !@generate_explicit_type and key == XSD::AttrTypeName
|
34
34
|
# ToDo: check generator.attributeformdefault here
|
35
|
+
keytag = key
|
35
36
|
if key.is_a?(XSD::QName)
|
36
|
-
|
37
|
+
keytag = encode_qname(attrs, ns, key)
|
37
38
|
end
|
38
39
|
if value.is_a?(XSD::QName)
|
39
40
|
value = encode_qname(attrs, ns, value)
|
40
41
|
end
|
41
|
-
attrs[
|
42
|
+
attrs[keytag] = value
|
42
43
|
end
|
43
44
|
case data
|
44
45
|
when SOAPExternalReference
|
@@ -297,12 +297,17 @@ private
|
|
297
297
|
attrs[ns.name(XSD::AttrTypeName)] = ns.name(data.type)
|
298
298
|
end
|
299
299
|
end
|
300
|
-
|
301
300
|
data.extraattr.each do |key, value|
|
301
|
+
keytag = key
|
302
302
|
if key.is_a?(XSD::QName)
|
303
303
|
keytag = encode_qname(attrs, ns, key)
|
304
304
|
end
|
305
|
-
|
305
|
+
if value.is_a?(XSD::QName)
|
306
|
+
value = encode_qname(attrs, ns, value)
|
307
|
+
else
|
308
|
+
value = encode_attr_value(generator, ns, key, value)
|
309
|
+
end
|
310
|
+
attrs[keytag] = value
|
306
311
|
end
|
307
312
|
if data.id
|
308
313
|
attrs['id'] = data.id
|
@@ -316,8 +321,6 @@ private
|
|
316
321
|
ref = SOAPReference.new(value)
|
317
322
|
generator.add_reftarget(qname.name, value)
|
318
323
|
ref.refidstr
|
319
|
-
when XSD::QName
|
320
|
-
encode_qname(attrs, ns, value)
|
321
324
|
else
|
322
325
|
value.to_s
|
323
326
|
end
|
data/lib/soap/filter.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SOAP4R - SOAP
|
1
|
+
# SOAP4R - SOAP filter.
|
2
2
|
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
3
3
|
|
4
4
|
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
@@ -7,4 +7,7 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
require 'soap/filter/filterchain'
|
10
|
+
# envelope filter
|
10
11
|
require 'soap/filter/handler'
|
12
|
+
# steram filter
|
13
|
+
require 'soap/filter/streamhandler'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# SOAP4R - SOAP stream filter base class.
|
2
|
+
# Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
3
|
+
|
4
|
+
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
5
|
+
# redistribute it and/or modify it under the same terms of Ruby's license;
|
6
|
+
# either the dual license version in 2003, or any later version.
|
7
|
+
|
8
|
+
|
9
|
+
module SOAP
|
10
|
+
module Filter
|
11
|
+
|
12
|
+
|
13
|
+
class StreamHandler
|
14
|
+
|
15
|
+
# no returning value expected.
|
16
|
+
def on_http_outbound(req)
|
17
|
+
# do something.
|
18
|
+
end
|
19
|
+
|
20
|
+
# no returning value expected.
|
21
|
+
def on_http_inbound(req, res)
|
22
|
+
# do something.
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/lib/soap/generator.rb
CHANGED
@@ -46,6 +46,7 @@ public
|
|
46
46
|
@use_numeric_character_reference = opt[:use_numeric_character_reference]
|
47
47
|
@indentstr = opt[:no_indent] ? '' : ' '
|
48
48
|
@buf = @indent = @curr = nil
|
49
|
+
@default_ns = opt[:default_ns]
|
49
50
|
end
|
50
51
|
|
51
52
|
def generate(obj, io = nil)
|
@@ -58,6 +59,11 @@ public
|
|
58
59
|
end
|
59
60
|
|
60
61
|
ns = XSD::NS.new
|
62
|
+
if @default_ns
|
63
|
+
@default_ns.each_ns do |default_ns, default_tag|
|
64
|
+
SOAPGenerator.assign_ns(obj.extraattr, ns, default_ns, default_tag)
|
65
|
+
end
|
66
|
+
end
|
61
67
|
@buf << xmldecl
|
62
68
|
encode_data(ns, obj, nil)
|
63
69
|
|
@@ -40,6 +40,11 @@ module_function
|
|
40
40
|
basic_auth.add_hook do |key, value|
|
41
41
|
set_basic_auth(client, basic_auth)
|
42
42
|
end
|
43
|
+
auth = options["auth"] ||= ::SOAP::Property.new
|
44
|
+
set_auth(client, auth)
|
45
|
+
auth.add_hook do |key, value|
|
46
|
+
set_auth(client, auth)
|
47
|
+
end
|
43
48
|
options.add_hook("connect_timeout") do |key, value|
|
44
49
|
client.connect_timeout = value
|
45
50
|
end
|
@@ -53,13 +58,23 @@ module_function
|
|
53
58
|
|
54
59
|
def set_basic_auth(client, basic_auth)
|
55
60
|
basic_auth.values.each do |ele|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
client.set_basic_auth(*authele_to_triplets(ele))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def set_auth(client, auth)
|
66
|
+
auth.values.each do |ele|
|
67
|
+
client.set_auth(*authele_to_triplets(ele))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def authele_to_triplets(ele)
|
72
|
+
if ele.is_a?(::Array)
|
73
|
+
url, userid, passwd = ele
|
74
|
+
else
|
75
|
+
url, userid, passwd = ele[:url], ele[:userid], ele[:password]
|
62
76
|
end
|
77
|
+
return url, userid, passwd
|
63
78
|
end
|
64
79
|
|
65
80
|
def set_ssl_config(client, ssl_config)
|
@@ -433,7 +433,7 @@ private
|
|
433
433
|
when ::Array
|
434
434
|
array2soap(obj, definition)
|
435
435
|
else
|
436
|
-
|
436
|
+
unknownstubobj2soap(obj, definition)
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
@@ -453,6 +453,7 @@ private
|
|
453
453
|
if definition.elements.size == 0
|
454
454
|
ele = Mapping.obj2soap(obj)
|
455
455
|
ele.elename = definition.elename if definition.elename
|
456
|
+
ele.extraattr[XSD::AttrTypeName] = definition.type if definition.type
|
456
457
|
return ele
|
457
458
|
else
|
458
459
|
ele = SOAPStruct.new(definition.type)
|
@@ -29,12 +29,12 @@ class LiteralRegistry
|
|
29
29
|
@excn_handler_soap2obj = nil
|
30
30
|
end
|
31
31
|
|
32
|
-
def obj2soap(obj, qname)
|
32
|
+
def obj2soap(obj, qname, obj_class = nil)
|
33
33
|
soap_obj = nil
|
34
34
|
if obj.is_a?(SOAPElement)
|
35
35
|
soap_obj = obj
|
36
36
|
else
|
37
|
-
soap_obj = any2soap(obj, qname)
|
37
|
+
soap_obj = any2soap(obj, qname, obj_class)
|
38
38
|
end
|
39
39
|
return soap_obj if soap_obj
|
40
40
|
if @excn_handler_obj2soap
|
@@ -67,20 +67,32 @@ private
|
|
67
67
|
|
68
68
|
MAPPING_OPT = { :no_reference => true }
|
69
69
|
|
70
|
-
def
|
70
|
+
def definedobj2soap(obj, definition)
|
71
|
+
obj2soap(obj, definition.elename, definition.mapped_class)
|
72
|
+
end
|
73
|
+
|
74
|
+
def any2soap(obj, qname, obj_class)
|
71
75
|
ele = nil
|
72
76
|
if obj.is_a?(SOAP::Mapping::Object)
|
73
|
-
|
74
|
-
elsif definition = schema_definition_from_class(obj.class)
|
75
|
-
# search with class first. obj can be an instance of a subclass of
|
76
|
-
# defined class.
|
77
|
-
ele = stubobj2soap(obj, qname, definition)
|
78
|
-
elsif definition = schema_definition_from_elename(qname)
|
79
|
-
ele = stubobj2soap(obj, qname, definition)
|
80
|
-
else
|
81
|
-
ele = anyobj2soap(obj, qname)
|
77
|
+
return mappingobj2soap(obj, qname)
|
82
78
|
end
|
83
|
-
|
79
|
+
class_definition = schema_definition_from_class(obj_class || obj.class)
|
80
|
+
elename_definition = schema_definition_from_elename(qname)
|
81
|
+
if !class_definition and !elename_definition
|
82
|
+
# no definition found
|
83
|
+
return anyobj2soap(obj, qname)
|
84
|
+
end
|
85
|
+
if !class_definition or !elename_definition
|
86
|
+
# use found one
|
87
|
+
return stubobj2soap(obj, qname, class_definition || elename_definition)
|
88
|
+
end
|
89
|
+
# found both:
|
90
|
+
if class_definition.class_for == elename_definition.class_for
|
91
|
+
# if two definitions are for the same class, give qname a priority.
|
92
|
+
return stubobj2soap(obj, qname, elename_definition)
|
93
|
+
end
|
94
|
+
# it should be a derived class
|
95
|
+
return stubobj2soap(obj, qname, class_definition)
|
84
96
|
end
|
85
97
|
|
86
98
|
def anyobj2soap(obj, qname)
|
@@ -119,6 +131,9 @@ private
|
|
119
131
|
if definition.type
|
120
132
|
ele.extraattr[XSD::AttrTypeName] = definition.type
|
121
133
|
end
|
134
|
+
if qname.nil? and definition.elename
|
135
|
+
ele.elename = definition.elename
|
136
|
+
end
|
122
137
|
stubobj2soap_elements(obj, ele, definition.elements)
|
123
138
|
if definition.attributes
|
124
139
|
definition.attributes.each do |qname, param|
|
@@ -151,7 +166,7 @@ private
|
|
151
166
|
end
|
152
167
|
elsif obj.respond_to?(:each) and definition.as_array?
|
153
168
|
obj.each do |item|
|
154
|
-
ele.add(
|
169
|
+
ele.add(definedobj2soap(item, definition))
|
155
170
|
end
|
156
171
|
else
|
157
172
|
child = Mapping.get_attribute(obj, definition.varname)
|
@@ -160,10 +175,10 @@ private
|
|
160
175
|
else
|
161
176
|
if child.respond_to?(:each) and definition.as_array?
|
162
177
|
child.each do |item|
|
163
|
-
ele.add(
|
178
|
+
ele.add(definedobj2soap(item, definition))
|
164
179
|
end
|
165
180
|
else
|
166
|
-
ele.add(
|
181
|
+
ele.add(definedobj2soap(child, definition))
|
167
182
|
end
|
168
183
|
end
|
169
184
|
end
|
@@ -185,7 +185,10 @@ module RegistrySupport
|
|
185
185
|
def register(definition)
|
186
186
|
obj_class = definition[:class]
|
187
187
|
definition = Mapping.create_schema_definition(obj_class, definition)
|
188
|
-
|
188
|
+
# give complexType definition a priority explicitly
|
189
|
+
if !@class_schema_definition[obj_class] or definition.type
|
190
|
+
@class_schema_definition[obj_class] = definition
|
191
|
+
end
|
189
192
|
if definition.elename
|
190
193
|
@elename_schema_definition[definition.elename] = definition
|
191
194
|
end
|
@@ -237,6 +240,7 @@ module RegistrySupport
|
|
237
240
|
end
|
238
241
|
|
239
242
|
def base2soap(obj, type, qualified = nil)
|
243
|
+
return SOAPNil.new if obj.nil?
|
240
244
|
soap_obj = nil
|
241
245
|
if type <= XSD::XSDString
|
242
246
|
str = XSD::Charset.encoding_conv(obj.to_s,
|
@@ -420,6 +420,9 @@ private
|
|
420
420
|
end
|
421
421
|
typestr = Mapping.elename2name(node.type.name)
|
422
422
|
klass = Mapping.class_from_name(typestr)
|
423
|
+
if klass.respond_to?(:soap_marshallable) and !klass.soap_marshallable
|
424
|
+
return nil
|
425
|
+
end
|
423
426
|
if klass.nil? and @allow_untyped_struct
|
424
427
|
klass = Mapping.class_from_name(typestr, true) # lenient
|
425
428
|
end
|
@@ -29,7 +29,7 @@ class WSDLLiteralRegistry < LiteralRegistry
|
|
29
29
|
@definedelements = definedelements
|
30
30
|
end
|
31
31
|
|
32
|
-
def obj2soap(obj, qname)
|
32
|
+
def obj2soap(obj, qname, obj_class = nil)
|
33
33
|
soap_obj = nil
|
34
34
|
if obj.is_a?(SOAPElement)
|
35
35
|
soap_obj = obj
|
@@ -38,7 +38,7 @@ class WSDLLiteralRegistry < LiteralRegistry
|
|
38
38
|
elsif type = @definedtypes[qname]
|
39
39
|
soap_obj = obj2typesoap(obj, type)
|
40
40
|
else
|
41
|
-
soap_obj = any2soap(obj, qname)
|
41
|
+
soap_obj = any2soap(obj, qname, obj_class)
|
42
42
|
end
|
43
43
|
return soap_obj if soap_obj
|
44
44
|
if @excn_handler_obj2soap
|
@@ -54,7 +54,7 @@ class WSDLLiteralRegistry < LiteralRegistry
|
|
54
54
|
def soap2obj(node, obj_class = nil)
|
55
55
|
# obj_class is given when rpc/literal service. but ignored for now.
|
56
56
|
begin
|
57
|
-
return any2obj(node)
|
57
|
+
return any2obj(node, obj_class)
|
58
58
|
rescue MappingError
|
59
59
|
end
|
60
60
|
if @excn_handler_soap2obj
|
data/lib/soap/netHttpClient.rb
CHANGED
@@ -30,12 +30,14 @@ class NetHttpClient
|
|
30
30
|
attr_accessor :send_timeout # ignored for now.
|
31
31
|
attr_accessor :receive_timeout
|
32
32
|
attr_reader :test_loopback_response
|
33
|
+
attr_reader :request_filter # ignored for now.
|
33
34
|
|
34
35
|
def initialize(proxy = nil, agent = nil)
|
35
36
|
@proxy = proxy ? URI.parse(proxy) : nil
|
36
37
|
@agent = agent
|
37
38
|
@debug_dev = nil
|
38
39
|
@test_loopback_response = []
|
40
|
+
@request_filter = Filter::FilterChain.new
|
39
41
|
@session_manager = SessionManager.new
|
40
42
|
@no_proxy = @ssl_config = @protocol_version = nil
|
41
43
|
@connect_timeout = @send_timeout = @receive_timeout = nil
|
@@ -59,6 +61,10 @@ class NetHttpClient
|
|
59
61
|
@proxy
|
60
62
|
end
|
61
63
|
|
64
|
+
def set_auth(uri, user_id, passwd)
|
65
|
+
raise NotImplementedError.new("auth is not supported under soap4r + net/http.")
|
66
|
+
end
|
67
|
+
|
62
68
|
def set_basic_auth(uri, user_id, passwd)
|
63
69
|
# net/http does not handle url.
|
64
70
|
@basic_auth = [user_id, passwd]
|
data/lib/soap/rpc/router.rb
CHANGED
@@ -359,22 +359,26 @@ private
|
|
359
359
|
# normal program exception, it is wrapped inside a custom SOAP4R
|
360
360
|
# SOAP exception element.
|
361
361
|
detail = nil
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
362
|
+
begin
|
363
|
+
if (wsdl_fault_details)
|
364
|
+
registry = wsdl_fault_details[:use] == "literal" ?
|
365
|
+
@literal_mapping_registry : @mapping_registry
|
366
|
+
faultQName = XSD::QName.new(
|
367
|
+
wsdl_fault_details[:ns], wsdl_fault_details[:name]
|
368
|
+
)
|
369
|
+
detail = Mapping.obj2soap(e, registry, faultQName)
|
370
|
+
# wrap fault element (SOAPFault swallows top-level element)
|
371
|
+
wrapper = SOAP::SOAPElement.new(faultQName)
|
372
|
+
wrapper.add(detail)
|
373
|
+
detail = wrapper
|
374
|
+
else
|
375
|
+
# Exception is a normal program exception. Wrap it.
|
376
|
+
detail = Mapping.obj2soap(Mapping::SOAPException.new(e),
|
377
|
+
@mapping_registry)
|
378
|
+
detail.elename ||= XSD::QName::EMPTY # for literal mappingregstry
|
379
|
+
end
|
380
|
+
rescue
|
381
|
+
detail = SOAPString.new("failed to serialize detail object: #{$!}")
|
378
382
|
end
|
379
383
|
|
380
384
|
SOAPFault.new(
|
@@ -473,7 +477,12 @@ private
|
|
473
477
|
def request_rpc(body, mapping_registry, literal_mapping_registry, opt)
|
474
478
|
request = body.request
|
475
479
|
unless request.is_a?(SOAPStruct)
|
476
|
-
|
480
|
+
if request.is_a?(SOAPNil)
|
481
|
+
# SOAP::Lite/0.69 seems to send xsi:nil="true" element as a request.
|
482
|
+
request = SOAPStruct.new(request.elename)
|
483
|
+
else
|
484
|
+
raise RPCRoutingError.new("not an RPC style")
|
485
|
+
end
|
477
486
|
end
|
478
487
|
if @request_use == :encoded
|
479
488
|
request_rpc_enc(request, mapping_registry, opt)
|