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
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'soap/processor'
|
3
|
+
|
4
|
+
|
5
|
+
module SOAP
|
6
|
+
|
7
|
+
|
8
|
+
class TestCustomNs < Test::Unit::TestCase
|
9
|
+
NORMAL_XML = <<__XML__.chomp
|
10
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
11
|
+
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
12
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
13
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
14
|
+
<env:Header>
|
15
|
+
<n1:headeritem xmlns:n1="my:foo"
|
16
|
+
env:mustUnderstand="0">hi</n1:headeritem>
|
17
|
+
</env:Header>
|
18
|
+
<env:Body>
|
19
|
+
<n2:test xmlns:n2="my:foo">bi</n2:test>
|
20
|
+
</env:Body>
|
21
|
+
</env:Envelope>
|
22
|
+
__XML__
|
23
|
+
|
24
|
+
CUSTOM_NS_XML = <<__XML__.chomp
|
25
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
26
|
+
<ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
27
|
+
xmlns:ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
28
|
+
xmlns:myns="my:foo"
|
29
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
30
|
+
<ENV:Header>
|
31
|
+
<myns:headeritem ENV:mustUnderstand="0">hi</myns:headeritem>
|
32
|
+
</ENV:Header>
|
33
|
+
<ENV:Body>
|
34
|
+
<myns:test>bi</myns:test>
|
35
|
+
</ENV:Body>
|
36
|
+
</ENV:Envelope>
|
37
|
+
__XML__
|
38
|
+
|
39
|
+
def test_custom_ns
|
40
|
+
# create test env
|
41
|
+
header = SOAP::SOAPHeader.new()
|
42
|
+
hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem"), 'hi')
|
43
|
+
header.add("test", hi)
|
44
|
+
body = SOAP::SOAPBody.new()
|
45
|
+
bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem"), 'bi')
|
46
|
+
body.add("test", bi)
|
47
|
+
env = SOAP::SOAPEnvelope.new(header, body)
|
48
|
+
# normal
|
49
|
+
opt = {}
|
50
|
+
result = SOAP::Processor.marshal(env, opt)
|
51
|
+
assert_equal(NORMAL_XML, result)
|
52
|
+
# ns customize
|
53
|
+
ns = XSD::NS.new
|
54
|
+
ns.assign(SOAP::EnvelopeNamespace, 'ENV')
|
55
|
+
ns.assign('my:foo', 'myns')
|
56
|
+
opt = { :default_ns => ns }
|
57
|
+
result = SOAP::Processor.marshal(env, opt)
|
58
|
+
assert_equal(CUSTOM_NS_XML, result)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
end
|
@@ -2,7 +2,7 @@ require 'test/unit'
|
|
2
2
|
require 'soap/httpconfigloader'
|
3
3
|
require 'soap/rpc/driver'
|
4
4
|
|
5
|
-
if defined?(
|
5
|
+
if defined?(HTTPClient)
|
6
6
|
|
7
7
|
module SOAP
|
8
8
|
|
@@ -14,6 +14,20 @@ class TestHTTPConfigLoader < Test::Unit::TestCase
|
|
14
14
|
@client = SOAP::RPC::Driver.new(nil, nil)
|
15
15
|
end
|
16
16
|
|
17
|
+
class Request
|
18
|
+
class Header
|
19
|
+
attr_reader :request_uri
|
20
|
+
def initialize(request_uri)
|
21
|
+
@request_uri = request_uri
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_reader :header
|
26
|
+
def initialize(request_uri)
|
27
|
+
@header = Header.new(request_uri)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
17
31
|
def test_property
|
18
32
|
testpropertyname = File.join(DIR, 'soapclient.properties')
|
19
33
|
File.open(testpropertyname, "w") do |f|
|
@@ -37,13 +51,14 @@ __EOP__
|
|
37
51
|
@client.options['protocol.http.basic_auth'] <<
|
38
52
|
['http://www.example.com/foo3/', 'user3', 'password3']
|
39
53
|
h = @client.streamhandler.client
|
40
|
-
basic_auth = h.
|
54
|
+
basic_auth = h.www_auth.basic_auth
|
41
55
|
cred1 = ["user1:password1"].pack('m').tr("\n", '')
|
42
56
|
cred2 = ["user2:password2"].pack('m').tr("\n", '')
|
43
57
|
cred3 = ["user3:password3"].pack('m').tr("\n", '')
|
44
|
-
|
45
|
-
assert_equal(
|
46
|
-
assert_equal(
|
58
|
+
basic_auth.challenge(URI.parse("http://www.example.com/"), nil)
|
59
|
+
assert_equal(cred1, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo1/baz"))))
|
60
|
+
assert_equal(cred2, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo2/"))))
|
61
|
+
assert_equal(cred3, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo3/baz/qux"))))
|
47
62
|
ensure
|
48
63
|
File.unlink(testpropertyname)
|
49
64
|
end
|
data/test/soap/test_mapping.rb
CHANGED
@@ -1,11 +1,73 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'soap/mapping'
|
3
|
+
require 'soap/marshal'
|
3
4
|
|
4
5
|
|
5
6
|
module SOAP
|
6
7
|
|
7
8
|
|
8
9
|
class TestMapping < Test::Unit::TestCase
|
10
|
+
|
11
|
+
class MappablePerson
|
12
|
+
attr_reader :name
|
13
|
+
attr_reader :age
|
14
|
+
|
15
|
+
def initialize(name, age)
|
16
|
+
@name, @age = name, age
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.soap_marshallable
|
20
|
+
true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class UnmappablePerson
|
25
|
+
attr_reader :name
|
26
|
+
attr_reader :age
|
27
|
+
|
28
|
+
def initialize(name, age)
|
29
|
+
@name, @age = name, age
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.soap_marshallable
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_mappable
|
38
|
+
xml = <<__XML__
|
39
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
40
|
+
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
41
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
42
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
43
|
+
<env:Body>
|
44
|
+
<SOAP..TestMapping..MappablePerson env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
45
|
+
<name>nahi</name>
|
46
|
+
<age>37</age>
|
47
|
+
</SOAP..TestMapping..MappablePerson>
|
48
|
+
</env:Body>
|
49
|
+
</env:Envelope>
|
50
|
+
__XML__
|
51
|
+
obj = SOAP::Marshal.load(xml)
|
52
|
+
assert_equal(SOAP::TestMapping::MappablePerson, obj.class)
|
53
|
+
#
|
54
|
+
xml = <<__XML__
|
55
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
56
|
+
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
57
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
58
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
59
|
+
<env:Body>
|
60
|
+
<SOAP..TestMapping..UnmappablePerson env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
61
|
+
<name>nahi</name>
|
62
|
+
<age>37</age>
|
63
|
+
</SOAP..TestMapping..UnmappablePerson>
|
64
|
+
</env:Body>
|
65
|
+
</env:Envelope>
|
66
|
+
__XML__
|
67
|
+
obj = SOAP::Marshal.load(xml)
|
68
|
+
assert_equal(SOAP::Mapping::Object, obj.class)
|
69
|
+
end
|
70
|
+
|
9
71
|
def test_date
|
10
72
|
targets = [
|
11
73
|
["2002-12-31",
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'soap/rpc/standaloneServer'
|
3
|
+
require 'soap/rpc/driver'
|
4
|
+
require 'soap/header/handler'
|
5
|
+
|
6
|
+
|
7
|
+
module SOAP
|
8
|
+
|
9
|
+
|
10
|
+
class TestNil < Test::Unit::TestCase
|
11
|
+
Port = 17171
|
12
|
+
|
13
|
+
class NilServer < SOAP::RPC::StandaloneServer
|
14
|
+
def initialize(*arg)
|
15
|
+
super
|
16
|
+
add_method(self, 'nop')
|
17
|
+
end
|
18
|
+
|
19
|
+
def nop
|
20
|
+
1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup
|
25
|
+
@server = NilServer.new(self.class.name, nil, '0.0.0.0', Port)
|
26
|
+
@server.level = Logger::Severity::ERROR
|
27
|
+
@t = Thread.new {
|
28
|
+
@server.start
|
29
|
+
}
|
30
|
+
@endpoint = "http://localhost:#{Port}/"
|
31
|
+
@client = SOAP::RPC::Driver.new(@endpoint)
|
32
|
+
@client.add_rpc_method('nop')
|
33
|
+
end
|
34
|
+
|
35
|
+
def teardown
|
36
|
+
@server.shutdown
|
37
|
+
@t.kill
|
38
|
+
@t.join
|
39
|
+
@client.reset_stream
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'rexml/document'
|
43
|
+
# emulates SOAP::Lite's nil request
|
44
|
+
def test_soaplite_nil
|
45
|
+
body = SOAP::SOAPBody.new(REXML::Document.new(<<-__XML__))
|
46
|
+
<nop xsi:nil="true"/>
|
47
|
+
__XML__
|
48
|
+
@client.wiredump_dev = STDOUT if $DEBUG
|
49
|
+
header, body = @client.invoke(nil, body)
|
50
|
+
assert_equal(1, body.root_node["return"].data)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
data/test/soap/test_no_indent.rb
CHANGED
@@ -42,6 +42,16 @@ class TestStreamHandler < Test::Unit::TestCase
|
|
42
42
|
'/',
|
43
43
|
WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc)
|
44
44
|
)
|
45
|
+
htpasswd = File.join(File.dirname(__FILE__), 'htpasswd')
|
46
|
+
htpasswd_userdb = WEBrick::HTTPAuth::Htpasswd.new(htpasswd)
|
47
|
+
@basic_auth = WEBrick::HTTPAuth::BasicAuth.new(
|
48
|
+
:Realm => 'auth',
|
49
|
+
:UserDB => htpasswd_userdb
|
50
|
+
)
|
51
|
+
@server.mount(
|
52
|
+
'/basic_auth',
|
53
|
+
WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc_basic_auth).to_proc)
|
54
|
+
)
|
45
55
|
@server_thread = TestUtil.start_server_thread(@server)
|
46
56
|
end
|
47
57
|
|
@@ -58,6 +68,7 @@ class TestStreamHandler < Test::Unit::TestCase
|
|
58
68
|
def setup_client
|
59
69
|
@client = SOAP::RPC::Driver.new(@url, '')
|
60
70
|
@client.add_method("do_server_proc")
|
71
|
+
@client.add_method("do_server_proc_basic_auth")
|
61
72
|
end
|
62
73
|
|
63
74
|
def teardown_server
|
@@ -90,10 +101,12 @@ class TestStreamHandler < Test::Unit::TestCase
|
|
90
101
|
__EOX__
|
91
102
|
end
|
92
103
|
|
104
|
+
def do_server_proc_basic_auth(req, res)
|
105
|
+
@basic_auth.authenticate(req, res)
|
106
|
+
do_server_proc(req, res)
|
107
|
+
end
|
108
|
+
|
93
109
|
def parse_req_header(str)
|
94
|
-
if ::SOAP::HTTPStreamHandler::Client.to_s == 'SOAP::NetHttpClient'
|
95
|
-
str = eval(str.split(/\r?\n/)[4][3..-1])
|
96
|
-
end
|
97
110
|
parse_req_header_http_access2(str)
|
98
111
|
end
|
99
112
|
|
@@ -141,24 +154,23 @@ __EOX__
|
|
141
154
|
end
|
142
155
|
|
143
156
|
def test_basic_auth
|
144
|
-
unless Object.const_defined?('
|
157
|
+
unless Object.const_defined?('HTTPClient')
|
145
158
|
# soap4r + net/http + basic_auth is not supported.
|
146
|
-
# use
|
159
|
+
# use httpclient instead.
|
147
160
|
assert(true)
|
148
161
|
return
|
149
162
|
end
|
163
|
+
@client.endpoint_url = @url + 'basic_auth'
|
150
164
|
str = ""
|
151
165
|
@client.wiredump_dev = str
|
152
|
-
@client.options["protocol.http.basic_auth"] << [@url, "
|
153
|
-
assert_nil(@client.
|
154
|
-
r, h = parse_req_header(str)
|
155
|
-
assert_equal("Basic Zm9vOmJhcg==", h["authorization"])
|
166
|
+
@client.options["protocol.http.basic_auth"] << [@url, "admin", "admin"]
|
167
|
+
assert_nil(@client.do_server_proc_basic_auth)
|
156
168
|
end
|
157
169
|
|
158
170
|
def test_proxy
|
159
|
-
if Object.const_defined?('
|
160
|
-
backup =
|
161
|
-
|
171
|
+
if Object.const_defined?('HTTPClient')
|
172
|
+
backup = HTTPClient::NO_PROXY_HOSTS.dup
|
173
|
+
HTTPClient::NO_PROXY_HOSTS.clear
|
162
174
|
else
|
163
175
|
backup = SOAP::NetHttpClient::NO_PROXY_HOSTS.dup
|
164
176
|
SOAP::NetHttpClient::NO_PROXY_HOSTS.clear
|
@@ -175,8 +187,8 @@ __EOX__
|
|
175
187
|
@client.options["protocol.http.proxy"] = 'ftp://foo:8080'
|
176
188
|
end
|
177
189
|
ensure
|
178
|
-
if Object.const_defined?('
|
179
|
-
|
190
|
+
if Object.const_defined?('HTTPClient')
|
191
|
+
HTTPClient::NO_PROXY_HOSTS.replace(backup)
|
180
192
|
else
|
181
193
|
SOAP::NetHttpClient::NO_PROXY_HOSTS.replace(backup)
|
182
194
|
end
|
@@ -32,6 +32,36 @@
|
|
32
32
|
</s:complexType>
|
33
33
|
</s:element>
|
34
34
|
<s:element name="ArrayOfDouble" nillable="true" type="tns:ArrayOfDouble"/>
|
35
|
+
|
36
|
+
<s:element name="echo2">
|
37
|
+
<s:complexType>
|
38
|
+
<s:sequence>
|
39
|
+
<s:element name="arg" type="tns:ArrayOfComplex"/>
|
40
|
+
</s:sequence>
|
41
|
+
</s:complexType>
|
42
|
+
</s:element>
|
43
|
+
<s:element name="echo2Response">
|
44
|
+
<s:complexType>
|
45
|
+
<s:sequence>
|
46
|
+
<s:element name="arg" type="tns:ArrayOfComplex"/>
|
47
|
+
</s:sequence>
|
48
|
+
</s:complexType>
|
49
|
+
</s:element>
|
50
|
+
<s:element name="ArrayOfComplex">
|
51
|
+
<s:complexType>
|
52
|
+
<s:sequence>
|
53
|
+
<s:element ref="tns:Complex" maxOccurs="3"/>
|
54
|
+
</s:sequence>
|
55
|
+
</s:complexType>
|
56
|
+
</s:element>
|
57
|
+
<s:element name="Complex">
|
58
|
+
<s:complexType>
|
59
|
+
<s:sequence>
|
60
|
+
<s:element name="string" type="s:string"/>
|
61
|
+
<s:element name="double" type="s:double"/>
|
62
|
+
</s:sequence>
|
63
|
+
</s:complexType>
|
64
|
+
</s:element>
|
35
65
|
</s:schema>
|
36
66
|
</wsdl:types>
|
37
67
|
|
@@ -41,12 +71,23 @@
|
|
41
71
|
<wsdl:message name="echoOut">
|
42
72
|
<wsdl:part name="parameters" element="tns:echoResponse"/>
|
43
73
|
</wsdl:message>
|
74
|
+
<wsdl:message name="echo2In">
|
75
|
+
<wsdl:part name="parameters" element="tns:echo2"/>
|
76
|
+
</wsdl:message>
|
77
|
+
<wsdl:message name="echo2Out">
|
78
|
+
<wsdl:part name="parameters" element="tns:echo2Response"/>
|
79
|
+
</wsdl:message>
|
44
80
|
|
45
81
|
<wsdl:portType name="pricerSoap">
|
46
82
|
<wsdl:operation name="echo">
|
47
83
|
<wsdl:input message="tns:echoIn"/>
|
48
84
|
<wsdl:output message="tns:echoOut"/>
|
49
85
|
</wsdl:operation>
|
86
|
+
|
87
|
+
<wsdl:operation name="echo2">
|
88
|
+
<wsdl:input message="tns:echo2In"/>
|
89
|
+
<wsdl:output message="tns:echo2Out"/>
|
90
|
+
</wsdl:operation>
|
50
91
|
</wsdl:portType>
|
51
92
|
|
52
93
|
<wsdl:binding name="pricerSoap" type="tns:pricerSoap">
|
@@ -61,6 +102,15 @@
|
|
61
102
|
<soap:body use="literal"/>
|
62
103
|
</wsdl:output>
|
63
104
|
</wsdl:operation>
|
105
|
+
<wsdl:operation name="echo2">
|
106
|
+
<soap:operation soapAction="http://tempuri.org/echo2" style="document"/>
|
107
|
+
<wsdl:input>
|
108
|
+
<soap:body use="literal"/>
|
109
|
+
</wsdl:input>
|
110
|
+
<wsdl:output>
|
111
|
+
<soap:body use="literal"/>
|
112
|
+
</wsdl:output>
|
113
|
+
</wsdl:operation>
|
64
114
|
</wsdl:binding>
|
65
115
|
|
66
116
|
<wsdl:service name="pricer">
|
@@ -21,12 +21,23 @@ class TestArray < Test::Unit::TestCase
|
|
21
21
|
XSD::QName.new(Namespace, 'echo'),
|
22
22
|
XSD::QName.new(Namespace, 'echoResponse')
|
23
23
|
)
|
24
|
+
add_document_method(
|
25
|
+
self,
|
26
|
+
Namespace + 'echo2',
|
27
|
+
'echo2',
|
28
|
+
XSD::QName.new(Namespace, 'echo2'),
|
29
|
+
XSD::QName.new(Namespace, 'echo2Response')
|
30
|
+
)
|
24
31
|
self.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry
|
25
32
|
end
|
26
33
|
|
27
34
|
def echo(arg)
|
28
35
|
arg
|
29
36
|
end
|
37
|
+
|
38
|
+
def echo2(arg)
|
39
|
+
arg
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
43
|
DIR = File.dirname(File.expand_path(__FILE__))
|
@@ -44,6 +55,7 @@ class TestArray < Test::Unit::TestCase
|
|
44
55
|
unless $DEBUG
|
45
56
|
File.unlink(pathname('double.rb'))
|
46
57
|
File.unlink(pathname('doubleMappingRegistry.rb'))
|
58
|
+
File.unlink(pathname('doubleDriver.rb'))
|
47
59
|
end
|
48
60
|
@client.reset_stream if @client
|
49
61
|
end
|
@@ -61,10 +73,11 @@ class TestArray < Test::Unit::TestCase
|
|
61
73
|
gen.logger.level = Logger::FATAL
|
62
74
|
gen.opt['classdef'] = nil
|
63
75
|
gen.opt['mapping_registry'] = nil
|
76
|
+
gen.opt['driver'] = nil
|
64
77
|
gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '')
|
65
78
|
gen.opt['force'] = true
|
66
79
|
gen.run
|
67
|
-
TestUtil.require(DIR, 'doubleMappingRegistry.rb', 'double.rb')
|
80
|
+
TestUtil.require(DIR, 'doubleDriver.rb', 'doubleMappingRegistry.rb', 'double.rb')
|
68
81
|
end
|
69
82
|
|
70
83
|
def teardown_server
|
@@ -78,6 +91,25 @@ class TestArray < Test::Unit::TestCase
|
|
78
91
|
end
|
79
92
|
|
80
93
|
def test_stub
|
94
|
+
@client = PricerSoap.new
|
95
|
+
@client.endpoint_url = "http://localhost:#{Port}/"
|
96
|
+
@client.wiredump_dev = STDOUT if $DEBUG
|
97
|
+
arg = ArrayOfComplex[c1 = Complex.new, c2 = Complex.new, c3 = Complex.new]
|
98
|
+
c1.string = "str_c1"
|
99
|
+
c1.double = 1.1
|
100
|
+
c2.string = "str_c2"
|
101
|
+
c2.double = 2.2
|
102
|
+
c3.string = "str_c3"
|
103
|
+
c3.double = 3.3
|
104
|
+
ret = @client.echo2(Echo2.new(arg))
|
105
|
+
assert_equal(ArrayOfComplex, ret.arg.class)
|
106
|
+
assert_equal(Complex, ret.arg[0].class)
|
107
|
+
assert_equal(arg[0].string, ret.arg[0].string)
|
108
|
+
assert_equal(arg[1].string, ret.arg[1].string)
|
109
|
+
assert_equal(arg[2].string, ret.arg[2].string)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_wsdl_stubclassdef
|
81
113
|
wsdl = File.join(DIR, 'double.wsdl')
|
82
114
|
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
83
115
|
@client.endpoint_url = "http://localhost:#{Port}/"
|
@@ -94,12 +126,7 @@ class TestArray < Test::Unit::TestCase
|
|
94
126
|
@client.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry
|
95
127
|
@client.wiredump_dev = STDOUT if $DEBUG
|
96
128
|
double = [0.1, 0.2, 0.3]
|
97
|
-
|
98
|
-
:ary => {
|
99
|
-
XSD::QName.new("http://tempuri.org/", "double") => double
|
100
|
-
}
|
101
|
-
}
|
102
|
-
assert_equal(double, @client.echo(arg).ary)
|
129
|
+
assert_equal(double, @client.echo(:ary => double).ary)
|
103
130
|
end
|
104
131
|
end
|
105
132
|
|