johnreitano-savon 0.7.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +124 -0
- data/README.textile +75 -0
- data/Rakefile +45 -0
- data/lib/savon/client.rb +84 -0
- data/lib/savon/core_ext/datetime.rb +8 -0
- data/lib/savon/core_ext/hash.rb +78 -0
- data/lib/savon/core_ext/net_http.rb +20 -0
- data/lib/savon/core_ext/object.rb +21 -0
- data/lib/savon/core_ext/string.rb +47 -0
- data/lib/savon/core_ext/symbol.rb +8 -0
- data/lib/savon/core_ext/uri.rb +10 -0
- data/lib/savon/core_ext.rb +3 -0
- data/lib/savon/request.rb +149 -0
- data/lib/savon/response.rb +99 -0
- data/lib/savon/soap.rb +176 -0
- data/lib/savon/wsdl.rb +122 -0
- data/lib/savon/wsse.rb +136 -0
- data/lib/savon.rb +34 -0
- data/spec/basic_spec_helper.rb +12 -0
- data/spec/endpoint_helper.rb +22 -0
- data/spec/fixtures/response/response_fixture.rb +36 -0
- data/spec/fixtures/response/xml/authentication.xml +14 -0
- data/spec/fixtures/response/xml/multi_ref.xml +39 -0
- data/spec/fixtures/response/xml/soap_fault.xml +8 -0
- data/spec/fixtures/response/xml/soap_fault12.xml +18 -0
- data/spec/fixtures/wsdl/wsdl_fixture.rb +37 -0
- data/spec/fixtures/wsdl/xml/authentication.xml +63 -0
- data/spec/fixtures/wsdl/xml/namespaced_actions.xml +307 -0
- data/spec/fixtures/wsdl/xml/no_namespace.xml +115 -0
- data/spec/http_stubs.rb +23 -0
- data/spec/integration/http_basic_auth_spec.rb +16 -0
- data/spec/integration/server.rb +51 -0
- data/spec/savon/client_spec.rb +77 -0
- data/spec/savon/core_ext/datetime_spec.rb +12 -0
- data/spec/savon/core_ext/hash_spec.rb +138 -0
- data/spec/savon/core_ext/net_http_spec.rb +38 -0
- data/spec/savon/core_ext/object_spec.rb +40 -0
- data/spec/savon/core_ext/string_spec.rb +68 -0
- data/spec/savon/core_ext/symbol_spec.rb +11 -0
- data/spec/savon/core_ext/uri_spec.rb +15 -0
- data/spec/savon/request_spec.rb +89 -0
- data/spec/savon/response_spec.rb +137 -0
- data/spec/savon/savon_spec.rb +23 -0
- data/spec/savon/soap_spec.rb +171 -0
- data/spec/savon/wsdl_spec.rb +84 -0
- data/spec/savon/wsse_spec.rb +132 -0
- data/spec/spec_helper.rb +5 -0
- metadata +218 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Savon::WSDL do
|
4
|
+
describe "a common WSDL document" do
|
5
|
+
before { @wsdl = new_wsdl }
|
6
|
+
|
7
|
+
it "is initialized with a Savon::Request object" do
|
8
|
+
Savon::WSDL.new Savon::Request.new(EndpointHelper.wsdl_endpoint)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "is enabled by default" do
|
12
|
+
@wsdl.enabled?.should be_true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has a getter for the namespace URI" do
|
16
|
+
@wsdl.namespace_uri.should == WSDLFixture.authentication(:namespace_uri)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has a getter for returning an Array of available SOAP actions" do
|
20
|
+
WSDLFixture.authentication(:operations).keys.each do |soap_action|
|
21
|
+
@wsdl.soap_actions.should include(soap_action)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "has a getter for returning a Hash of available SOAP operations" do
|
26
|
+
@wsdl.operations.should == WSDLFixture.authentication(:operations)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "responds to SOAP actions while still behaving as usual otherwise" do
|
30
|
+
WSDLFixture.authentication(:operations).keys.each do |soap_action|
|
31
|
+
@wsdl.respond_to?(soap_action).should be_true
|
32
|
+
end
|
33
|
+
|
34
|
+
@wsdl.respond_to?(:object_id).should be_true
|
35
|
+
@wsdl.respond_to?(:some_undefined_method).should be_false
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns the raw WSDL document for to_s" do
|
39
|
+
@wsdl.to_s.should == WSDLFixture.authentication
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "a WSDL document having core sections without a namespace" do
|
44
|
+
before { @wsdl = new_wsdl :no_namespace }
|
45
|
+
|
46
|
+
it "returns the namespace URI" do
|
47
|
+
@wsdl.namespace_uri.should == WSDLFixture.no_namespace(:namespace_uri)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns an Array of available SOAP actions" do
|
51
|
+
WSDLFixture.no_namespace(:operations).keys.each do |soap_action|
|
52
|
+
@wsdl.soap_actions.should include(soap_action)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns a Hash of SOAP operations" do
|
57
|
+
@wsdl.operations.should == WSDLFixture.no_namespace(:operations)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "a WSDL document with namespaced SOAP actions" do
|
62
|
+
before { @wsdl = new_wsdl :namespaced_actions }
|
63
|
+
|
64
|
+
it "returns the namespace URI" do
|
65
|
+
@wsdl.namespace_uri.should == WSDLFixture.namespaced_actions(:namespace_uri)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "returns an Array of available SOAP actions" do
|
69
|
+
WSDLFixture.namespaced_actions(:operations).keys.each do |soap_action|
|
70
|
+
@wsdl.soap_actions.should include(soap_action)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it "returns a Hash of SOAP operations" do
|
75
|
+
@wsdl.operations.should == WSDLFixture.namespaced_actions(:operations)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def new_wsdl(fixture = nil)
|
80
|
+
endpoint = fixture ? EndpointHelper.wsdl_endpoint(fixture) : EndpointHelper.wsdl_endpoint
|
81
|
+
Savon::WSDL.new Savon::Request.new(endpoint)
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Savon::WSSE do
|
4
|
+
before do
|
5
|
+
Savon::WSSE.username, Savon::WSSE.password, Savon::WSSE.digest = nil, nil, false
|
6
|
+
@wsse, @username, @password = Savon::WSSE.new, "gorilla", "secret"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "contains the namespace for WS Security Secext" do
|
10
|
+
Savon::WSSE::WSENamespace.should be_a(String)
|
11
|
+
Savon::WSSE::WSENamespace.should_not be_empty
|
12
|
+
end
|
13
|
+
|
14
|
+
it "contains the namespace for WS Security Utility" do
|
15
|
+
Savon::WSSE::WSUNamespace.should be_a(String)
|
16
|
+
Savon::WSSE::WSUNamespace.should_not be_empty
|
17
|
+
end
|
18
|
+
|
19
|
+
it "defaults to nil for the WSSE username (global setting)" do
|
20
|
+
Savon::WSSE.username.should be_nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has both getter and setter for the WSSE username (global setting)" do
|
24
|
+
Savon::WSSE.username = "gorilla"
|
25
|
+
Savon::WSSE.username.should == "gorilla"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "defaults to nil for the WSSE password (global setting)" do
|
29
|
+
Savon::WSSE.password.should be_nil
|
30
|
+
end
|
31
|
+
|
32
|
+
it "has both getter and setter for the WSSE password (global setting)" do
|
33
|
+
Savon::WSSE.password = "secret"
|
34
|
+
Savon::WSSE.password.should == "secret"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "defaults to nil for whether to use WSSE digest (global setting)" do
|
38
|
+
Savon::WSSE.digest?.should be_false
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has both getter and setter for whether to use WSSE digest (global setting)" do
|
42
|
+
Savon::WSSE.digest = true
|
43
|
+
Savon::WSSE.digest?.should == true
|
44
|
+
end
|
45
|
+
|
46
|
+
it "defaults to nil for the WSSE username" do
|
47
|
+
@wsse.username.should be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it "has both getter and setter for the WSSE username" do
|
51
|
+
@wsse.username = "gorilla"
|
52
|
+
@wsse.username.should == "gorilla"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "defaults to nil for the WSSE password" do
|
56
|
+
@wsse.password.should be_nil
|
57
|
+
end
|
58
|
+
|
59
|
+
it "has both getter and setter for the WSSE password" do
|
60
|
+
@wsse.password = "secret"
|
61
|
+
@wsse.password.should == "secret"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "defaults to nil for whether to use WSSE digest" do
|
65
|
+
@wsse.digest?.should be_false
|
66
|
+
end
|
67
|
+
|
68
|
+
it "has both getter and setter for whether to use WSSE digest" do
|
69
|
+
@wsse.digest = true
|
70
|
+
@wsse.digest?.should == true
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "header" do
|
74
|
+
describe "returns the XML for a WSSE authentication header" do
|
75
|
+
it "with WSSE credentials specified" do
|
76
|
+
@wsse.username = @username
|
77
|
+
@wsse.password = @password
|
78
|
+
header = @wsse.header
|
79
|
+
|
80
|
+
header.should include_security_namespaces
|
81
|
+
header.should include(@username)
|
82
|
+
header.should include(@password)
|
83
|
+
header.should include(Savon::WSSE::PasswordTextURI)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "with WSSE credentials specified via defaults" do
|
87
|
+
Savon::WSSE.username = @username
|
88
|
+
Savon::WSSE.password = @password
|
89
|
+
header = @wsse.header
|
90
|
+
|
91
|
+
header.should include_security_namespaces
|
92
|
+
header.should include(@username)
|
93
|
+
header.should include(@password)
|
94
|
+
header.should include(Savon::WSSE::PasswordTextURI)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "returns the XML for a WSSE digest header if specified" do
|
99
|
+
it "via accessors" do
|
100
|
+
@wsse.username = @username
|
101
|
+
@wsse.password = @password
|
102
|
+
@wsse.digest = true
|
103
|
+
header = @wsse.header
|
104
|
+
|
105
|
+
header.should include_security_namespaces
|
106
|
+
header.should include(@username)
|
107
|
+
header.should_not include(@password)
|
108
|
+
header.should include(Savon::WSSE::PasswordDigestURI)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "via defaults" do
|
112
|
+
@wsse.username = @username
|
113
|
+
@wsse.password = @password
|
114
|
+
Savon::WSSE.digest = true
|
115
|
+
header = @wsse.header
|
116
|
+
|
117
|
+
header.should include_security_namespaces
|
118
|
+
header.should include(@username)
|
119
|
+
header.should_not include(@password)
|
120
|
+
header.should include(Savon::WSSE::PasswordDigestURI)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def include_security_namespaces
|
125
|
+
simple_matcher("include security namespaces") do |given|
|
126
|
+
given.should include(Savon::WSSE::WSENamespace)
|
127
|
+
given.should include(Savon::WSSE::WSUNamespace)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: johnreitano-savon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 125
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 2
|
10
|
+
- 1
|
11
|
+
version: 0.7.2.1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- John Reitano
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-10-11 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: builder
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 1
|
34
|
+
- 2
|
35
|
+
version: 2.1.2
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: crack
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 19
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
- 1
|
50
|
+
- 4
|
51
|
+
version: 0.1.4
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rspec
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 15
|
63
|
+
segments:
|
64
|
+
- 1
|
65
|
+
- 2
|
66
|
+
- 8
|
67
|
+
version: 1.2.8
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id003
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: mocha
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 53
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
- 9
|
82
|
+
- 7
|
83
|
+
version: 0.9.7
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id004
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: fakeweb
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 17
|
95
|
+
segments:
|
96
|
+
- 1
|
97
|
+
- 2
|
98
|
+
- 7
|
99
|
+
version: 1.2.7
|
100
|
+
type: :development
|
101
|
+
version_requirements: *id005
|
102
|
+
description:
|
103
|
+
email: me@xxx.com
|
104
|
+
executables: []
|
105
|
+
|
106
|
+
extensions: []
|
107
|
+
|
108
|
+
extra_rdoc_files:
|
109
|
+
- README.textile
|
110
|
+
files:
|
111
|
+
- CHANGELOG
|
112
|
+
- Rakefile
|
113
|
+
- README.textile
|
114
|
+
- lib/savon/client.rb
|
115
|
+
- lib/savon/core_ext/datetime.rb
|
116
|
+
- lib/savon/core_ext/hash.rb
|
117
|
+
- lib/savon/core_ext/net_http.rb
|
118
|
+
- lib/savon/core_ext/object.rb
|
119
|
+
- lib/savon/core_ext/string.rb
|
120
|
+
- lib/savon/core_ext/symbol.rb
|
121
|
+
- lib/savon/core_ext/uri.rb
|
122
|
+
- lib/savon/core_ext.rb
|
123
|
+
- lib/savon/request.rb
|
124
|
+
- lib/savon/response.rb
|
125
|
+
- lib/savon/soap.rb
|
126
|
+
- lib/savon/wsdl.rb
|
127
|
+
- lib/savon/wsse.rb
|
128
|
+
- lib/savon.rb
|
129
|
+
- spec/basic_spec_helper.rb
|
130
|
+
- spec/endpoint_helper.rb
|
131
|
+
- spec/fixtures/response/response_fixture.rb
|
132
|
+
- spec/fixtures/wsdl/wsdl_fixture.rb
|
133
|
+
- spec/http_stubs.rb
|
134
|
+
- spec/integration/http_basic_auth_spec.rb
|
135
|
+
- spec/integration/server.rb
|
136
|
+
- spec/savon/client_spec.rb
|
137
|
+
- spec/savon/core_ext/datetime_spec.rb
|
138
|
+
- spec/savon/core_ext/hash_spec.rb
|
139
|
+
- spec/savon/core_ext/net_http_spec.rb
|
140
|
+
- spec/savon/core_ext/object_spec.rb
|
141
|
+
- spec/savon/core_ext/string_spec.rb
|
142
|
+
- spec/savon/core_ext/symbol_spec.rb
|
143
|
+
- spec/savon/core_ext/uri_spec.rb
|
144
|
+
- spec/savon/request_spec.rb
|
145
|
+
- spec/savon/response_spec.rb
|
146
|
+
- spec/savon/savon_spec.rb
|
147
|
+
- spec/savon/soap_spec.rb
|
148
|
+
- spec/savon/wsdl_spec.rb
|
149
|
+
- spec/savon/wsse_spec.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/fixtures/response/xml/authentication.xml
|
152
|
+
- spec/fixtures/response/xml/multi_ref.xml
|
153
|
+
- spec/fixtures/response/xml/soap_fault.xml
|
154
|
+
- spec/fixtures/response/xml/soap_fault12.xml
|
155
|
+
- spec/fixtures/wsdl/xml/authentication.xml
|
156
|
+
- spec/fixtures/wsdl/xml/namespaced_actions.xml
|
157
|
+
- spec/fixtures/wsdl/xml/no_namespace.xml
|
158
|
+
has_rdoc: true
|
159
|
+
homepage: http://github.com/johnreitano/savon
|
160
|
+
licenses: []
|
161
|
+
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options:
|
164
|
+
- --charset=UTF-8
|
165
|
+
- --title
|
166
|
+
- Savon
|
167
|
+
- --line-numbers
|
168
|
+
- --inline-source
|
169
|
+
require_paths:
|
170
|
+
- lib
|
171
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
hash: 3
|
177
|
+
segments:
|
178
|
+
- 0
|
179
|
+
version: "0"
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
hash: 3
|
186
|
+
segments:
|
187
|
+
- 0
|
188
|
+
version: "0"
|
189
|
+
requirements: []
|
190
|
+
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 1.3.7
|
193
|
+
signing_key:
|
194
|
+
specification_version: 3
|
195
|
+
summary: Heavy metal Ruby SOAP client library
|
196
|
+
test_files:
|
197
|
+
- spec/basic_spec_helper.rb
|
198
|
+
- spec/endpoint_helper.rb
|
199
|
+
- spec/fixtures/response/response_fixture.rb
|
200
|
+
- spec/fixtures/wsdl/wsdl_fixture.rb
|
201
|
+
- spec/http_stubs.rb
|
202
|
+
- spec/integration/http_basic_auth_spec.rb
|
203
|
+
- spec/integration/server.rb
|
204
|
+
- spec/savon/client_spec.rb
|
205
|
+
- spec/savon/core_ext/datetime_spec.rb
|
206
|
+
- spec/savon/core_ext/hash_spec.rb
|
207
|
+
- spec/savon/core_ext/net_http_spec.rb
|
208
|
+
- spec/savon/core_ext/object_spec.rb
|
209
|
+
- spec/savon/core_ext/string_spec.rb
|
210
|
+
- spec/savon/core_ext/symbol_spec.rb
|
211
|
+
- spec/savon/core_ext/uri_spec.rb
|
212
|
+
- spec/savon/request_spec.rb
|
213
|
+
- spec/savon/response_spec.rb
|
214
|
+
- spec/savon/savon_spec.rb
|
215
|
+
- spec/savon/soap_spec.rb
|
216
|
+
- spec/savon/wsdl_spec.rb
|
217
|
+
- spec/savon/wsse_spec.rb
|
218
|
+
- spec/spec_helper.rb
|