savon 2.11.2 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +17 -10
- data/CHANGELOG.md +17 -1
- data/README.md +14 -1
- data/lib/savon/options.rb +14 -1
- data/lib/savon/qualified_message.rb +2 -2
- data/lib/savon/request.rb +13 -3
- data/lib/savon/response.rb +1 -1
- data/lib/savon/soap_fault.rb +1 -3
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +2 -2
- data/spec/fixtures/response/empty_soap_fault.xml +13 -0
- data/spec/fixtures/response/no_body.xml +1 -0
- data/spec/fixtures/wsdl/elements_in_types.xml +43 -0
- data/spec/integration/centra_spec.rb +7 -6
- data/spec/integration/support/application.rb +1 -1
- data/spec/savon/options_spec.rb +44 -4
- data/spec/savon/qualified_message_spec.rb +33 -0
- data/spec/savon/request_spec.rb +52 -8
- data/spec/savon/response_spec.rb +5 -0
- data/spec/savon/soap_fault_spec.rb +10 -0
- data/spec/support/integration.rb +1 -1
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: adc5b65f9ac22024b164dae28b0198a4269b97ab14afac694b946e7cef896d7e
|
4
|
+
data.tar.gz: 13138a12de62757d551a9114b2741501accbbad169a2a00a9dee7f439ad48a78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11e3b779fc0376993c46d6ab595e96896a5b0a7ea6f478d3ce93918ebfbd93ff14c4c5ac44c0080ce527c4e30e8615d559b373900acf35b96d2d67b1661b0f28
|
7
|
+
data.tar.gz: 0a8b5bcacf019b33eaafee305aee4f33c1733c26455d446738c28ad14567d69288c0f1cc0226f2e9c5304687a5b49a7011397465c16350b03b31370626014292
|
data/.travis.yml
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
# https://github.com/travis-ci/travis-ci/wiki/.travis.yml-options
|
2
2
|
language: "ruby"
|
3
|
-
|
4
|
-
before_install:
|
5
|
-
- gem install bundler
|
3
|
+
|
6
4
|
script: "bundle exec rake --trace"
|
5
|
+
|
7
6
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
- 2.
|
11
|
-
|
12
|
-
- jruby
|
13
|
-
- rbx-2
|
7
|
+
- "2.5"
|
8
|
+
- "2.6"
|
9
|
+
- "2.7"
|
10
|
+
|
14
11
|
matrix:
|
12
|
+
include:
|
13
|
+
- name: "JRuby 9.2"
|
14
|
+
rvm: jruby-9.2.12.0
|
15
|
+
jdk: openjdk11
|
16
|
+
env: JAVA_OPTS="--add-opens java.base/java.security.cert=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED"
|
17
|
+
- name: Rubinius
|
18
|
+
rvm: rbx-4
|
19
|
+
dist: trusty
|
15
20
|
allow_failures:
|
16
|
-
-
|
21
|
+
- name: Rubinius
|
22
|
+
- name: "JRuby 9.2"
|
17
23
|
fast_finish: true
|
24
|
+
|
18
25
|
notifications:
|
19
26
|
irc: "irc.freenode.org#savon"
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
|
2
|
+
## 2.12.1 (2020-07-05)
|
3
|
+
|
4
|
+
* Fix: [#917](https://github.com/savonrb/savon/pull/917) elementFormDefault="qualified" regression
|
5
|
+
* Fix: [#875](https://github.com/savonrb/savon/pull/875) Fix detecting Soap 1.1 Fault when faultcode and faultstring are empty
|
6
|
+
|
7
|
+
# 2.12.0 (2018-01-16)
|
8
|
+
|
9
|
+
* Drop support for ruby 2.1 and below.
|
10
|
+
* Fix: [#822](https://github.com/savonrb/savon/pull/822) Raise correct error when SOAP envelope only contains a string
|
11
|
+
* Fix: [#833](https://github.com/savonrb/savon/pull/833) Fixes boolean handling regression introduced in 2.11.2
|
12
|
+
* Feature: [#794](https://github.com/savonrb/savon/pull/794), add global option ssl_ciphers.
|
13
|
+
* Feature: [#753](https://github.com/savonrb/savon/pull/753) Add headers configuration to WSDLRequest#build
|
14
|
+
* Feature: [#812](https://github.com/savonrb/savon/pull/812) Allow `proxy` option to be `nil`.
|
15
|
+
* Feature: [#838](https://github.com/savonrb/savon/pull/838) Added ssl_ca_path and ssl_cert_store to globals
|
16
|
+
|
1
17
|
# 2.11.2 (2017-08-03)
|
2
18
|
* Fix: [#676](https://github.com/savonrb/savon/pull/676) Fixes handling of `content!` and `attributes!`
|
3
19
|
* Fix: [#800](https://github.com/savonrb/savon/pull/800) Fix exception calling `SOAPFault#to_s` when http.body is empty
|
@@ -13,7 +29,7 @@
|
|
13
29
|
|
14
30
|
# 2.11.0 (2015-03-31)
|
15
31
|
|
16
|
-
* Formally drop support for 1.8.7.
|
32
|
+
* Formally drop support for 1.8.7.
|
17
33
|
|
18
34
|
# 2.10.1 (2015-03-15)
|
19
35
|
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ $ gem install savon
|
|
22
22
|
or add it to your Gemfile like this:
|
23
23
|
|
24
24
|
```
|
25
|
-
gem 'savon', '~> 2.
|
25
|
+
gem 'savon', '~> 2.12.0'
|
26
26
|
```
|
27
27
|
|
28
28
|
## Usage example
|
@@ -46,6 +46,19 @@ response.body
|
|
46
46
|
For more examples, you should check out the
|
47
47
|
[integration tests](https://github.com/savonrb/savon/tree/version2/spec/integration).
|
48
48
|
|
49
|
+
## Ruby version support
|
50
|
+
* 2.12.x - MRI 2.2, 2.3, 2.4
|
51
|
+
* 2.11.x - MRI 2.0, 2.1, 2.2, and 2.3
|
52
|
+
|
53
|
+
If you are running MRI 1.8.7, try the 2.6.x branch.
|
54
|
+
|
55
|
+
## Running tests
|
56
|
+
|
57
|
+
```bash
|
58
|
+
$ bundle install
|
59
|
+
$ bundle exec rspec
|
60
|
+
```
|
61
|
+
|
49
62
|
## FAQ
|
50
63
|
|
51
64
|
* URI::InvalidURIError -- if you see this error, then it is likely that the http client you are using cannot parse the URI for your WSDL. Try `gem install httpclient` or add it to your `Gemfile`.
|
data/lib/savon/options.rb
CHANGED
@@ -137,7 +137,7 @@ module Savon
|
|
137
137
|
|
138
138
|
# Proxy server to use for all requests.
|
139
139
|
def proxy(proxy)
|
140
|
-
@options[:proxy] = proxy
|
140
|
+
@options[:proxy] = proxy unless proxy.nil?
|
141
141
|
end
|
142
142
|
|
143
143
|
# A Hash of HTTP headers.
|
@@ -268,6 +268,19 @@ module Savon
|
|
268
268
|
@options[:ssl_ca_cert] = cert
|
269
269
|
end
|
270
270
|
|
271
|
+
def ssl_ciphers(ciphers)
|
272
|
+
@options[:ssl_ciphers] = ciphers
|
273
|
+
end
|
274
|
+
|
275
|
+
# Sets the ca cert path.
|
276
|
+
def ssl_ca_cert_path(path)
|
277
|
+
@options[:ssl_ca_cert_path] = path
|
278
|
+
end
|
279
|
+
|
280
|
+
# Sets the ssl cert store.
|
281
|
+
def ssl_cert_store(store)
|
282
|
+
@options[:ssl_cert_store] = store
|
283
|
+
end
|
271
284
|
|
272
285
|
# HTTP basic auth credentials.
|
273
286
|
def basic_auth(*credentials)
|
@@ -9,7 +9,7 @@ module Savon
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_hash(hash, path)
|
12
|
-
return unless hash
|
12
|
+
return hash unless hash
|
13
13
|
return hash.map { |value| to_hash(value, path) } if hash.is_a?(Array)
|
14
14
|
return hash.to_s unless hash.is_a?(Hash)
|
15
15
|
|
@@ -26,7 +26,7 @@ module Savon
|
|
26
26
|
translated_key = translate_tag(key)
|
27
27
|
newkey = add_namespaces_to_values(key, path).first
|
28
28
|
newpath = path + [translated_key]
|
29
|
-
newhash[newkey] = to_hash(value, newpath)
|
29
|
+
newhash[newkey] = to_hash(value, @types[newpath] ? [@types[newpath]] : newpath)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
newhash
|
data/lib/savon/request.rb
CHANGED
@@ -26,13 +26,16 @@ module Savon
|
|
26
26
|
def configure_ssl
|
27
27
|
@http_request.auth.ssl.ssl_version = @globals[:ssl_version] if @globals.include? :ssl_version
|
28
28
|
@http_request.auth.ssl.verify_mode = @globals[:ssl_verify_mode] if @globals.include? :ssl_verify_mode
|
29
|
+
@http_request.auth.ssl.ciphers = @globals[:ssl_ciphers] if @globals.include? :ssl_ciphers
|
29
30
|
|
30
31
|
@http_request.auth.ssl.cert_key_file = @globals[:ssl_cert_key_file] if @globals.include? :ssl_cert_key_file
|
31
|
-
@http_request.auth.ssl.cert_key = @globals[:ssl_cert_key]
|
32
|
+
@http_request.auth.ssl.cert_key = @globals[:ssl_cert_key] if @globals.include? :ssl_cert_key
|
32
33
|
@http_request.auth.ssl.cert_file = @globals[:ssl_cert_file] if @globals.include? :ssl_cert_file
|
33
|
-
@http_request.auth.ssl.cert = @globals[:ssl_cert]
|
34
|
+
@http_request.auth.ssl.cert = @globals[:ssl_cert] if @globals.include? :ssl_cert
|
34
35
|
@http_request.auth.ssl.ca_cert_file = @globals[:ssl_ca_cert_file] if @globals.include? :ssl_ca_cert_file
|
35
|
-
@http_request.auth.ssl.
|
36
|
+
@http_request.auth.ssl.ca_cert_path = @globals[:ssl_ca_cert_path] if @globals.include? :ssl_ca_cert_path
|
37
|
+
@http_request.auth.ssl.ca_cert = @globals[:ssl_ca_cert] if @globals.include? :ssl_ca_cert
|
38
|
+
@http_request.auth.ssl.cert_store = @globals[:ssl_cert_store] if @globals.include? :ssl_cert_store
|
36
39
|
|
37
40
|
@http_request.auth.ssl.cert_key_password = @globals[:ssl_cert_key_password] if @globals.include? :ssl_cert_key_password
|
38
41
|
end
|
@@ -55,12 +58,19 @@ module Savon
|
|
55
58
|
def build
|
56
59
|
configure_proxy
|
57
60
|
configure_timeouts
|
61
|
+
configure_headers
|
58
62
|
configure_ssl
|
59
63
|
configure_auth
|
60
64
|
configure_redirect_handling
|
61
65
|
|
62
66
|
@http_request
|
63
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def configure_headers
|
72
|
+
@http_request.headers = @globals[:headers] if @globals.include? :headers
|
73
|
+
end
|
64
74
|
end
|
65
75
|
|
66
76
|
class SOAPRequest < HTTPRequest
|
data/lib/savon/response.rb
CHANGED
data/lib/savon/soap_fault.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
require "savon"
|
2
|
-
|
3
1
|
module Savon
|
4
2
|
class SOAPFault < Error
|
5
3
|
|
6
4
|
def self.present?(http, xml = nil)
|
7
5
|
xml ||= http.body
|
8
6
|
fault_node = xml.include?("Fault>")
|
9
|
-
soap1_fault = xml.
|
7
|
+
soap1_fault = xml.match(/faultcode\/?\>/) && xml.match(/faultstring\/?\>/)
|
10
8
|
soap2_fault = xml.include?("Code>") && xml.include?("Reason>")
|
11
9
|
|
12
10
|
fault_node && (soap1_fault || soap2_fault)
|
data/lib/savon/version.rb
CHANGED
data/savon.gemspec
CHANGED
@@ -23,10 +23,10 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency "akami", "~> 1.2"
|
24
24
|
s.add_dependency "gyoku", "~> 1.2"
|
25
25
|
s.add_dependency "builder", ">= 2.1.2"
|
26
|
-
s.add_dependency "nokogiri", ">= 1.
|
26
|
+
s.add_dependency "nokogiri", ">= 1.8.1"
|
27
27
|
|
28
28
|
s.add_development_dependency "rack"
|
29
|
-
s.add_development_dependency "puma", "
|
29
|
+
s.add_development_dependency "puma", "~> 3.0"
|
30
30
|
|
31
31
|
s.add_development_dependency "rake", "~> 10.1"
|
32
32
|
s.add_development_dependency "rspec", "~> 2.14"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
|
2
|
+
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
3
|
+
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
4
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
5
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
6
|
+
<SOAP-ENV:Body>
|
7
|
+
<SOAP-ENV:Fault>
|
8
|
+
<faultcode/>
|
9
|
+
<faultstring/>
|
10
|
+
<detail><soapVal><ERRNO xsi:type="xsd:string">80:1289245853:55</ERRNO></soapVal></detail>
|
11
|
+
</SOAP-ENV:Fault>
|
12
|
+
</SOAP-ENV:Body>
|
13
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1 @@
|
|
1
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">Text</soap:Envelope>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="www.example.com/XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="www.example.com/XML" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
3
|
+
<wsdl:types>
|
4
|
+
<s:schema elementFormDefault="qualified" targetNamespace="www.example.com/XML">
|
5
|
+
<s:complexType name="Transaction" abstract="true">
|
6
|
+
<s:sequence>
|
7
|
+
<s:element minOccurs="0" maxOccurs="1" name="Qualified" type="s:string" />
|
8
|
+
</s:sequence>
|
9
|
+
</s:complexType>
|
10
|
+
<s:complexType name="TopLevelTransaction">
|
11
|
+
<s:complexContent mixed="false">
|
12
|
+
<s:extension base="tns:Transaction">
|
13
|
+
</s:extension>
|
14
|
+
</s:complexContent>
|
15
|
+
</s:complexType>
|
16
|
+
<s:element name="TopLevelTransaction">
|
17
|
+
<s:complexType>
|
18
|
+
<s:sequence>
|
19
|
+
<s:element minOccurs="0" maxOccurs="1" name="TopLevelTransaction" type="tns:TopLevelTransaction" />
|
20
|
+
</s:sequence>
|
21
|
+
</s:complexType>
|
22
|
+
</s:element>
|
23
|
+
</s:schema>
|
24
|
+
</wsdl:types>
|
25
|
+
<wsdl:message name="TopLevelTransactionSoapIn">
|
26
|
+
<wsdl:part name="parameters" element="tns:TopLevelTransaction" />
|
27
|
+
</wsdl:message>
|
28
|
+
<wsdl:portType name="XMLTESoap">
|
29
|
+
<wsdl:operation name="TopLevelTransaction">
|
30
|
+
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">TopLevelTransaction.</wsdl:documentation>
|
31
|
+
<wsdl:input message="tns:TopLevelTransactionSoapIn" />
|
32
|
+
</wsdl:operation>
|
33
|
+
</wsdl:portType>
|
34
|
+
<wsdl:binding name="XMLTESoap12" type="tns:XMLTESoap">
|
35
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
36
|
+
<wsdl:operation name="TopLevelTransaction">
|
37
|
+
<soap12:operation soapAction="www.example.com/XML/TopLevelTransaction" style="document" />
|
38
|
+
<wsdl:input>
|
39
|
+
<soap12:body use="literal" />
|
40
|
+
</wsdl:input>
|
41
|
+
</wsdl:operation>
|
42
|
+
</wsdl:binding>
|
43
|
+
</wsdl:definitions>
|
@@ -2,14 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module LogInterceptor
|
4
4
|
@@intercepted_request = ""
|
5
|
-
def self.debug(message)
|
5
|
+
def self.debug(message = nil)
|
6
|
+
message ||= yield if block_given?
|
7
|
+
|
6
8
|
# save only the first XMLly message
|
7
9
|
if message.include? "xml version"
|
8
10
|
@@intercepted_request = message if @@intercepted_request == ""
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
|
-
def self.info(message)
|
14
|
+
def self.info(message = nil)
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.get_intercepted_request
|
@@ -27,6 +29,7 @@ describe 'Correct translation of attributes to XML' do
|
|
27
29
|
|
28
30
|
client = Savon.client(
|
29
31
|
:wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
|
32
|
+
:log => true,
|
30
33
|
:logger => LogInterceptor
|
31
34
|
)
|
32
35
|
|
@@ -48,14 +51,12 @@ describe 'Correct translation of attributes to XML' do
|
|
48
51
|
|
49
52
|
client = Savon.client(
|
50
53
|
:wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
|
54
|
+
:log => true,
|
51
55
|
:logger => LogInterceptor
|
52
56
|
)
|
53
57
|
|
54
58
|
response = nil
|
55
|
-
|
56
|
-
response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => {}, :attributes! => { :user => { :userID => "test" } } })
|
57
|
-
rescue
|
58
|
-
end
|
59
|
+
response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => {}, :attributes! => { :user => { :userID => "test" } } })
|
59
60
|
|
60
61
|
xml_doc = Nokogiri::XML(LogInterceptor.get_intercepted_request)
|
61
62
|
xml_doc.remove_namespaces!
|
data/spec/savon/options_spec.rb
CHANGED
@@ -219,6 +219,17 @@ describe "Options" do
|
|
219
219
|
expect(response.http.body).to include("<user>lea</user>")
|
220
220
|
expect(response.http.body).to include("<password>top-secret</password>")
|
221
221
|
end
|
222
|
+
|
223
|
+
it "qualifies elements embedded in complex types" do
|
224
|
+
client = new_client(:endpoint => @server.url(:repeat),
|
225
|
+
:wsdl => Fixture.wsdl(:elements_in_types))
|
226
|
+
msg = {":TopLevelTransaction"=>{":Qualified"=>"A Value"}}
|
227
|
+
|
228
|
+
response = client.call(:top_level_transaction, :message => msg)
|
229
|
+
|
230
|
+
expect(response.http.body.scan(/<tns:Qualified>/).count).to eq(1)
|
231
|
+
end
|
232
|
+
|
222
233
|
end
|
223
234
|
|
224
235
|
context "global :env_namespace" do
|
@@ -389,18 +400,27 @@ describe "Options" do
|
|
389
400
|
|
390
401
|
context "global :ssl_version" do
|
391
402
|
it "sets the SSL version to use" do
|
392
|
-
HTTPI::Auth::SSL.any_instance.expects(:ssl_version=).with(:
|
403
|
+
HTTPI::Auth::SSL.any_instance.expects(:ssl_version=).with(:TLSv1).twice
|
393
404
|
|
394
|
-
client = new_client(:endpoint => @server.url, :ssl_version => :
|
405
|
+
client = new_client(:endpoint => @server.url, :ssl_version => :TLSv1)
|
395
406
|
client.call(:authenticate)
|
396
407
|
end
|
397
408
|
end
|
398
409
|
|
399
410
|
context "global :ssl_verify_mode" do
|
400
411
|
it "sets the verify mode to use" do
|
401
|
-
HTTPI::Auth::SSL.any_instance.expects(:verify_mode=).with(:
|
412
|
+
HTTPI::Auth::SSL.any_instance.expects(:verify_mode=).with(:peer).twice
|
413
|
+
|
414
|
+
client = new_client(:endpoint => @server.url, :ssl_verify_mode => :peer)
|
415
|
+
client.call(:authenticate)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
context "global :ssl_ciphers" do
|
420
|
+
it "sets the ciphers to use" do
|
421
|
+
HTTPI::Auth::SSL.any_instance.expects(:ciphers=).with(:none).twice
|
402
422
|
|
403
|
-
client = new_client(:endpoint => @server.url, :
|
423
|
+
client = new_client(:endpoint => @server.url, :ssl_ciphers => :none)
|
404
424
|
client.call(:authenticate)
|
405
425
|
end
|
406
426
|
end
|
@@ -469,6 +489,26 @@ describe "Options" do
|
|
469
489
|
end
|
470
490
|
end
|
471
491
|
|
492
|
+
context "global :ssl_ca_cert_path" do
|
493
|
+
it "sets the ca cert path to use" do
|
494
|
+
ca_cert_path = "../../fixtures/ssl"
|
495
|
+
HTTPI::Auth::SSL.any_instance.expects(:ca_cert_path=).with(ca_cert_path).twice
|
496
|
+
|
497
|
+
client = new_client(:endpoint => @server.url, :ssl_ca_cert_path => ca_cert_path)
|
498
|
+
client.call(:authenticate)
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
context "global :ssl_ca_cert_store" do
|
503
|
+
it "sets the cert store to use" do
|
504
|
+
cert_store = OpenSSL::X509::Store.new
|
505
|
+
HTTPI::Auth::SSL.any_instance.expects(:cert_store=).with(cert_store).twice
|
506
|
+
|
507
|
+
client = new_client(:endpoint => @server.url, :ssl_cert_store => cert_store)
|
508
|
+
client.call(:authenticate)
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
472
512
|
context "global :ssl_ca_cert" do
|
473
513
|
it "sets the ca cert file to use" do
|
474
514
|
ca_cert = File.open(File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)).read
|
@@ -62,6 +62,39 @@ module Savon
|
|
62
62
|
expect(resulting_hash).to eq good_result
|
63
63
|
expect(xml).to eq good_xml
|
64
64
|
end
|
65
|
+
|
66
|
+
it "properly handles boolean false" do
|
67
|
+
used_namespaces = {
|
68
|
+
%w(tns Foo) => 'ns'
|
69
|
+
}
|
70
|
+
|
71
|
+
hash = {
|
72
|
+
:foo => {
|
73
|
+
:falsey => {
|
74
|
+
:@attr1 => false,
|
75
|
+
:content! => false
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
good_result = {
|
81
|
+
"ns:Foo" => {
|
82
|
+
:falsey => {
|
83
|
+
:@attr1 => false,
|
84
|
+
:content! => false
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
good_xml = %(<ns:Foo><Falsey attr1="false">false</Falsey></ns:Foo>)
|
90
|
+
|
91
|
+
message = described_class.new(types, used_namespaces, key_converter)
|
92
|
+
resulting_hash = message.to_hash(hash, ['tns'])
|
93
|
+
xml = Gyoku.xml(resulting_hash, key_converter: key_converter)
|
94
|
+
|
95
|
+
expect(resulting_hash).to eq good_result
|
96
|
+
expect(xml).to eq good_xml
|
97
|
+
end
|
65
98
|
end
|
66
99
|
|
67
100
|
end
|
data/spec/savon/request_spec.rb
CHANGED
@@ -5,6 +5,7 @@ describe Savon::WSDLRequest do
|
|
5
5
|
|
6
6
|
let(:globals) { Savon::GlobalOptions.new }
|
7
7
|
let(:http_request) { HTTPI::Request.new }
|
8
|
+
let(:ciphers) { OpenSSL::Cipher.ciphers }
|
8
9
|
|
9
10
|
def new_wsdl_request
|
10
11
|
Savon::WSDLRequest.new(globals, http_request)
|
@@ -16,6 +17,20 @@ describe Savon::WSDLRequest do
|
|
16
17
|
expect(wsdl_request.build).to be_an(HTTPI::Request)
|
17
18
|
end
|
18
19
|
|
20
|
+
describe "headers" do
|
21
|
+
it "are set when specified" do
|
22
|
+
globals.headers("Proxy-Authorization" => "Basic auth")
|
23
|
+
configured_http_request = new_wsdl_request.build
|
24
|
+
|
25
|
+
expect(configured_http_request.headers["Proxy-Authorization"]).to eq("Basic auth")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "are not set otherwise" do
|
29
|
+
configured_http_request = new_wsdl_request.build
|
30
|
+
expect(configured_http_request.headers).to_not include("Proxy-Authorization")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
19
34
|
describe "proxy" do
|
20
35
|
it "is set when specified" do
|
21
36
|
globals.proxy("http://proxy.example.com")
|
@@ -60,8 +75,8 @@ describe Savon::WSDLRequest do
|
|
60
75
|
|
61
76
|
describe "ssl version" do
|
62
77
|
it "is set when specified" do
|
63
|
-
globals.ssl_version(:
|
64
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:
|
78
|
+
globals.ssl_version(:TLSv1)
|
79
|
+
http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
|
65
80
|
|
66
81
|
new_wsdl_request.build
|
67
82
|
end
|
@@ -74,8 +89,8 @@ describe Savon::WSDLRequest do
|
|
74
89
|
|
75
90
|
describe "ssl verify mode" do
|
76
91
|
it "is set when specified" do
|
77
|
-
globals.ssl_verify_mode(:
|
78
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:
|
92
|
+
globals.ssl_verify_mode(:peer)
|
93
|
+
http_request.auth.ssl.expects(:verify_mode=).with(:peer)
|
79
94
|
|
80
95
|
new_wsdl_request.build
|
81
96
|
end
|
@@ -86,6 +101,20 @@ describe Savon::WSDLRequest do
|
|
86
101
|
end
|
87
102
|
end
|
88
103
|
|
104
|
+
describe "ssl ciphers" do
|
105
|
+
it "is set when specified" do
|
106
|
+
globals.ssl_ciphers(ciphers)
|
107
|
+
http_request.auth.ssl.expects(:ciphers=).with(ciphers)
|
108
|
+
|
109
|
+
new_wsdl_request.build
|
110
|
+
end
|
111
|
+
|
112
|
+
it "is not set otherwise" do
|
113
|
+
http_request.auth.ssl.expects(:ciphers=).never
|
114
|
+
new_wsdl_request.build
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
89
118
|
describe "ssl cert key file" do
|
90
119
|
it "is set when specified" do
|
91
120
|
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
@@ -232,6 +261,7 @@ describe Savon::SOAPRequest do
|
|
232
261
|
|
233
262
|
let(:globals) { Savon::GlobalOptions.new }
|
234
263
|
let(:http_request) { HTTPI::Request.new }
|
264
|
+
let(:ciphers) { OpenSSL::Cipher.ciphers }
|
235
265
|
|
236
266
|
def new_soap_request
|
237
267
|
Savon::SOAPRequest.new(globals, http_request)
|
@@ -364,8 +394,8 @@ describe Savon::SOAPRequest do
|
|
364
394
|
|
365
395
|
describe "ssl version" do
|
366
396
|
it "is set when specified" do
|
367
|
-
globals.ssl_version(:
|
368
|
-
http_request.auth.ssl.expects(:ssl_version=).with(:
|
397
|
+
globals.ssl_version(:TLSv1)
|
398
|
+
http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
|
369
399
|
|
370
400
|
new_soap_request.build
|
371
401
|
end
|
@@ -378,8 +408,8 @@ describe Savon::SOAPRequest do
|
|
378
408
|
|
379
409
|
describe "ssl verify mode" do
|
380
410
|
it "is set when specified" do
|
381
|
-
globals.ssl_verify_mode(:
|
382
|
-
http_request.auth.ssl.expects(:verify_mode=).with(:
|
411
|
+
globals.ssl_verify_mode(:peer)
|
412
|
+
http_request.auth.ssl.expects(:verify_mode=).with(:peer)
|
383
413
|
|
384
414
|
new_soap_request.build
|
385
415
|
end
|
@@ -390,6 +420,20 @@ describe Savon::SOAPRequest do
|
|
390
420
|
end
|
391
421
|
end
|
392
422
|
|
423
|
+
describe "ssl ciphers" do
|
424
|
+
it "is set when specified" do
|
425
|
+
globals.ssl_ciphers(ciphers)
|
426
|
+
http_request.auth.ssl.expects(:ciphers=).with(ciphers)
|
427
|
+
|
428
|
+
new_soap_request.build
|
429
|
+
end
|
430
|
+
|
431
|
+
it "is not set otherwise" do
|
432
|
+
http_request.auth.ssl.expects(:ciphers=).never
|
433
|
+
new_soap_request.build
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
393
437
|
describe "ssl cert key file" do
|
394
438
|
it "is set when specified" do
|
395
439
|
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
data/spec/savon/response_spec.rb
CHANGED
@@ -235,6 +235,11 @@ describe Savon::Response do
|
|
235
235
|
expect(result).to be_a(Hash)
|
236
236
|
expect(result.keys).to include(:authentication_value)
|
237
237
|
end
|
238
|
+
|
239
|
+
it 'fails correctly when envelope contains only string' do
|
240
|
+
response = soap_response({ :body => Fixture.response(:no_body) })
|
241
|
+
expect { response.find('Body') }.to raise_error Savon::InvalidResponseError
|
242
|
+
end
|
238
243
|
end
|
239
244
|
|
240
245
|
describe "#http" do
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Savon::SOAPFault do
|
4
4
|
let(:soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori }
|
5
|
+
let(:empty_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:empty_soap_fault)), nori }
|
5
6
|
let(:soap_fault2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori }
|
6
7
|
let(:soap_fault_funky) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault_funky)), nori }
|
7
8
|
let(:soap_fault_nc) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori_no_convert }
|
@@ -29,6 +30,11 @@ describe Savon::SOAPFault do
|
|
29
30
|
expect(Savon::SOAPFault.present? http).to be_truthy
|
30
31
|
end
|
31
32
|
|
33
|
+
it "returns true if the HTTP response contains a SOAP 1.1 fault with empty fault tags" do
|
34
|
+
http = new_response(:body => Fixture.response(:empty_soap_fault))
|
35
|
+
expect(Savon::SOAPFault.present? http).to be_truthy
|
36
|
+
end
|
37
|
+
|
32
38
|
it "returns true if the HTTP response contains a SOAP 1.2 fault" do
|
33
39
|
http = new_response(:body => Fixture.response(:soap_fault12))
|
34
40
|
expect(Savon::SOAPFault.present? http).to be_truthy
|
@@ -50,6 +56,10 @@ describe Savon::SOAPFault do
|
|
50
56
|
expect(soap_fault.send method).to eq("(soap:Server) Fault occurred while processing.")
|
51
57
|
end
|
52
58
|
|
59
|
+
it "returns an empty fault message" do
|
60
|
+
expect(empty_soap_fault.send method).to eq(nil)
|
61
|
+
end
|
62
|
+
|
53
63
|
it "returns a SOAP 1.2 fault message" do
|
54
64
|
expect(soap_fault2.send method).to eq("(soap:Sender) Sender Timeout")
|
55
65
|
end
|
data/spec/support/integration.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nori
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.8.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.8.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rack
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: puma
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '3.0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '3.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rake
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,10 +233,12 @@ files:
|
|
233
233
|
- spec/fixtures/gzip/message.gz
|
234
234
|
- spec/fixtures/response/another_soap_fault.xml
|
235
235
|
- spec/fixtures/response/authentication.xml
|
236
|
+
- spec/fixtures/response/empty_soap_fault.xml
|
236
237
|
- spec/fixtures/response/f5.xml
|
237
238
|
- spec/fixtures/response/header.xml
|
238
239
|
- spec/fixtures/response/list.xml
|
239
240
|
- spec/fixtures/response/multi_ref.xml
|
241
|
+
- spec/fixtures/response/no_body.xml
|
240
242
|
- spec/fixtures/response/soap_fault.xml
|
241
243
|
- spec/fixtures/response/soap_fault12.xml
|
242
244
|
- spec/fixtures/response/soap_fault_funky.xml
|
@@ -249,6 +251,7 @@ files:
|
|
249
251
|
- spec/fixtures/wsdl/betfair.xml
|
250
252
|
- spec/fixtures/wsdl/brand.xml
|
251
253
|
- spec/fixtures/wsdl/edialog.xml
|
254
|
+
- spec/fixtures/wsdl/elements_in_types.xml
|
252
255
|
- spec/fixtures/wsdl/interhome.xml
|
253
256
|
- spec/fixtures/wsdl/lower_camel.xml
|
254
257
|
- spec/fixtures/wsdl/multiple_namespaces.xml
|
@@ -310,8 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
313
|
- !ruby/object:Gem::Version
|
311
314
|
version: '0'
|
312
315
|
requirements: []
|
313
|
-
|
314
|
-
rubygems_version: 2.6.12
|
316
|
+
rubygems_version: 3.0.1
|
315
317
|
signing_key:
|
316
318
|
specification_version: 4
|
317
319
|
summary: Heavy metal SOAP client
|