savon-SU 2.11.1b

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.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +15 -0
  4. data/.yardopts +6 -0
  5. data/CHANGELOG.md +1098 -0
  6. data/CONTRIBUTING.md +46 -0
  7. data/Gemfile +18 -0
  8. data/LICENSE +20 -0
  9. data/README.md +69 -0
  10. data/Rakefile +14 -0
  11. data/donate.png +0 -0
  12. data/lib/savon.rb +27 -0
  13. data/lib/savon/block_interface.rb +26 -0
  14. data/lib/savon/builder.rb +205 -0
  15. data/lib/savon/client.rb +102 -0
  16. data/lib/savon/core_ext/string.rb +29 -0
  17. data/lib/savon/header.rb +93 -0
  18. data/lib/savon/http_error.rb +27 -0
  19. data/lib/savon/log_message.rb +52 -0
  20. data/lib/savon/message.rb +37 -0
  21. data/lib/savon/mock.rb +5 -0
  22. data/lib/savon/mock/expectation.rb +80 -0
  23. data/lib/savon/mock/spec_helper.rb +62 -0
  24. data/lib/savon/model.rb +84 -0
  25. data/lib/savon/operation.rb +144 -0
  26. data/lib/savon/options.rb +410 -0
  27. data/lib/savon/qualified_message.rb +50 -0
  28. data/lib/savon/request.rb +97 -0
  29. data/lib/savon/request_logger.rb +48 -0
  30. data/lib/savon/response.rb +113 -0
  31. data/lib/savon/soap_fault.rb +50 -0
  32. data/lib/savon/version.rb +3 -0
  33. data/savon-SU.gemspec +46 -0
  34. data/spec/fixtures/gzip/message.gz +0 -0
  35. data/spec/fixtures/response/another_soap_fault.xml +14 -0
  36. data/spec/fixtures/response/authentication.xml +14 -0
  37. data/spec/fixtures/response/f5.xml +39 -0
  38. data/spec/fixtures/response/header.xml +13 -0
  39. data/spec/fixtures/response/list.xml +18 -0
  40. data/spec/fixtures/response/multi_ref.xml +39 -0
  41. data/spec/fixtures/response/soap_fault.xml +8 -0
  42. data/spec/fixtures/response/soap_fault12.xml +18 -0
  43. data/spec/fixtures/response/soap_fault_funky.xml +8 -0
  44. data/spec/fixtures/response/taxcloud.xml +1 -0
  45. data/spec/fixtures/ssl/client_cert.pem +16 -0
  46. data/spec/fixtures/ssl/client_encrypted_key.pem +30 -0
  47. data/spec/fixtures/ssl/client_encrypted_key_cert.pem +24 -0
  48. data/spec/fixtures/ssl/client_key.pem +15 -0
  49. data/spec/fixtures/wsdl/authentication.xml +63 -0
  50. data/spec/fixtures/wsdl/betfair.xml +2981 -0
  51. data/spec/fixtures/wsdl/edialog.xml +15416 -0
  52. data/spec/fixtures/wsdl/interhome.xml +2137 -0
  53. data/spec/fixtures/wsdl/lower_camel.xml +52 -0
  54. data/spec/fixtures/wsdl/multiple_namespaces.xml +92 -0
  55. data/spec/fixtures/wsdl/multiple_types.xml +60 -0
  56. data/spec/fixtures/wsdl/no_message_tag.xml +1267 -0
  57. data/spec/fixtures/wsdl/taxcloud.xml +934 -0
  58. data/spec/fixtures/wsdl/team_software.xml +1 -0
  59. data/spec/fixtures/wsdl/vies.xml +176 -0
  60. data/spec/fixtures/wsdl/wasmuth.xml +153 -0
  61. data/spec/integration/centra_spec.rb +66 -0
  62. data/spec/integration/email_example_spec.rb +32 -0
  63. data/spec/integration/random_quote_spec.rb +23 -0
  64. data/spec/integration/ratp_example_spec.rb +28 -0
  65. data/spec/integration/stockquote_example_spec.rb +28 -0
  66. data/spec/integration/support/application.rb +82 -0
  67. data/spec/integration/support/server.rb +84 -0
  68. data/spec/integration/temperature_example_spec.rb +46 -0
  69. data/spec/integration/zipcode_example_spec.rb +42 -0
  70. data/spec/savon/builder_spec.rb +137 -0
  71. data/spec/savon/client_spec.rb +271 -0
  72. data/spec/savon/core_ext/string_spec.rb +37 -0
  73. data/spec/savon/features/message_tag_spec.rb +61 -0
  74. data/spec/savon/http_error_spec.rb +49 -0
  75. data/spec/savon/log_message_spec.rb +44 -0
  76. data/spec/savon/message_spec.rb +70 -0
  77. data/spec/savon/mock_spec.rb +174 -0
  78. data/spec/savon/model_spec.rb +182 -0
  79. data/spec/savon/observers_spec.rb +92 -0
  80. data/spec/savon/operation_spec.rb +230 -0
  81. data/spec/savon/options_spec.rb +1064 -0
  82. data/spec/savon/qualified_message_spec.rb +20 -0
  83. data/spec/savon/request_logger_spec.rb +37 -0
  84. data/spec/savon/request_spec.rb +496 -0
  85. data/spec/savon/response_spec.rb +270 -0
  86. data/spec/savon/soap_fault_spec.rb +131 -0
  87. data/spec/spec_helper.rb +30 -0
  88. data/spec/support/adapters.rb +48 -0
  89. data/spec/support/endpoint.rb +25 -0
  90. data/spec/support/fixture.rb +39 -0
  91. data/spec/support/integration.rb +9 -0
  92. data/spec/support/stdout.rb +25 -0
  93. metadata +317 -0
@@ -0,0 +1,46 @@
1
+ # Contribution Guide
2
+
3
+ This page describes how to contribute changes to Savon.
4
+
5
+ Please do not create a pull request without reading this guide first.
6
+ Make sure to read the documentation for your version at [savonrb.com](http://savonrb.com/)
7
+ and post questions to the [mailing list](https://groups.google.com/forum/#!forum/savonrb).
8
+
9
+ **Bug fixes**
10
+
11
+ If you really think you found a bug, please make sure to add as many information as possible
12
+ to the ticket. You're a developer, we are developers and you know we need tests to reproduce
13
+ problems and make sure they don't come back.
14
+
15
+ So if you can reproduce your problem in a spec, that would be awesome! If you can't, please
16
+ let us know how we could make this easier for you. Also, provide code and the WSDL of the
17
+ service you're working with so others can try to come up with a spec for your problem.
18
+
19
+ After we have a failing spec, it obviously needs to be fixed. Make sure your new spec is the
20
+ only failing one under the `spec` directory. Travis only runs the "unit tests" at `spec/savon`,
21
+ but Savon actually has with some additional "integration/example specs" at `spec/integration`,
22
+ which you need to run locally to make sure the integration with real world services still works.
23
+
24
+ Notice that these specs are not run by Travis, because the service's are not guaranteed to work
25
+ all the time and the specs will timeout after a few seconds when the service is currently down.
26
+
27
+ Please follow this basic workflow for pull requests:
28
+
29
+ * [Fork the project](https://help.github.com/articles/fork-a-repo)
30
+ * Create a feature branch and make your bug fix
31
+ * Add tests for it!
32
+ * Update the [Changelog](https://github.com/savonrb/savon/blob/master/CHANGELOG.md)
33
+ * [Send a pull request](https://help.github.com/articles/using-pull-requests)
34
+ * [Check that your pull request passes the build](https://travis-ci.org/savonrb/savon/pull_requests)
35
+
36
+
37
+ **Improvements and feature requests**
38
+
39
+ If you have an idea for an improvement or a new feature, please feel free to
40
+ [create a new issue](https://github.com/savonrb/savon/issues/new) and describe your idea
41
+ so that other people can give their insights and opinions. This is also important to avoid
42
+ duplicate work.
43
+
44
+ Pull requests and issues on GitHub are meant to be used to discuss problems and ideas,
45
+ so please make sure to participate and follow up on questions. In case noone comments
46
+ on your ticket, please keep updating the ticket with additional information.
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem "httpclient", "~> 2.3.4"
5
+
6
+ gem "simplecov", :require => false
7
+ gem "coveralls", :require => false
8
+
9
+ platform :rbx do
10
+ gem 'json'
11
+ gem 'racc'
12
+ gem 'rubysl'
13
+ gem 'rubinius-coverage'
14
+ end
15
+
16
+ platform :jruby do
17
+ gem 'json'
18
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Daniel Harrington
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,69 @@
1
+ # Savon
2
+
3
+ Heavy metal SOAP client
4
+
5
+ [Documentation](http://savonrb.com) | [RDoc](http://rubydoc.info/gems/savon) |
6
+ [Mailing list](https://groups.google.com/forum/#!forum/savonrb) | [Twitter](http://twitter.com/savonrb)
7
+
8
+ [![Build Status](https://secure.travis-ci.org/savonrb/savon.png?branch=master)](http://travis-ci.org/savonrb/savon)
9
+ [![Gem Version](https://badge.fury.io/rb/savon.png)](http://badge.fury.io/rb/savon)
10
+ [![Code Climate](https://codeclimate.com/github/savonrb/savon.png)](https://codeclimate.com/github/savonrb/savon)
11
+ [![Coverage Status](https://coveralls.io/repos/savonrb/savon/badge.png?branch=version2)](https://coveralls.io/r/savonrb/savon)
12
+
13
+
14
+ ## Version 2
15
+
16
+ Savon version 2 is available through [Rubygems](http://rubygems.org/gems/savon) and can be installed via:
17
+
18
+ ```
19
+ $ gem install savon
20
+ ```
21
+
22
+ or add it to your Gemfile like this:
23
+
24
+ ```
25
+ gem 'savon', '~> 2.10.0'
26
+ ```
27
+
28
+ ## Usage example
29
+
30
+ ``` ruby
31
+ require 'savon'
32
+
33
+ # create a client for the service
34
+ client = Savon.client(wsdl: 'http://service.example.com?wsdl')
35
+
36
+ client.operations
37
+ # => [:find_user, :list_users]
38
+
39
+ # call the 'findUser' operation
40
+ response = client.call(:find_user, message: { id: 42 })
41
+
42
+ response.body
43
+ # => { find_user_response: { id: 42, name: 'Hoff' } }
44
+ ```
45
+
46
+ For more examples, you should check out the
47
+ [integration tests](https://github.com/savonrb/savon/tree/version2/spec/integration).
48
+
49
+ ## FAQ
50
+
51
+ * 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`.
52
+ - See https://github.com/savonrb/savon/issues/488 for more info
53
+
54
+ ## Give back
55
+
56
+ If you're using Savon and you or your company is making money from it, then please consider
57
+ donating via [Gittip](https://www.gittip.com/tjarratt/) so that I can continue to improve it.
58
+
59
+ [![donate](donate.png)](https://www.gittip.com/tjarratt/)
60
+
61
+
62
+ ## Documentation
63
+
64
+ Please make sure to [read the documentation](http://savonrb.com/version2/).
65
+
66
+ And if you find any problems with it or if you think something's missing,
67
+ feel free to [help out and improve the documentation](https://github.com/savonrb/savonrb.com).
68
+
69
+ Donate icon from the [Noun Project](http://thenounproject.com/noun/donate/#icon-No285).
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.pattern = "spec/savon/**/*_spec.rb"
6
+ end
7
+
8
+ desc "Run RSpec integration examples"
9
+ RSpec::Core::RakeTask.new "spec:integration" do |t|
10
+ t.pattern = "spec/integration/**/*_spec.rb"
11
+ end
12
+
13
+ task :default => :spec
14
+ task :test => :spec
Binary file
@@ -0,0 +1,27 @@
1
+ module Savon
2
+
3
+ Error = Class.new(RuntimeError)
4
+ InitializationError = Class.new(Error)
5
+ UnknownOptionError = Class.new(Error)
6
+ UnknownOperationError = Class.new(Error)
7
+ InvalidResponseError = Class.new(Error)
8
+
9
+ def self.client(globals = {}, &block)
10
+ Client.new(globals, &block)
11
+ end
12
+
13
+ def self.observers
14
+ @observers ||= []
15
+ end
16
+
17
+ def self.notify_observers(operation_name, builder, globals, locals)
18
+ observers.inject(nil) do |response, observer|
19
+ observer.notify(operation_name, builder, globals, locals)
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ require "savon/version"
26
+ require "savon/client"
27
+ require "savon/model"
@@ -0,0 +1,26 @@
1
+ module Savon
2
+ class BlockInterface
3
+
4
+ def initialize(target)
5
+ @target = target
6
+ end
7
+
8
+ def evaluate(block)
9
+ if block.arity > 0
10
+ block.call(@target)
11
+ else
12
+ @original = eval("self", block.binding)
13
+ instance_eval(&block)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def method_missing(method, *args, &block)
20
+ @target.send(method, *args, &block)
21
+ rescue NoMethodError
22
+ @original.send(method, *args, &block)
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,205 @@
1
+ require "savon/header"
2
+ require "savon/message"
3
+ require "nokogiri"
4
+ require "builder"
5
+ require "gyoku"
6
+
7
+ module Savon
8
+ class Builder
9
+
10
+ SCHEMA_TYPES = {
11
+ "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
12
+ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"
13
+ }
14
+
15
+ SOAP_NAMESPACE = {
16
+ 1 => "http://schemas.xmlsoap.org/soap/envelope/",
17
+ 2 => "http://www.w3.org/2003/05/soap-envelope"
18
+ }
19
+
20
+ WSA_NAMESPACE = "http://www.w3.org/2005/08/addressing"
21
+
22
+ def initialize(operation_name, wsdl, globals, locals)
23
+ @operation_name = operation_name
24
+
25
+ @wsdl = wsdl
26
+ @globals = globals
27
+ @locals = locals
28
+ @signature = @locals[:wsse_signature] || @globals[:wsse_signature]
29
+
30
+ @types = convert_type_definitions_to_hash
31
+ @used_namespaces = convert_type_namespaces_to_hash
32
+ end
33
+
34
+ def pretty
35
+ Nokogiri.XML(to_s).to_xml(:indent => 2)
36
+ end
37
+
38
+ def build_document
39
+ xml = tag(builder, :Envelope, namespaces_with_globals) do |xml|
40
+ tag(xml, :Header, header_attributes) { xml << header.to_s } unless header.empty?
41
+ if @globals[:no_message_tag]
42
+ tag(xml, :Body, body_attributes) { xml << message.to_s }
43
+ else
44
+ tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
45
+ end
46
+ end
47
+
48
+ # if we have a signature sign the document
49
+ if @signature
50
+ @signature.document = xml
51
+
52
+ 2.times do
53
+ @header = nil
54
+ @signature.document = tag(builder, :Envelope, namespaces_with_globals) do |xml|
55
+ tag(xml, :Header, header_attributes) { xml << header.to_s } unless header.empty?
56
+ if @globals[:no_message_tag]
57
+ tag(xml, :Body, body_attributes) { xml << message.to_s }
58
+ else
59
+ tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
60
+ end
61
+ end
62
+ end
63
+
64
+ xml = @signature.document
65
+ end
66
+
67
+ xml
68
+ end
69
+
70
+ def header_attributes
71
+ @globals[:use_wsa_headers] ? { 'xmlns:wsa' => WSA_NAMESPACE } : {}
72
+ end
73
+
74
+ def body_attributes
75
+ @body_attributes ||= @signature.nil? ? {} : @signature.body_attributes
76
+ end
77
+
78
+ def to_s
79
+ return @locals[:xml] if @locals.include? :xml
80
+ build_document
81
+ end
82
+
83
+ private
84
+
85
+ def convert_type_definitions_to_hash
86
+ @wsdl.type_definitions.inject({}) do |memo, (path, type)|
87
+ memo[path] = type
88
+ memo
89
+ end
90
+ end
91
+
92
+ def convert_type_namespaces_to_hash
93
+ @wsdl.type_namespaces.inject({}) do |memo, (path, uri)|
94
+ key, value = use_namespace(path, uri)
95
+ memo[key] = value
96
+ memo
97
+ end
98
+ end
99
+
100
+ def use_namespace(path, uri)
101
+ @internal_namespace_count ||= 0
102
+
103
+ unless identifier = namespace_by_uri(uri)
104
+ identifier = "ins#{@internal_namespace_count}"
105
+ namespaces["xmlns:#{identifier}"] = uri
106
+ @internal_namespace_count += 1
107
+ end
108
+
109
+ [path, identifier]
110
+ end
111
+
112
+ def namespaces_with_globals
113
+ namespaces.merge @globals[:namespaces]
114
+ end
115
+
116
+ def namespaces
117
+ @namespaces ||= begin
118
+ namespaces = SCHEMA_TYPES.dup
119
+
120
+ if namespace_identifier == nil
121
+ namespaces["xmlns"] = @globals[:namespace] || @wsdl.namespace
122
+ else
123
+ namespaces["xmlns:#{namespace_identifier}"] = @globals[:namespace] || @wsdl.namespace
124
+ end
125
+
126
+ key = ["xmlns"]
127
+ key << env_namespace if env_namespace && env_namespace != ""
128
+ namespaces[key.join(":")] = SOAP_NAMESPACE[@globals[:soap_version]]
129
+
130
+ namespaces
131
+ end
132
+ end
133
+
134
+ def env_namespace
135
+ @env_namespace ||= @globals[:env_namespace] || :env
136
+ end
137
+
138
+ def header
139
+ @header ||= Header.new(@globals, @locals)
140
+ end
141
+
142
+ def namespaced_message_tag
143
+ tag_name = message_tag
144
+ if namespace_identifier == nil
145
+ [tag_name, message_attributes]
146
+ elsif @used_namespaces[[tag_name.to_s]]
147
+ [@used_namespaces[[tag_name.to_s]], tag_name, message_attributes]
148
+ else
149
+ [namespace_identifier, tag_name, message_attributes]
150
+ end
151
+ end
152
+
153
+ def message_tag
154
+ message_tag = @locals[:message_tag]
155
+ message_tag ||= @wsdl.soap_input(@operation_name.to_sym) if @wsdl.document?
156
+ message_tag ||= Gyoku.xml_tag(@operation_name, :key_converter => @globals[:convert_request_keys_to])
157
+
158
+ @message_tag = message_tag.to_sym
159
+ end
160
+
161
+ def message_attributes
162
+ @locals[:attributes] || {}
163
+ end
164
+
165
+ def message
166
+ element_form_default = @globals[:element_form_default] || @wsdl.element_form_default
167
+ # TODO: clean this up! [dh, 2012-12-17]
168
+ Message.new(message_tag, namespace_identifier, @types, @used_namespaces, @locals[:message],
169
+ element_form_default, @globals[:convert_request_keys_to], @globals[:unwrap])
170
+ end
171
+
172
+ def namespace_identifier
173
+ return @globals[:namespace_identifier] if @globals.include? :namespace_identifier
174
+ return @namespace_identifier if @namespace_identifier
175
+
176
+ operation = @wsdl.operations[@operation_name] if @wsdl.document?
177
+ namespace_identifier = operation[:namespace_identifier] if operation
178
+ namespace_identifier ||= "wsdl"
179
+
180
+ @namespace_identifier = namespace_identifier.to_sym
181
+ end
182
+
183
+ def namespace_by_uri(uri)
184
+ namespaces.each do |candidate_identifier, candidate_uri|
185
+ return candidate_identifier.gsub(/^xmlns:/, '') if candidate_uri == uri
186
+ end
187
+ nil
188
+ end
189
+
190
+ def builder
191
+ builder = ::Builder::XmlMarkup.new
192
+ builder.instruct!(:xml, :encoding => @globals[:encoding])
193
+ builder
194
+ end
195
+
196
+ def tag(xml, name, namespaces = {}, &block)
197
+ if env_namespace && env_namespace != ""
198
+ xml.tag! env_namespace, name, namespaces, &block
199
+ else
200
+ xml.tag! name, namespaces, &block
201
+ end
202
+ end
203
+
204
+ end
205
+ end
@@ -0,0 +1,102 @@
1
+ require "savon/operation"
2
+ require "savon/request"
3
+ require "savon/options"
4
+ require "savon/block_interface"
5
+ require "wasabi"
6
+
7
+ module Savon
8
+ class Client
9
+
10
+ def initialize(globals = {}, &block)
11
+ unless globals.kind_of? Hash
12
+ raise_version1_initialize_error! globals
13
+ end
14
+
15
+ set_globals(globals, block)
16
+
17
+ unless wsdl_or_endpoint_and_namespace_specified?
18
+ raise_initialization_error!
19
+ end
20
+
21
+ build_wsdl_document
22
+ end
23
+
24
+ attr_reader :globals
25
+
26
+ def operations
27
+ raise_missing_wsdl_error! unless @wsdl.document?
28
+ @wsdl.soap_actions
29
+ end
30
+
31
+ def parameters(operation_name)
32
+ raise_missing_wsdl_error! unless @wsdl.document?
33
+ if !@wsdl.operations.[](operation_name).[](:parameters).nil?
34
+ @wsdl.operations.[](operation_name).[](:parameters).keys
35
+ else
36
+ return nil
37
+ end
38
+ end
39
+
40
+ def operation(operation_name)
41
+ Operation.create(operation_name, @wsdl, @globals)
42
+ end
43
+
44
+ def call(operation_name, locals = {}, &block)
45
+ operation(operation_name).call(locals, &block)
46
+ end
47
+
48
+ def service_name
49
+ raise_missing_wsdl_error! unless @wsdl.document?
50
+ @wsdl.service_name
51
+ end
52
+
53
+ def build_request(operation_name, locals = {}, &block)
54
+ operation(operation_name).request(locals, &block)
55
+ end
56
+
57
+ private
58
+
59
+ def set_globals(globals, block)
60
+ globals = GlobalOptions.new(globals)
61
+ BlockInterface.new(globals).evaluate(block) if block
62
+
63
+ @globals = globals
64
+ end
65
+
66
+ def build_wsdl_document
67
+ @wsdl = Wasabi::Document.new
68
+
69
+ @wsdl.document = @globals[:wsdl] if @globals.include? :wsdl
70
+ @wsdl.endpoint = @globals[:endpoint] if @globals.include? :endpoint
71
+ @wsdl.namespace = @globals[:namespace] if @globals.include? :namespace
72
+ @wsdl.servicename = @globals[:servicename] if @globals.include? :servicename
73
+ @wsdl.adapter = @globals[:adapter] if @globals.include? :adapter
74
+
75
+ @wsdl.request = WSDLRequest.new(@globals).build
76
+ end
77
+
78
+ def wsdl_or_endpoint_and_namespace_specified?
79
+ @globals.include?(:wsdl) || (@globals.include?(:endpoint) && @globals.include?(:namespace))
80
+ end
81
+
82
+ def raise_version1_initialize_error!(object)
83
+ raise InitializationError,
84
+ "Some code tries to initialize Savon with the #{object.inspect} (#{object.class}) \n" \
85
+ "Savon 2 expects a Hash of options for creating a new client and executing requests.\n" \
86
+ "Please read the updated documentation for version 2: http://savonrb.com/version2.html"
87
+ end
88
+
89
+ def raise_initialization_error!
90
+ raise InitializationError,
91
+ "Expected either a WSDL document or the SOAP endpoint and target namespace options.\n\n" \
92
+ "Savon.client(wsdl: '/Users/me/project/service.wsdl') # to use a local WSDL document\n" \
93
+ "Savon.client(wsdl: 'http://example.com?wsdl') # to use a remote WSDL document\n" \
94
+ "Savon.client(endpoint: 'http://example.com', namespace: 'http://v1.example.com') # if you don't have a WSDL document"
95
+ end
96
+
97
+ def raise_missing_wsdl_error!
98
+ raise "Unable to inspect the service without a WSDL document."
99
+ end
100
+
101
+ end
102
+ end