savon 2.0.3 → 2.1.0

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.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .rvmrc
1
2
  .DS_Store
2
3
  .yardoc
3
4
  doc
@@ -1,9 +1,41 @@
1
- ## 2.0.3 (2013-01-19)
1
+ ### 2.1.0 (2013-02-03)
2
+
3
+ * Feature: [#372](https://github.com/savonrb/savon/pull/372) added global `ssl_cert_key_password` option.
4
+
5
+ * Feature: [#361](https://github.com/savonrb/savon/issues/361) added the local `:attributes`
6
+ option to allow adding XML attributes to the SOAP message tag.
7
+
8
+ * Improvement: [#363](https://github.com/savonrb/savon/issues/363) Savon 2.0 remembers the cookies from
9
+ the last response and passes it to the next request, which is not a proper way to handle cookies.
10
+ I removed this behavior and introduced an easy way to handle cookies manually instead.
11
+
12
+ * Improvement: [#380](https://github.com/savonrb/savon/pull/380) changed the gemspec to not rely on git.
13
+
14
+ * Fix: [#378](https://github.com/savonrb/savon/pull/378) use the proxy option for WSDL requests.
15
+
16
+ * Fix: [#369](https://github.com/savonrb/savon/pull/369) use HTTP basic and digest authentication
17
+ credentials to retrieve WSDL files.
18
+ Fixes [#367](https://github.com/savonrb/savon/issues/367#issuecomment-12720307).
19
+
20
+ * Fix: [#349](https://github.com/savonrb/savon/issues/349) global timeout and SSL options are
21
+ now used to retrieve a remote WSDL document.
22
+
23
+ * Fix: [#353](https://github.com/savonrb/savon/issues/353) simplified logging. the global `:log`
24
+ option is now only used to store whether Savon should log instead of creating a new `Logger`
25
+ and changing its logdev to `$stdout` or `/dev/null` depending on the what was passed.
26
+
27
+ This also fixes [rubiii/savon#2](https://github.com/rubiii/savon/issues/2) and
28
+ [#379](https://github.com/savonrb/savon/issues/379).
29
+
30
+ * Fix: [#376](https://github.com/savonrb/savon/issues/376) added a global `namespaces` option
31
+ for adding namespaces to the SOAP envelope.
32
+
33
+ ### 2.0.3 (2013-01-19)
2
34
 
3
35
  * Upgraded Nori dependency to prevent people from using a version that is vulnerable to
4
36
  the recent [remote code execution bug](https://gist.github.com/4532291).
5
37
 
6
- ## 2.0.2 (2012-12-20)
38
+ ### 2.0.2 (2012-12-20)
7
39
 
8
40
  * Fix: [#297](https://github.com/savonrb/savon/issues/297#issuecomment-11536517) added the global
9
41
  `:ssl_verify_mode` and `:ssl_version` options which were missing.
@@ -11,13 +43,13 @@
11
43
  * Fix: [#344](https://github.com/savonrb/savon/issues/344) added missing global ssl cert options
12
44
  `:ssl_cert_file`, `:ssl_cert_key_file` and `:ssl_ca_cert_file`.
13
45
 
14
- ## 2.0.1 (2012-12-19)
46
+ ### 2.0.1 (2012-12-19)
15
47
 
16
48
  * Fix [#342](https://github.com/savonrb/savon/issues/342) fixes an issue where namespaces could
17
49
  not be resolved if the actual operation name to call did not match the operation name passed
18
50
  to the client's `#call` method. For example: `:get_stations` for a `getStations` operation.
19
51
 
20
- ## 2.0.0 (2012-12-18)
52
+ ### 2.0.0 (2012-12-18)
21
53
 
22
54
  * Read about all the changes in the [updated documentation](http://savonrb.com/version2.html).
23
55
 
@@ -32,7 +64,7 @@
32
64
 
33
65
  * Fix: [321](https://github.com/savonrb/savon/issues/321) preserve `[false]` values in Hashes.
34
66
 
35
- ## 1.2.0 (2012-09-15)
67
+ ### 1.2.0 (2012-09-15)
36
68
 
37
69
  * Fix: [#312](https://github.com/savonrb/savon/pull/312) recursively determines the proper namespaces
38
70
  for SOAP body Hashes with nested Arrays of Hashes.
@@ -42,7 +74,7 @@
42
74
 
43
75
  * Refactoring: Use the `Wasabi::Document` with resolver instead of the custom `Savon::Wasabi::Document`.
44
76
 
45
- ## 1.1.0 (2012-06-28)
77
+ ### 1.1.0 (2012-06-28)
46
78
 
47
79
  * Improvement: Changed Savon's core dependencies to be more strict and only allow bug fix changes.
48
80
  Major or minor releases of these dependencies now need a release of Savon so they can be used.
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source :rubygems
2
2
  gemspec
3
3
 
4
4
  gem "httpclient", "~> 2.3.0"
5
+ gem "simplecov", :require => false, :group => :test
@@ -1,8 +1,8 @@
1
1
  module Savon
2
2
 
3
- class Error < RuntimeError; end
4
- class InitializationError < Error; end
5
- class InvalidResponseError < Error; end
3
+ Error = Class.new(RuntimeError)
4
+ InitializationError = Class.new(Error)
5
+ InvalidResponseError = Class.new(Error)
6
6
 
7
7
  def self.client(globals = {}, &block)
8
8
  Client.new(globals, &block)
@@ -30,7 +30,7 @@ module Savon
30
30
  def to_s
31
31
  return @locals[:xml] if @locals.include? :xml
32
32
 
33
- tag(builder, :Envelope, namespaces) do |xml|
33
+ tag(builder, :Envelope, namespaces_with_globals) do |xml|
34
34
  tag(xml, :Header) { xml << header.to_s } unless header.empty?
35
35
  tag(xml, :Body) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
36
36
  end
@@ -65,6 +65,10 @@ module Savon
65
65
  [path, identifier]
66
66
  end
67
67
 
68
+ def namespaces_with_globals
69
+ namespaces.merge @globals[:namespaces]
70
+ end
71
+
68
72
  def namespaces
69
73
  @namespaces ||= begin
70
74
  namespaces = SCHEMA_TYPES.dup
@@ -87,8 +91,11 @@ module Savon
87
91
  end
88
92
 
89
93
  def namespaced_message_tag
90
- return [namespace_identifier, message_tag] unless @used_namespaces[[@operation_name.to_s]]
91
- [@used_namespaces[[@operation_name.to_s]], message_tag]
94
+ if @used_namespaces[[@operation_name.to_s]]
95
+ [@used_namespaces[[@operation_name.to_s]], message_tag, message_attributes]
96
+ else
97
+ [namespace_identifier, message_tag, message_attributes]
98
+ end
92
99
  end
93
100
 
94
101
  def message_tag
@@ -99,6 +106,10 @@ module Savon
99
106
  @message_tag = message_tag.to_sym
100
107
  end
101
108
 
109
+ def message_attributes
110
+ @locals[:attributes] || {}
111
+ end
112
+
102
113
  def message
103
114
  element_form_default = @globals[:element_form_default] || @wsdl.element_form_default
104
115
  # TODO: clean this up! [dh, 2012-12-17]
@@ -1,4 +1,5 @@
1
1
  require "savon/operation"
2
+ require "savon/request"
2
3
  require "savon/options"
3
4
  require "savon/block_interface"
4
5
  require "wasabi"
@@ -7,6 +8,10 @@ module Savon
7
8
  class Client
8
9
 
9
10
  def initialize(globals = {}, &block)
11
+ unless globals.kind_of? Hash
12
+ raise_version1_initialize_error! globals
13
+ end
14
+
10
15
  @globals = GlobalOptions.new(globals)
11
16
 
12
17
  BlockInterface.new(@globals).evaluate(block) if block
@@ -15,10 +20,7 @@ module Savon
15
20
  raise_initialization_error!
16
21
  end
17
22
 
18
- @wsdl = Wasabi::Document.new
19
- @wsdl.document = @globals[:wsdl] if @globals.include? :wsdl
20
- @wsdl.endpoint = @globals[:endpoint] if @globals.include? :endpoint
21
- @wsdl.namespace = @globals[:namespace] if @globals.include? :namespace
23
+ build_wsdl_document
22
24
  end
23
25
 
24
26
  attr_reader :globals
@@ -33,21 +35,32 @@ module Savon
33
35
  end
34
36
 
35
37
  def call(operation_name, locals = {}, &block)
36
- response = operation(operation_name).call(locals, &block)
37
- persist_last_response(response)
38
- response
38
+ operation(operation_name).call(locals, &block)
39
39
  end
40
40
 
41
41
  private
42
42
 
43
- def persist_last_response(response)
44
- @globals[:last_response] = response.http
43
+ def build_wsdl_document
44
+ @wsdl = Wasabi::Document.new
45
+
46
+ @wsdl.document = @globals[:wsdl] if @globals.include? :wsdl
47
+ @wsdl.endpoint = @globals[:endpoint] if @globals.include? :endpoint
48
+ @wsdl.namespace = @globals[:namespace] if @globals.include? :namespace
49
+
50
+ @wsdl.request = WSDLRequest.new(@globals).build
45
51
  end
46
52
 
47
53
  def wsdl_or_endpoint_and_namespace_specified?
48
54
  @globals.include?(:wsdl) || (@globals.include?(:endpoint) && @globals.include?(:namespace))
49
55
  end
50
56
 
57
+ def raise_version1_initialize_error!(object)
58
+ raise InitializationError,
59
+ "Some code tries to initialize Savon with the #{object.inspect} (#{object.class}) \n" \
60
+ "Savon 2 expects a Hash of options for creating a new client and executing requests.\n" \
61
+ "Please read the updated documentation for version 2: http://savonrb.com/version2.html"
62
+ end
63
+
51
64
  def raise_initialization_error!
52
65
  raise InitializationError,
53
66
  "Expected either a WSDL document or the SOAP endpoint and target namespace options.\n\n" \
@@ -2,6 +2,8 @@ require "savon/options"
2
2
  require "savon/block_interface"
3
3
  require "savon/request"
4
4
  require "savon/builder"
5
+ require "savon/response"
6
+ require "savon/log_message"
5
7
 
6
8
  module Savon
7
9
  class Operation
@@ -41,10 +43,9 @@ module Savon
41
43
  BlockInterface.new(@locals).evaluate(block) if block
42
44
 
43
45
  builder = Builder.new(@name, @wsdl, @globals, @locals)
44
- request = Request.new(@name, @wsdl, @globals, @locals)
45
46
 
46
47
  response = Savon.notify_observers(@name, builder, @globals, @locals)
47
- response ||= request.call(builder.to_s)
48
+ response ||= call! build_request(builder)
48
49
 
49
50
  raise_expected_httpi_response! unless response.kind_of?(HTTPI::Response)
50
51
 
@@ -53,6 +54,73 @@ module Savon
53
54
 
54
55
  private
55
56
 
57
+ def call!(request)
58
+ log_request(request) if log?
59
+ response = HTTPI.post(request)
60
+ log_response(response) if log?
61
+
62
+ response
63
+ end
64
+
65
+ def build_request(builder)
66
+ request = SOAPRequest.new(@globals).build(
67
+ :soap_action => soap_action,
68
+ :cookies => @locals[:cookies]
69
+ )
70
+
71
+ request.url = endpoint
72
+ request.body = builder.to_s
73
+
74
+ # TODO: could HTTPI do this automatically in case the header
75
+ # was not specified manually? [dh, 2013-01-04]
76
+ request.headers["Content-Length"] = request.body.bytesize.to_s
77
+
78
+ request
79
+ end
80
+
81
+ def soap_action
82
+ # soap_action explicitly set to something falsy
83
+ return if @locals.include?(:soap_action) && !@locals[:soap_action]
84
+
85
+ # get the soap_action from local options
86
+ soap_action = @locals[:soap_action]
87
+ # with no local option, but a wsdl, ask it for the soap_action
88
+ soap_action ||= @wsdl.soap_action(@name.to_sym) if @wsdl.document?
89
+ # if there is no soap_action up to this point, fallback to a simple default
90
+ soap_action ||= Gyoku.xml_tag(@name, :key_converter => @globals[:convert_request_keys_to])
91
+ end
92
+
93
+ def endpoint
94
+ @globals[:endpoint] || @wsdl.endpoint
95
+ end
96
+
97
+ def log_request(request)
98
+ logger.info "SOAP request: #{request.url}"
99
+ logger.info headers_to_log(request.headers)
100
+ logger.debug body_to_log(request.body)
101
+ end
102
+
103
+ def log_response(response)
104
+ logger.info "SOAP response (status #{response.code})"
105
+ logger.debug body_to_log(response.body)
106
+ end
107
+
108
+ def headers_to_log(headers)
109
+ headers.map { |key, value| "#{key}: #{value}" }.join(", ")
110
+ end
111
+
112
+ def body_to_log(body)
113
+ LogMessage.new(body, @globals[:filters], @globals[:pretty_print_xml]).to_s
114
+ end
115
+
116
+ def logger
117
+ @globals[:logger]
118
+ end
119
+
120
+ def log?
121
+ @globals[:log]
122
+ end
123
+
56
124
  def raise_expected_httpi_response!
57
125
  raise Error, "Observers need to return an HTTPI::Response to mock " \
58
126
  "the request or nil to execute the request."
@@ -38,7 +38,9 @@ module Savon
38
38
  defaults = {
39
39
  :encoding => "UTF-8",
40
40
  :soap_version => 1,
41
+ :namespaces => {},
41
42
  :logger => Logger.new($stdout),
43
+ :log => true,
42
44
  :filters => [],
43
45
  :pretty_print_xml => false,
44
46
  :raise_errors => true,
@@ -48,14 +50,12 @@ module Savon
48
50
 
49
51
  options = defaults.merge(options)
50
52
 
51
- # these options are shortcuts on the logger which needs to be set
52
- # before it can be modified to set these options.
53
- delayed_log = options.delete(:log)
53
+ # this option is a shortcut on the logger which needs to be set
54
+ # before it can be modified to set the option.
54
55
  delayed_level = options.delete(:log_level)
55
56
 
56
57
  super(options)
57
58
 
58
- log(delayed_log) unless delayed_log.nil?
59
59
  log_level(delayed_level) unless delayed_level.nil?
60
60
  end
61
61
 
@@ -79,6 +79,11 @@ module Savon
79
79
  @options[:namespace_identifier] = identifier
80
80
  end
81
81
 
82
+ # Namespaces for the SOAP envelope.
83
+ def namespaces(namespaces)
84
+ @options[:namespaces] = namespaces
85
+ end
86
+
82
87
  # Proxy server to use for all requests.
83
88
  def proxy(proxy)
84
89
  @options[:proxy] = proxy
@@ -135,16 +140,8 @@ module Savon
135
140
 
136
141
  # Whether or not to log.
137
142
  def log(log)
138
- if log
139
- HTTPI.log = true
140
- target = $stdout
141
- else
142
- HTTPI.log = false
143
- windows = RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i
144
- target = windows ? "NUL:" : "/dev/null"
145
- end
146
-
147
- @options[:logger] = Logger.new(target)
143
+ HTTPI.log = log
144
+ @options[:log] = log
148
145
  end
149
146
 
150
147
  # The logger to use. Defaults to a Savon::Logger instance.
@@ -174,12 +171,6 @@ module Savon
174
171
  @options[:pretty_print_xml] = pretty_print_xml
175
172
  end
176
173
 
177
- # Used by Savon to store the last response to pass
178
- # its cookies to the next request.
179
- def last_response(last_response)
180
- @options[:last_response] = last_response
181
- end
182
-
183
174
  # Specifies the SSL version to use.
184
175
  def ssl_version(version)
185
176
  @options[:ssl_version] = version
@@ -195,6 +186,11 @@ module Savon
195
186
  @options[:ssl_cert_key_file] = file
196
187
  end
197
188
 
189
+ # Sets the cert key password to use.
190
+ def ssl_cert_key_password(password)
191
+ @options[:ssl_cert_key_password] = password
192
+ end
193
+
198
194
  # Sets the cert file to use.
199
195
  def ssl_cert_file(file)
200
196
  @options[:ssl_cert_file] = file
@@ -266,11 +262,21 @@ module Savon
266
262
  @options[:message_tag] = message_tag
267
263
  end
268
264
 
265
+ # Attributes for the SOAP message tag.
266
+ def attributes(attributes)
267
+ @options[:attributes] = attributes
268
+ end
269
+
269
270
  # Value of the SOAPAction HTTP header.
270
271
  def soap_action(soap_action)
271
272
  @options[:soap_action] = soap_action
272
273
  end
273
274
 
275
+ # Cookies to be used for the next request.
276
+ def cookies(cookies)
277
+ @options[:cookies] = cookies
278
+ end
279
+
274
280
  # The SOAP request XML to send. Expected to be a String.
275
281
  def xml(xml)
276
282
  @options[:xml] = xml
@@ -11,7 +11,7 @@ module Savon
11
11
 
12
12
  def to_hash(hash, path)
13
13
  return unless hash
14
- return hash.map { |value| add_namespaces_to_body(value, path) } if hash.kind_of?(Array)
14
+ return hash.map { |value| to_hash(value, path) } if hash.kind_of?(Array)
15
15
  return hash.to_s unless hash.kind_of? Hash
16
16
 
17
17
  hash.inject({}) do |newhash, (key, value)|
@@ -21,7 +21,7 @@ module Savon
21
21
  if @used_namespaces[newpath]
22
22
  newhash.merge(
23
23
  "#{@used_namespaces[newpath]}:#{translated_key}" =>
24
- add_namespaces_to_body(value, @types[newpath] ? [@types[newpath]] : newpath)
24
+ to_hash(value, @types[newpath] ? [@types[newpath]] : newpath)
25
25
  )
26
26
  else
27
27
  add_namespaces_to_values(value, path) if key == :order!
@@ -32,10 +32,6 @@ module Savon
32
32
 
33
33
  private
34
34
 
35
- def add_namespaces_to_body(value, path)
36
- QualifiedMessage.new(@types, @used_namespaces, @key_converter).to_hash(value, path)
37
- end
38
-
39
35
  def add_namespaces_to_values(values, path)
40
36
  values.collect! { |value|
41
37
  camelcased_value = Gyoku.xml_tag(value, :key_converter => @key_converter)
@@ -1,114 +1,87 @@
1
1
  require "httpi"
2
- require "savon/response"
3
- require "savon/log_message"
4
2
 
5
3
  module Savon
6
- class Request
4
+ class HTTPRequest
7
5
 
8
- CONTENT_TYPE = {
9
- 1 => "text/xml;charset=%s",
10
- 2 => "application/soap+xml;charset=%s"
11
- }
12
-
13
- def initialize(operation_name, wsdl, globals, locals)
14
- @operation_name = operation_name
15
-
16
- @wsdl = wsdl
6
+ def initialize(globals, http_request = nil)
17
7
  @globals = globals
18
- @locals = locals
19
- @http = create_http_client
8
+ @http_request = http_request || HTTPI::Request.new
20
9
  end
21
10
 
22
- attr_reader :http
23
-
24
- def call(xml)
25
- @http.body = xml
26
- @http.headers["Content-Length"] = xml.bytesize.to_s
27
-
28
- log_request @http.url, @http.headers, @http.body
29
- response = HTTPI.post(@http)
30
- log_response response.code, response.body
31
-
32
- response
11
+ def build
12
+ @http_request
33
13
  end
34
14
 
35
15
  private
36
16
 
37
- def create_http_client
38
- http = HTTPI::Request.new
39
-
40
- configure_request(http)
41
- configure_timeouts(http)
42
- configure_headers(http)
43
- configure_ssl(http)
44
- configure_auth(http)
45
-
46
- http
17
+ def configure_proxy
18
+ @http_request.proxy = @globals[:proxy] if @globals.include? :proxy
47
19
  end
48
20
 
49
- def configure_request(http)
50
- http.url = @globals[:endpoint] || @wsdl.endpoint
51
- http.proxy = @globals[:proxy] if @globals.include? :proxy
52
- http.set_cookies @globals[:last_response] if @globals.include? :last_response
21
+ def configure_timeouts
22
+ @http_request.open_timeout = @globals[:open_timeout] if @globals.include? :open_timeout
23
+ @http_request.read_timeout = @globals[:read_timeout] if @globals.include? :read_timeout
53
24
  end
54
25
 
55
- def configure_timeouts(http)
56
- http.open_timeout = @globals[:open_timeout] if @globals.include? :open_timeout
57
- http.read_timeout = @globals[:read_timeout] if @globals.include? :read_timeout
26
+ def configure_ssl
27
+ @http_request.auth.ssl.ssl_version = @globals[:ssl_version] if @globals.include? :ssl_version
28
+ @http_request.auth.ssl.verify_mode = @globals[:ssl_verify_mode] if @globals.include? :ssl_verify_mode
29
+
30
+ @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_file = @globals[:ssl_cert_file] if @globals.include? :ssl_cert_file
32
+ @http_request.auth.ssl.ca_cert_file = @globals[:ssl_ca_cert_file] if @globals.include? :ssl_ca_cert_file
33
+
34
+ @http_request.auth.ssl.cert_key_password = @globals[:ssl_cert_key_password] if @globals.include? :ssl_cert_key_password
58
35
  end
59
36
 
60
- def configure_headers(http)
61
- http.headers = @globals[:headers] if @globals.include? :headers
62
- http.headers["SOAPAction"] ||= %{"#{soap_action}"} if soap_action
63
- http.headers["Content-Type"] = CONTENT_TYPE[@globals[:soap_version]] % @globals[:encoding]
37
+ def configure_auth
38
+ @http_request.auth.basic(*@globals[:basic_auth]) if @globals.include? :basic_auth
39
+ @http_request.auth.digest(*@globals[:digest_auth]) if @globals.include? :digest_auth
64
40
  end
65
41
 
66
- def configure_ssl(http)
67
- http.auth.ssl.ssl_version = @globals[:ssl_version] if @globals.include? :ssl_version
68
- http.auth.ssl.verify_mode = @globals[:ssl_verify_mode] if @globals.include? :ssl_verify_mode
42
+ end
69
43
 
70
- http.auth.ssl.cert_key_file = @globals[:ssl_cert_key_file] if @globals.include? :ssl_cert_key_file
71
- http.auth.ssl.cert_file = @globals[:ssl_cert_file] if @globals.include? :ssl_cert_file
72
- http.auth.ssl.ca_cert_file = @globals[:ssl_ca_cert_file] if @globals.include? :ssl_ca_cert_file
73
- end
44
+ class WSDLRequest < HTTPRequest
45
+
46
+ def build
47
+ configure_proxy
48
+ configure_timeouts
49
+ configure_ssl
50
+ configure_auth
74
51
 
75
- def configure_auth(http)
76
- http.auth.basic(*@globals[:basic_auth]) if @globals.include? :basic_auth
77
- http.auth.digest(*@globals[:digest_auth]) if @globals.include? :digest_auth
52
+ @http_request
78
53
  end
79
54
 
80
- def soap_action
81
- return if @locals.include?(:soap_action) && !@locals[:soap_action]
82
- return @soap_action if defined? @soap_action
55
+ end
83
56
 
84
- soap_action = @locals[:soap_action]
85
- soap_action ||= @wsdl.soap_action(@operation_name.to_sym) if @wsdl.document?
86
- soap_action ||= Gyoku.xml_tag(@operation_name, :key_converter => @globals[:convert_request_keys_to])
57
+ class SOAPRequest < HTTPRequest
87
58
 
88
- @soap_action = soap_action
89
- end
59
+ CONTENT_TYPE = {
60
+ 1 => "text/xml;charset=%s",
61
+ 2 => "application/soap+xml;charset=%s"
62
+ }
90
63
 
91
- def log_request(url, headers, body)
92
- logger.info "SOAP request: #{url}"
93
- logger.info headers_to_log(headers)
94
- logger.debug body_to_log(body)
95
- end
64
+ def build(options = {})
65
+ configure_proxy
66
+ configure_cookies options[:cookies]
67
+ configure_timeouts
68
+ configure_headers options[:soap_action]
69
+ configure_ssl
70
+ configure_auth
96
71
 
97
- def log_response(code, body)
98
- logger.info "SOAP response (status #{code})"
99
- logger.debug body_to_log(body)
72
+ @http_request
100
73
  end
101
74
 
102
- def headers_to_log(headers)
103
- headers.map { |key, value| "#{key}: #{value}" }.join(", ")
104
- end
75
+ private
105
76
 
106
- def body_to_log(body)
107
- LogMessage.new(body, @globals[:filters], @globals[:pretty_print_xml]).to_s
77
+ def configure_cookies(cookies)
78
+ @http_request.set_cookies(cookies) if cookies
108
79
  end
109
80
 
110
- def logger
111
- @globals[:logger]
81
+ def configure_headers(soap_action)
82
+ @http_request.headers = @globals[:headers] if @globals.include? :headers
83
+ @http_request.headers["SOAPAction"] ||= %{"#{soap_action}"} if soap_action
84
+ @http_request.headers["Content-Type"] ||= CONTENT_TYPE[@globals[:soap_version]] % @globals[:encoding]
112
85
  end
113
86
 
114
87
  end