savon 2.10.1 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,11 +2,13 @@ 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 }
8
9
  let(:soap_fault_nc2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori_no_convert }
9
10
  let(:another_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:another_soap_fault)), nori }
11
+ let(:soap_fault_no_body) { Savon::SOAPFault.new new_response(:body => {}), nori }
10
12
  let(:no_fault) { Savon::SOAPFault.new new_response, nori }
11
13
 
12
14
  let(:nori) { Nori.new(:strip_namespaces => true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym }) }
@@ -28,6 +30,11 @@ describe Savon::SOAPFault do
28
30
  expect(Savon::SOAPFault.present? http).to be_truthy
29
31
  end
30
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
+
31
38
  it "returns true if the HTTP response contains a SOAP 1.2 fault" do
32
39
  http = new_response(:body => Fixture.response(:soap_fault12))
33
40
  expect(Savon::SOAPFault.present? http).to be_truthy
@@ -49,6 +56,10 @@ describe Savon::SOAPFault do
49
56
  expect(soap_fault.send method).to eq("(soap:Server) Fault occurred while processing.")
50
57
  end
51
58
 
59
+ it "returns an empty fault message" do
60
+ expect(empty_soap_fault.send method).to eq(nil)
61
+ end
62
+
52
63
  it "returns a SOAP 1.2 fault message" do
53
64
  expect(soap_fault2.send method).to eq("(soap:Sender) Sender Timeout")
54
65
  end
@@ -119,6 +130,10 @@ describe Savon::SOAPFault do
119
130
 
120
131
  expect(soap_fault_nc2.to_hash).to eq(expected)
121
132
  end
133
+
134
+ it "returns empty hash" do
135
+ expect(soap_fault_no_body.to_hash).to eq({})
136
+ end
122
137
  end
123
138
 
124
139
  def new_response(options = {})
@@ -0,0 +1,27 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::Builder do
4
+
5
+ subject(:builder) { Savon::Builder.new(:create_object, wsdl, globals, locals) }
6
+
7
+ let(:globals) { Savon::GlobalOptions.new }
8
+ # let(:locals) { Savon::LocalOptions.new }
9
+ let(:wsdl) { Wasabi::Document.new Fixture.wsdl(:brand) }
10
+ let(:no_wsdl) { Wasabi::Document.new }
11
+
12
+ describe "#to_s" do
13
+ it "defaults to include the default envelope namespace of :env" do
14
+ message = {
15
+ :message=>{
16
+ :template_object=>{
17
+ :longName=>"Zertico LLC Reseller"
18
+ }
19
+ }
20
+ }
21
+
22
+ locals = Savon::LocalOptions.new(message)
23
+ builder = Savon::Builder.new(:create_object, wsdl, globals, locals)
24
+ expect(builder.to_s).to eq('<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.service.softlayer.com/soap/v3/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:createObject><templateObject><longName>Zertico LLC Reseller</longName></templateObject></tns:createObject></env:Body></env:Envelope>')
25
+ end
26
+ end
27
+ end
@@ -3,7 +3,7 @@ module SpecSupport
3
3
  def call_and_fail_gracefully(client, *args, &block)
4
4
  client.call(*args, &block)
5
5
  rescue Savon::SOAPFault => e
6
- pending e.message
6
+ puts e.message
7
7
  end
8
8
 
9
9
  end
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.10.1
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: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2020-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nori
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.2'
83
- - !ruby/object:Gem::Dependency
84
- name: uuid
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 2.3.7
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 2.3.7
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: builder
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +100,14 @@ dependencies:
114
100
  requirements:
115
101
  - - ">="
116
102
  - !ruby/object:Gem::Version
117
- version: 1.4.0
103
+ version: 1.8.1
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - ">="
123
109
  - !ruby/object:Gem::Version
124
- version: 1.4.0
110
+ version: 1.8.1
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: rack
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -140,16 +126,16 @@ dependencies:
140
126
  name: puma
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
- - - '='
129
+ - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: 2.0.0.b4
131
+ version: '3.0'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
- - - '='
136
+ - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: 2.0.0.b4
138
+ version: '3.0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: rake
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -219,7 +205,6 @@ files:
219
205
  - CONTRIBUTING.md
220
206
  - Gemfile
221
207
  - LICENSE
222
- - NotificationBroker.wsdl
223
208
  - README.md
224
209
  - Rakefile
225
210
  - donate.png
@@ -248,10 +233,12 @@ files:
248
233
  - spec/fixtures/gzip/message.gz
249
234
  - spec/fixtures/response/another_soap_fault.xml
250
235
  - spec/fixtures/response/authentication.xml
236
+ - spec/fixtures/response/empty_soap_fault.xml
251
237
  - spec/fixtures/response/f5.xml
252
238
  - spec/fixtures/response/header.xml
253
239
  - spec/fixtures/response/list.xml
254
240
  - spec/fixtures/response/multi_ref.xml
241
+ - spec/fixtures/response/no_body.xml
255
242
  - spec/fixtures/response/soap_fault.xml
256
243
  - spec/fixtures/response/soap_fault12.xml
257
244
  - spec/fixtures/response/soap_fault_funky.xml
@@ -262,7 +249,9 @@ files:
262
249
  - spec/fixtures/ssl/client_key.pem
263
250
  - spec/fixtures/wsdl/authentication.xml
264
251
  - spec/fixtures/wsdl/betfair.xml
252
+ - spec/fixtures/wsdl/brand.xml
265
253
  - spec/fixtures/wsdl/edialog.xml
254
+ - spec/fixtures/wsdl/elements_in_types.xml
266
255
  - spec/fixtures/wsdl/interhome.xml
267
256
  - spec/fixtures/wsdl/lower_camel.xml
268
257
  - spec/fixtures/wsdl/multiple_namespaces.xml
@@ -298,13 +287,13 @@ files:
298
287
  - spec/savon/request_spec.rb
299
288
  - spec/savon/response_spec.rb
300
289
  - spec/savon/soap_fault_spec.rb
290
+ - spec/savon/softlayer_spec.rb
301
291
  - spec/spec_helper.rb
302
292
  - spec/support/adapters.rb
303
293
  - spec/support/endpoint.rb
304
294
  - spec/support/fixture.rb
305
295
  - spec/support/integration.rb
306
296
  - spec/support/stdout.rb
307
- - test.rb
308
297
  homepage: http://savonrb.com
309
298
  licenses:
310
299
  - MIT
@@ -317,15 +306,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
306
  requirements:
318
307
  - - ">="
319
308
  - !ruby/object:Gem::Version
320
- version: '0'
309
+ version: 1.9.2
321
310
  required_rubygems_version: !ruby/object:Gem::Requirement
322
311
  requirements:
323
312
  - - ">="
324
313
  - !ruby/object:Gem::Version
325
314
  version: '0'
326
315
  requirements: []
327
- rubyforge_project: savon
328
- rubygems_version: 2.2.2
316
+ rubygems_version: 3.0.1
329
317
  signing_key:
330
318
  specification_version: 4
331
319
  summary: Heavy metal SOAP client
@@ -1,126 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
- <wsdl:definitions name="NotificationBrokerService"
3
- targetNamespace="http://docs.oasis-open.org/wsn/brw-2"
4
- xmlns:tns="http://docs.oasis-open.org/wsn/brw-2"
5
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
6
- xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
7
- xmlns:ns1="http://docs.oasis-open.org/wsn/brw-2">
8
-
9
- <wsdl:import namespace="http://docs.oasis-open.org/wsn/brw-2" location="http://docs.oasis-open.org/wsn/brw-2.wsdl"/>
10
-
11
- <wsdl:binding name="NotificationBrokerSoapBinding" type="ns1:NotificationBroker">
12
- <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
13
- <wsdl:operation name="Notify">
14
- <soap12:operation soapAction="" soapActionRequired="false" style="document"/>
15
- <wsdl:input name="Notify">
16
- <soap12:body use="literal"/>
17
- </wsdl:input>
18
- </wsdl:operation>
19
- <wsdl:operation name="GetCurrentMessage">
20
- <soap12:operation soapAction="" soapActionRequired="false" style="document"/>
21
- <wsdl:input name="GetCurrentMessageRequest">
22
- <soap12:body use="literal"/>
23
- </wsdl:input>
24
- <wsdl:output name="GetCurrentMessageResponse">
25
- <soap12:body use="literal"/>
26
- </wsdl:output>
27
- <wsdl:fault name="TopicNotSupportedFault">
28
- <soap12:fault name="TopicNotSupportedFault" use="literal"/>
29
- </wsdl:fault>
30
- <wsdl:fault name="TopicExpressionDialectUnknownFault">
31
- <soap12:fault name="TopicExpressionDialectUnknownFault" use="literal"/>
32
- </wsdl:fault>
33
- <wsdl:fault name="MultipleTopicsSpecifiedFault">
34
- <soap12:fault name="MultipleTopicsSpecifiedFault" use="literal"/>
35
- </wsdl:fault>
36
- <wsdl:fault name="InvalidTopicExpressionFault">
37
- <soap12:fault name="InvalidTopicExpressionFault" use="literal"/>
38
- </wsdl:fault>
39
- <wsdl:fault name="ResourceUnknownFault">
40
- <soap12:fault name="ResourceUnknownFault" use="literal"/>
41
- </wsdl:fault>
42
- <wsdl:fault name="NoCurrentMessageOnTopicFault">
43
- <soap12:fault name="NoCurrentMessageOnTopicFault" use="literal"/>
44
- </wsdl:fault>
45
- </wsdl:operation>
46
- <wsdl:operation name="RegisterPublisher">
47
- <soap12:operation soapAction="" soapActionRequired="false" style="document"/>
48
- <wsdl:input name="RegisterPublisherRequest">
49
- <soap12:body use="literal"/>
50
- </wsdl:input>
51
- <wsdl:output name="RegisterPublisherResponse">
52
- <soap12:body use="literal"/>
53
- </wsdl:output>
54
- <wsdl:fault name="TopicNotSupportedFault">
55
- <soap12:fault name="TopicNotSupportedFault" use="literal"/>
56
- </wsdl:fault>
57
- <wsdl:fault name="PublisherRegistrationFailedFault">
58
- <soap12:fault name="PublisherRegistrationFailedFault" use="literal"/>
59
- </wsdl:fault>
60
- <wsdl:fault name="UnacceptableInitialTerminationTimeFault">
61
- <soap12:fault name="UnacceptableInitialTerminationTimeFault" use="literal"/>
62
- </wsdl:fault>
63
- <wsdl:fault name="InvalidTopicExpressionFault">
64
- <soap12:fault name="InvalidTopicExpressionFault" use="literal"/>
65
- </wsdl:fault>
66
- <wsdl:fault name="ResourceUnknownFault">
67
- <soap12:fault name="ResourceUnknownFault" use="literal"/>
68
- </wsdl:fault>
69
- <wsdl:fault name="PublisherRegistrationRejectedFault">
70
- <soap12:fault name="PublisherRegistrationRejectedFault" use="literal"/>
71
- </wsdl:fault>
72
- </wsdl:operation>
73
- <wsdl:operation name="Subscribe">
74
- <soap12:operation soapAction="" soapActionRequired="false" style="document"/>
75
- <wsdl:input name="SubscribeRequest">
76
- <soap12:body use="literal"/>
77
- </wsdl:input>
78
- <wsdl:output name="SubscribeResponse">
79
- <soap12:body use="literal"/>
80
- </wsdl:output>
81
- <wsdl:fault name="TopicNotSupportedFault">
82
- <soap12:fault name="TopicNotSupportedFault" use="literal"/>
83
- </wsdl:fault>
84
- <wsdl:fault name="InvalidFilterFault">
85
- <soap12:fault name="InvalidFilterFault" use="literal"/>
86
- </wsdl:fault>
87
- <wsdl:fault name="TopicExpressionDialectUnknownFault">
88
- <soap12:fault name="TopicExpressionDialectUnknownFault" use="literal"/>
89
- </wsdl:fault>
90
- <wsdl:fault name="UnacceptableInitialTerminationTimeFault">
91
- <soap12:fault name="UnacceptableInitialTerminationTimeFault" use="literal"/>
92
- </wsdl:fault>
93
- <wsdl:fault name="SubscribeCreationFailedFault">
94
- <soap12:fault name="SubscribeCreationFailedFault" use="literal"/>
95
- </wsdl:fault>
96
- <wsdl:fault name="InvalidMessageContentExpressionFault">
97
- <soap12:fault name="InvalidMessageContentExpressionFault" use="literal"/>
98
- </wsdl:fault>
99
- <wsdl:fault name="InvalidTopicExpressionFault">
100
- <soap12:fault name="InvalidTopicExpressionFault" use="literal"/>
101
- </wsdl:fault>
102
- <wsdl:fault name="UnrecognizedPolicyRequestFault">
103
- <soap12:fault name="UnrecognizedPolicyRequestFault" use="literal"/>
104
- </wsdl:fault>
105
- <wsdl:fault name="ResourceUnknownFault">
106
- <soap12:fault name="ResourceUnknownFault" use="literal"/>
107
- </wsdl:fault>
108
- <wsdl:fault name="UnsupportedPolicyRequestFault">
109
- <soap12:fault name="UnsupportedPolicyRequestFault" use="literal"/>
110
- </wsdl:fault>
111
- <wsdl:fault name="NotifyMessageNotSupportedFault">
112
- <soap12:fault name="NotifyMessageNotSupportedFault" use="literal"/>
113
- </wsdl:fault>
114
- <wsdl:fault name="InvalidProducerPropertiesExpressionFault">
115
- <soap12:fault name="InvalidProducerPropertiesExpressionFault" use="literal"/>
116
- </wsdl:fault>
117
- </wsdl:operation>
118
- </wsdl:binding>
119
-
120
- <wsdl:service name="NotificationBrokerService">
121
- <wsdl:port binding="tns:NotificationBrokerSoapBinding" name="NotificationBrokerPort">
122
- <soap12:address location="http://192.70.89.113:9000/wsn/NotificationBroker"/>
123
- </wsdl:port>
124
- </wsdl:service>
125
-
126
- </wsdl:definitions>
data/test.rb DELETED
@@ -1,64 +0,0 @@
1
- require 'savon'
2
-
3
- class MyConfig
4
- def wsdl; "NotificationBroker.wsdl"; end
5
- def base; "base"; end
6
- end
7
-
8
-
9
- # Main module
10
- module Surv
11
- class Client
12
- attr_accessor :topics
13
- attr_reader :client, :config
14
-
15
- def initialize(config)
16
- @topics = Hash.new
17
-
18
- #$stderr.puts("Entry point is #{config.proto}://#{config.site}:#{config.port}/#{config.entry}.")
19
-
20
- client = Savon.client(wsdl: config.wsdl,
21
- strip_namespaces: false,
22
- log_level: :info,
23
- convert_request_keys_to: :camelcase,
24
- #pretty_print_xml: true,
25
- )
26
-
27
- #$stderr.puts("Entry point: #{client.wsdl.endpoint}")
28
- $stderr.puts("Init done.")
29
- $stderr.puts("Available methods: #{client.operations}")
30
- @client = client
31
- @config = config
32
- end
33
-
34
- def subscribe(topic, callback="callback")
35
- my_topic = "#{@config.base}/#{callback}"
36
- message = {
37
- ConsumerReference: {
38
- Address: my_topic,
39
- },
40
- Filter: {
41
- TopicExpression: topic,
42
- },
43
- }
44
-
45
- $stderr.puts(message)
46
- $stderr.puts(" Subscribing #{my_topic} for #{topic}")
47
-
48
- # @topics[callback] = Topic.new(callback)
49
- # @topics[callback].bytes = 0
50
- # @topics[callback].pkts = 0
51
-
52
- begin
53
- resp = client.call(:subscribe, message: message)
54
- rescue Savon::Error => error
55
- $stderr.puts("Error: #{error.http.code} #{error}")
56
- else
57
- puts "ZOMG request was successful??? #{resp}"
58
- end
59
- end
60
- end
61
- end
62
-
63
-
64
- Surv::Client.new(MyConfig.new).subscribe('AsterixJSONGzipped')