savon 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -9
- data/README.textile +0 -0
- data/Rakefile +0 -0
- data/VERSION +1 -1
- data/lib/savon.rb +0 -0
- data/lib/savon/client.rb +18 -5
- data/lib/savon/core_ext.rb +0 -0
- data/lib/savon/core_ext/datetime.rb +0 -0
- data/lib/savon/core_ext/hash.rb +0 -0
- data/lib/savon/core_ext/object.rb +0 -0
- data/lib/savon/core_ext/string.rb +1 -1
- data/lib/savon/core_ext/symbol.rb +0 -0
- data/lib/savon/core_ext/uri.rb +0 -0
- data/lib/savon/request.rb +1 -1
- data/lib/savon/response.rb +1 -1
- data/lib/savon/soap.rb +14 -5
- data/lib/savon/wsdl.rb +3 -9
- data/lib/savon/wsse.rb +0 -0
- data/spec/fixtures/multiple_user_response.xml +0 -0
- data/spec/fixtures/soap_fault.xml +0 -0
- data/spec/fixtures/user_fixture.rb +0 -0
- data/spec/fixtures/user_response.xml +0 -0
- data/spec/fixtures/user_wsdl.xml +0 -0
- data/spec/http_stubs.rb +0 -0
- data/spec/savon/client_spec.rb +0 -0
- data/spec/savon/core_ext/datetime_spec.rb +0 -0
- data/spec/savon/core_ext/hash_spec.rb +0 -0
- data/spec/savon/core_ext/object_spec.rb +0 -0
- data/spec/savon/core_ext/string_spec.rb +0 -0
- data/spec/savon/core_ext/symbol_spec.rb +0 -0
- data/spec/savon/core_ext/uri_spec.rb +0 -0
- data/spec/savon/request_spec.rb +0 -0
- data/spec/savon/response_spec.rb +0 -0
- data/spec/savon/savon_spec.rb +0 -0
- data/spec/savon/soap_spec.rb +0 -0
- data/spec/savon/wsdl_spec.rb +0 -0
- data/spec/savon/wsse_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/spec_helper_methods.rb +0 -0
- metadata +13 -13
data/CHANGELOG
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
+
== 0.6.3 (2009-12-11)
|
2
|
+
* Removing 2 ruby deprecation warnings for parenthesized arguments. (Dave Woodward <dave@futuremint.com>)
|
3
|
+
* Much faster XPath expressions for parsing the WSDL document.
|
4
|
+
* Added global and per request options for disabling Savon::WSDL.
|
5
|
+
|
1
6
|
== 0.6.2 (2009-12-06)
|
2
|
-
* 1 minor improvement
|
3
7
|
* Support for changing the name of the SOAP input node.
|
4
8
|
* Added a CHANGELOG.
|
5
9
|
|
6
10
|
== 0.6.1 (2009-12-06)
|
7
|
-
* 1 minor patch
|
8
11
|
* Fixed a problem with WSSE credentials, where every request contained a WSSE authentication header.
|
9
12
|
|
10
13
|
== 0.6.0 (2009-12-06)
|
11
|
-
* 3 major improvements
|
12
14
|
* method_missing now yields the SOAP and WSSE objects to a given block.
|
13
15
|
* The response_process (which previously was a block passed to method_missing) was replaced by the Savon::Response object.
|
14
16
|
* Improved SOAP action handling (another problem that came up with Issue #1).
|
15
17
|
|
16
18
|
== 0.5.3 (2009-11-30)
|
17
|
-
* 1 minor patch
|
18
19
|
* Fix for Issue #2 (NoMethodError: undefined method `invalid!' for Savon::WSDL)
|
19
20
|
|
20
21
|
== 0.5.2 (2009-11-30)
|
21
|
-
* 1 minor patch
|
22
22
|
* Patch for Issue #1 (Calls fail if api methods have periods in them)
|
23
23
|
|
24
24
|
== 0.5.1 (2009-11-29)
|
25
|
-
* 3 improvements
|
26
25
|
* Optimized default response process.
|
27
26
|
* Added WSSE settings via defaults.
|
28
27
|
* Added SOAP fault and HTTP error handling.
|
29
|
-
*
|
30
|
-
*
|
28
|
+
* Improved documentation
|
29
|
+
* Added specs
|
31
30
|
|
32
31
|
== 0.5.0 (2009-11-29)
|
33
|
-
* Complete rewrite.
|
32
|
+
* Complete rewrite.
|
data/README.textile
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
data/lib/savon.rb
CHANGED
File without changes
|
data/lib/savon/client.rb
CHANGED
@@ -6,14 +6,27 @@ module Savon
|
|
6
6
|
# with SOAP services and XML.
|
7
7
|
class Client
|
8
8
|
|
9
|
+
# Defines whether to use Savon::WSDL.
|
10
|
+
@wsdl = true
|
11
|
+
|
12
|
+
class << self
|
13
|
+
# Accessor for whether to use Savon::WSDL.
|
14
|
+
attr_accessor :wsdl
|
15
|
+
end
|
16
|
+
|
9
17
|
# Expects a SOAP +endpoint+ String.
|
10
18
|
def initialize(endpoint)
|
11
19
|
@request = Request.new endpoint
|
12
20
|
@wsdl = WSDL.new @request
|
13
21
|
end
|
14
22
|
|
15
|
-
#
|
16
|
-
|
23
|
+
# Accessor for Savon::WSDL.
|
24
|
+
attr_accessor :wsdl
|
25
|
+
|
26
|
+
# Returns whether to use Savon::WSDL.
|
27
|
+
def wsdl?
|
28
|
+
self.class.wsdl && @wsdl
|
29
|
+
end
|
17
30
|
|
18
31
|
# Returns +true+ for available methods and SOAP actions.
|
19
32
|
def respond_to?(method)
|
@@ -25,7 +38,7 @@ module Savon
|
|
25
38
|
|
26
39
|
# Dispatches requests to SOAP actions matching a given +method+ name.
|
27
40
|
def method_missing(method, *args, &block) #:doc:
|
28
|
-
super
|
41
|
+
super if wsdl? && !@wsdl.respond_to?(method)
|
29
42
|
|
30
43
|
setup method, &block
|
31
44
|
dispatch method
|
@@ -34,12 +47,12 @@ module Savon
|
|
34
47
|
# Expects a SOAP action and sets up Savon::SOAP and Savon::WSSE.
|
35
48
|
# Yields them to a given +block+ in case one was given.
|
36
49
|
def setup(soap_action, &block)
|
37
|
-
@soap = SOAP.new @wsdl.soap_actions[soap_action]
|
50
|
+
@soap = SOAP.new(wsdl? ? @wsdl.soap_actions[soap_action] : nil)
|
38
51
|
@wsse = WSSE.new
|
39
52
|
|
40
53
|
yield_parameters &block if block
|
41
54
|
|
42
|
-
@soap.namespaces["xmlns:wsdl"]
|
55
|
+
@soap.namespaces["xmlns:wsdl"] ||= @wsdl.namespace_uri if wsdl?
|
43
56
|
@soap.wsse = @wsse
|
44
57
|
end
|
45
58
|
|
data/lib/savon/core_ext.rb
CHANGED
File without changes
|
File without changes
|
data/lib/savon/core_ext/hash.rb
CHANGED
File without changes
|
File without changes
|
@@ -33,7 +33,7 @@ class String
|
|
33
33
|
|
34
34
|
# Translates SOAP response values to more convenient Ruby Objects.
|
35
35
|
def map_soap_response
|
36
|
-
return DateTime.parse self if Savon::SOAPDateTimeRegexp === self
|
36
|
+
return DateTime.parse( self ) if Savon::SOAPDateTimeRegexp === self
|
37
37
|
return true if self.strip.downcase == "true"
|
38
38
|
return false if self.strip.downcase == "false"
|
39
39
|
self
|
File without changes
|
data/lib/savon/core_ext/uri.rb
CHANGED
File without changes
|
data/lib/savon/request.rb
CHANGED
@@ -67,7 +67,7 @@ module Savon
|
|
67
67
|
# Logs the SOAP request.
|
68
68
|
def log_request
|
69
69
|
log "SOAP request: #{@endpoint}"
|
70
|
-
log http_header.map { |key, value| "#{key}: #{value}" }.join ", "
|
70
|
+
log http_header.map { |key, value| "#{key}: #{value}" }.join( ", " )
|
71
71
|
log @soap.to_xml
|
72
72
|
end
|
73
73
|
|
data/lib/savon/response.rb
CHANGED
@@ -100,7 +100,7 @@ module Savon
|
|
100
100
|
def handle_http_error
|
101
101
|
if @response.code.to_i >= 300
|
102
102
|
@http_error = "#{@response.message} (#{@response.code})"
|
103
|
-
@http_error
|
103
|
+
@http_error << ": #{@response.body}" unless @response.body.empty?
|
104
104
|
raise Savon::HTTPError, http_error if self.class.raise_errors?
|
105
105
|
end
|
106
106
|
end
|
data/lib/savon/soap.rb
CHANGED
@@ -29,10 +29,10 @@ module Savon
|
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
-
# Expects
|
33
|
-
def initialize(
|
34
|
-
@action =
|
35
|
-
@input =
|
32
|
+
# Expects a Hash containing the name of the SOAP action and input.
|
33
|
+
def initialize(action = nil)
|
34
|
+
@action = action.kind_of?(Hash) ? action[:name] : ""
|
35
|
+
@input = action.kind_of?(Hash) ? action[:input] : ""
|
36
36
|
end
|
37
37
|
|
38
38
|
# Sets the WSSE options.
|
@@ -87,7 +87,7 @@ module Savon
|
|
87
87
|
xml << (header.to_soap_xml rescue header.to_s) + wsse_header
|
88
88
|
end
|
89
89
|
xml.env(:Body) do
|
90
|
-
xml.wsdl
|
90
|
+
xml.tag!(:wsdl, *input_array) do
|
91
91
|
xml << (@body.to_soap_xml rescue @body.to_s)
|
92
92
|
end
|
93
93
|
end
|
@@ -98,6 +98,15 @@ module Savon
|
|
98
98
|
|
99
99
|
private
|
100
100
|
|
101
|
+
# Returns an Array of SOAP input names to append to the :wsdl namespace.
|
102
|
+
# Defaults to use the name of the SOAP action and may be an empty Array
|
103
|
+
# in case the specified SOAP input seems invalid.
|
104
|
+
def input_array
|
105
|
+
return [@input.to_sym] if @input && !@input.empty?
|
106
|
+
return [@action.to_sym] if @action && !@action.empty?
|
107
|
+
[]
|
108
|
+
end
|
109
|
+
|
101
110
|
# Returns the WSSE header or an empty String in case WSSE was not set.
|
102
111
|
def wsse_header
|
103
112
|
return "" unless @wsse.respond_to? :header
|
data/lib/savon/wsdl.rb
CHANGED
@@ -12,7 +12,7 @@ module Savon
|
|
12
12
|
|
13
13
|
# Returns the namespace URI from the WSDL.
|
14
14
|
def namespace_uri
|
15
|
-
@namespace_uri ||=
|
15
|
+
@namespace_uri ||= document.root.attributes["targetNamespace"] || ""
|
16
16
|
end
|
17
17
|
|
18
18
|
# Returns a Hash of available SOAP actions mapped to snake_case (keys)
|
@@ -51,19 +51,13 @@ module Savon
|
|
51
51
|
@document ||= REXML::Document.new wsdl_response.body
|
52
52
|
end
|
53
53
|
|
54
|
-
# Parses the WSDL for the namespace URI.
|
55
|
-
def parse_namespace_uri
|
56
|
-
definitions = document.elements["//wsdl:definitions"]
|
57
|
-
definitions.attributes["targetNamespace"] if definitions
|
58
|
-
end
|
59
|
-
|
60
54
|
# Parses the WSDL for available SOAP actions and inputs. Returns a Hash
|
61
55
|
# containing the SOAP action inputs and corresponding SOAP actions.
|
62
56
|
def parse_soap_operations
|
63
|
-
wsdl_binding = document.elements["
|
57
|
+
wsdl_binding = document.elements["wsdl:definitions/wsdl:binding"]
|
64
58
|
return {} unless wsdl_binding
|
65
59
|
|
66
|
-
wsdl_binding.elements.inject("
|
60
|
+
wsdl_binding.elements.inject("wsdl:operation", {}) do |hash, operation|
|
67
61
|
action = operation.elements["*:operation"].attributes["soapAction"] || ""
|
68
62
|
action = operation.attributes["name"] if action.empty?
|
69
63
|
|
data/lib/savon/wsse.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/fixtures/user_wsdl.xml
CHANGED
File without changes
|
data/spec/http_stubs.rb
CHANGED
File without changes
|
data/spec/savon/client_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/savon/request_spec.rb
CHANGED
File without changes
|
data/spec/savon/response_spec.rb
CHANGED
File without changes
|
data/spec/savon/savon_spec.rb
CHANGED
File without changes
|
data/spec/savon/soap_spec.rb
CHANGED
File without changes
|
data/spec/savon/wsdl_spec.rb
CHANGED
File without changes
|
data/spec/savon/wsse_spec.rb
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
data/spec/spec_helper_methods.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-11 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -143,20 +143,20 @@ signing_key:
|
|
143
143
|
specification_version: 3
|
144
144
|
summary: Heavy metal Ruby SOAP client library
|
145
145
|
test_files:
|
146
|
-
- spec/
|
147
|
-
- spec/
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
- spec/savon/response_spec.rb
|
148
|
+
- spec/savon/savon_spec.rb
|
149
|
+
- spec/savon/wsdl_spec.rb
|
150
|
+
- spec/savon/request_spec.rb
|
148
151
|
- spec/savon/client_spec.rb
|
149
|
-
- spec/savon/
|
152
|
+
- spec/savon/soap_spec.rb
|
153
|
+
- spec/savon/core_ext/symbol_spec.rb
|
150
154
|
- spec/savon/core_ext/hash_spec.rb
|
151
|
-
- spec/savon/core_ext/object_spec.rb
|
152
155
|
- spec/savon/core_ext/string_spec.rb
|
153
|
-
- spec/savon/core_ext/
|
156
|
+
- spec/savon/core_ext/datetime_spec.rb
|
157
|
+
- spec/savon/core_ext/object_spec.rb
|
154
158
|
- spec/savon/core_ext/uri_spec.rb
|
155
|
-
- spec/savon/request_spec.rb
|
156
|
-
- spec/savon/response_spec.rb
|
157
|
-
- spec/savon/savon_spec.rb
|
158
|
-
- spec/savon/soap_spec.rb
|
159
|
-
- spec/savon/wsdl_spec.rb
|
160
159
|
- spec/savon/wsse_spec.rb
|
161
|
-
- spec/spec_helper.rb
|
162
160
|
- spec/spec_helper_methods.rb
|
161
|
+
- spec/http_stubs.rb
|
162
|
+
- spec/fixtures/user_fixture.rb
|