savon 0.6.0 → 0.6.4

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/CHANGELOG ADDED
@@ -0,0 +1,56 @@
1
+ == 0.6.4 (2009-12-13)
2
+ * Refactored specs to be less unit-like.
3
+ * Added a getter for the Savon::Request to Savon::Client and a read_timeout setter for HTTP requests.
4
+ * Replaced WSDL document with stream parsing.
5
+
6
+ Benchmarks (1000 SOAP calls):
7
+
8
+ user system total real
9
+ 0.6.4 72.180000 8.280000 80.460000 (750.799011)
10
+ 0.6.3 192.900000 19.630000 212.530000 (914.031865)
11
+
12
+ == 0.6.3 (2009-12-11)
13
+ * Removing 2 ruby deprecation warnings for parenthesized arguments. (Dave Woodward <dave@futuremint.com>)
14
+ * Added global and per request options for disabling Savon::WSDL.
15
+
16
+ Benchmarks (1000 SOAP calls):
17
+
18
+ user system total real
19
+ WSDL 192.900000 19.630000 212.530000 (914.031865)
20
+ disabled WSDL 5.680000 1.340000 7.020000 (298.265318)
21
+
22
+ * Improved XPath expressions for parsing the WSDL document.
23
+
24
+ Benchmarks (1000 SOAP calls):
25
+
26
+ user system total real
27
+ 0.6.3 192.900000 19.630000 212.530000 (914.031865)
28
+ 0.6.2 574.720000 78.380000 653.100000 (1387.778539)
29
+
30
+ == 0.6.2 (2009-12-06)
31
+ * Added support for changing the name of the SOAP input node.
32
+ * Added a CHANGELOG.
33
+
34
+ == 0.6.1 (2009-12-06)
35
+ * Fixed a problem with WSSE credentials, where every request contained a WSSE authentication header.
36
+
37
+ == 0.6.0 (2009-12-06)
38
+ * method_missing now yields the SOAP and WSSE objects to a given block.
39
+ * The response_process (which previously was a block passed to method_missing) was replaced by Savon::Response.
40
+ * Improved SOAP action handling (another problem that came up with issue #1).
41
+
42
+ == 0.5.3 (2009-11-30)
43
+ * Patch for issue #2 (NoMethodError: undefined method `invalid!' for Savon::WSDL)
44
+
45
+ == 0.5.2 (2009-11-30)
46
+ * Patch for issue #1 (Calls fail if api methods have periods in them)
47
+
48
+ == 0.5.1 (2009-11-29)
49
+ * Optimized default response process.
50
+ * Added WSSE settings via defaults.
51
+ * Added SOAP fault and HTTP error handling.
52
+ * Improved documentation
53
+ * Added specs
54
+
55
+ == 0.5.0 (2009-11-29)
56
+ * Complete rewrite.
data/README.textile CHANGED
@@ -1,68 +1,70 @@
1
- h2. Savon
1
+ h1. Savon
2
2
 
3
- p. Savon can be installed as a gem via:
3
+ h4. Heavy metal Ruby SOAP client library
4
4
 
5
5
  bc. $ gem install savon
6
6
 
7
- h4. Dependencies
7
+ p. Savon expects you to be familiar with SOAP, WSDL and tools like soapUI.
8
8
 
9
- bc. builder >= 2.1.2
10
- crack >= 0.1.4
9
+ h3. Instantiate a client
11
10
 
12
- h2. Warning
11
+ p. Instantiate Savon::Client, passing in the WSDL of your service.
13
12
 
14
- p. To use this heavy metal library, you should be familiar with SOAP, WSDL and tools like soapUI.
13
+ bc. client = Savon::Client.new "http://example.com/UserService?wsdl"
15
14
 
16
- h2. Instantiate Savon::Client
15
+ h3. Calling a SOAP action
17
16
 
18
- p. Instantiate a new instance of Savon::Client, passing in the WSDL of your service.
17
+ p. Assuming your service applies to the "Defaults":http://wiki.github.com/rubiii/savon/defaults, you can now call any available SOAP action.
19
18
 
20
- bc. proxy = Savon::Client.new "http://example.com/UserService?wsdl"
19
+ bc. response = client.get_all_users
21
20
 
22
- h2. The WSDL
23
-
24
- p. You can find out about the SOAP actions available on the webservice by using the WSDL object.
25
-
26
- bc. proxy.wsdl.soap_actions
27
- => [:get_all_users, :get_user_by_id, :user_magic]
21
+ p. Savon lets you call SOAP actions using snake_case, because even though they will propably be written in lowerCamelCase or CamelCase, it just feels much more natural.
28
22
 
29
- p. Find out more about the "WSDL":http://wiki.github.com/rubiii/savon/wsdl object.
23
+ h3. The WSDL object
30
24
 
31
- h2. Calling a SOAP action
25
+ p. Savon::WSDL represents the WSDL of your service, including information like the namespace URI and available SOAP actions.
32
26
 
33
- p. Now, assuming your service applies to the default "Options":http://wiki.github.com/rubiii/savon/options, you can just call any available SOAP action.
27
+ bc. client.wsdl.soap_actions.keys
28
+ => [:get_all_users, :get_user_by_id, :user_magic]
34
29
 
35
- bc. response = proxy.get_all_users
30
+ p. More information: "WSDL":http://wiki.github.com/rubiii/savon/wsdl
36
31
 
37
- p. Savon lets you call SOAP actions using snake_case, because even though they will propably be written in lowerCamelCase or CamelCase, it just feels much more natural.
32
+ h3. The SOAP object
38
33
 
39
- h2. Parameters
34
+ p. Savon::SOAP represents the SOAP request. Pass a block to your SOAP call and the SOAP object is passed to it as the first argument. The object allows setting the SOAP version, header, body and namespaces per request.
40
35
 
41
- p. Specifying parameters for the SOAP service, can be done by simply passing a Hash to the SOAP action.
36
+ bc. response = client.get_user_by_id { |soap| soap.body = { :id => 666 } }
42
37
 
43
- bc. response = proxy.get_user_by_id :id => 666
38
+ p. More information: "SOAP":http://wiki.github.com/rubiii/savon/soap
44
39
 
45
- p. Learn more about [[Parameters]].
40
+ h3. The WSSE object
46
41
 
47
- h2. The response
42
+ p. Savon::WSSE represents WSSE authentication. Pass a block to your SOAP call and the WSSE object is passed to it as the second argument. The object allows setting the WSSE username, password and whether to use digest authentication.
48
43
 
49
- p. By default, the SOAP response is translated into a Hash. Take a look at the "Options":http://wiki.github.com/rubiii/savon/options for more information.
44
+ bc. response = client.get_user_by_id do |soap, wsse|
45
+ wsse.username = "gorilla"
46
+ wsse.password = "secret"
47
+ soap.body = { :id => 666 }
48
+ end
50
49
 
51
- bc. proxy.get_user_by_id :id => 666
52
- => { :user_response => { :id => "666", :username => "gorilla" } }
50
+ p. More information: "WSSE":http://wiki.github.com/rubiii/savon/wsse
53
51
 
54
- h2. HTTP errors and SOAP faults
52
+ h3. The Response object
55
53
 
56
- p. Savon raises a Savon::SOAPFault in case of a SOAP fault and a Savon::HTTPError in case of an HTTP error. More information about "Errors":http://wiki.github.com/rubiii/savon/errors.
54
+ p. Savon::Response represents the HTTP and SOAP response. It contains and raises errors in case of an HTTP error or SOAP fault (unless disabled). Also you can get the response as XML (for parsing it with an XML library) or translated into a Hash.
55
+ More information: "Response":http://wiki.github.com/rubiii/savon/response
57
56
 
58
- h2. Logging
57
+ h3. HTTP errors and SOAP faults
59
58
 
60
- p. By default Savon logs each request and response to STDOUT. Specifying your own logger is as easy as it gets:
59
+ p. Savon raises a Savon::SOAPFault in case of a SOAP fault and a Savon::HTTPError in case of an HTTP error.
60
+ More information: "Errors":http://wiki.github.com/rubiii/savon/errors
61
61
 
62
- bc. Savon::Request.logger = RAILS_DEFAULT_LOGGER
62
+ h3. Logging
63
63
 
64
- Read more about "Logging":http://wiki.github.com/rubiii/savon/logging.
64
+ p. Savon logs each request and response to STDOUT. But there are a couple of options to change the default behaviour.
65
+ More information: "Logging":http://wiki.github.com/rubiii/savon/logging
65
66
 
66
- h2. RDoc and Wiki
67
+ h3. Documentation
67
68
 
68
- p. Further information: "Wiki":http://wiki.github.com/rubiii/savon and "RDoc":http://rdoc.info/projects/rubiii/savon
69
+ p. Wiki: "wiki.github.com/rubiii/savon":http://wiki.github.com/rubiii/savon
70
+ RDoc: "rdoc.info/projects/rubiii/savon":http://rdoc.info/projects/rubiii/savon
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ task :default => :spec
8
8
  Spec::Rake::SpecTask.new do |spec|
9
9
  spec.spec_files = FileList["spec/**/*_spec.rb"]
10
10
  spec.spec_opts << "--color"
11
- spec.libs << "lib"
11
+ spec.libs += ["lib", "spec"]
12
12
  spec.rcov = true
13
13
  spec.rcov_dir = "rcov"
14
14
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.4
data/lib/savon/client.rb CHANGED
@@ -6,14 +6,30 @@ 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
- # Returns the Savon::WSDL.
16
- attr_reader :wsdl
23
+ # Accessor for Savon::WSDL.
24
+ attr_accessor :wsdl
25
+
26
+ # Returns the Savon::Request.
27
+ attr_reader :request
28
+
29
+ # Returns whether to use Savon::WSDL.
30
+ def wsdl?
31
+ self.class.wsdl && @wsdl
32
+ end
17
33
 
18
34
  # Returns +true+ for available methods and SOAP actions.
19
35
  def respond_to?(method)
@@ -25,7 +41,7 @@ module Savon
25
41
 
26
42
  # Dispatches requests to SOAP actions matching a given +method+ name.
27
43
  def method_missing(method, *args, &block) #:doc:
28
- super unless @wsdl.respond_to? method
44
+ super if wsdl? && !@wsdl.respond_to?(method)
29
45
 
30
46
  setup method, &block
31
47
  dispatch method
@@ -34,12 +50,14 @@ module Savon
34
50
  # Expects a SOAP action and sets up Savon::SOAP and Savon::WSSE.
35
51
  # Yields them to a given +block+ in case one was given.
36
52
  def setup(soap_action, &block)
37
- @soap = SOAP.new @wsdl.soap_actions[soap_action]
53
+ @soap = SOAP.new
54
+ @soap.action = @wsdl.operations[soap_action][:action] if wsdl?
55
+ @soap.input = @wsdl.operations[soap_action][:input] if wsdl?
38
56
  @wsse = WSSE.new
39
57
 
40
58
  yield_parameters &block if block
41
59
 
42
- @soap.namespaces["xmlns:wsdl"] = @wsdl.namespace_uri
60
+ @soap.namespaces["xmlns:wsdl"] ||= @wsdl.namespace_uri if wsdl?
43
61
  @soap.wsse = @wsse
44
62
  end
45
63
 
@@ -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
data/lib/savon/request.rb CHANGED
@@ -45,6 +45,11 @@ module Savon
45
45
  # Returns the endpoint URI.
46
46
  attr_reader :endpoint
47
47
 
48
+ # Sets the read timeout for HTTP requests.
49
+ def read_timeout=(sec)
50
+ http.read_timeout = sec
51
+ end
52
+
48
53
  # Retrieves WSDL document and returns the Net::HTTPResponse.
49
54
  def wsdl
50
55
  log "Retrieving WSDL from: #{@endpoint}"
@@ -67,7 +72,7 @@ module Savon
67
72
  # Logs the SOAP request.
68
73
  def log_request
69
74
  log "SOAP request: #{@endpoint}"
70
- log http_header.map { |key, value| "#{key}: #{value}" }.join ", "
75
+ log http_header.map { |key, value| "#{key}: #{value}" }.join( ", " )
71
76
  log @soap.to_xml
72
77
  end
73
78
 
@@ -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 += ": #{@response.body}" unless @response.body.empty?
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,17 +29,22 @@ module Savon
29
29
 
30
30
  end
31
31
 
32
- # Expects an +action_map+ containing the name of the SOAP action and input.
33
- def initialize(action_map)
34
- @action = action_map[:name]
35
- @input = action_map[:input]
36
- end
37
-
38
32
  # Sets the WSSE options.
39
33
  attr_writer :wsse
40
34
 
41
35
  # Accessor for the SOAP action.
42
- attr_accessor :action
36
+ attr_writer :action
37
+
38
+ def action
39
+ @action ||= ""
40
+ end
41
+
42
+ # Accessor for the SOAP input.
43
+ attr_writer :input
44
+
45
+ def input
46
+ @input ||= ""
47
+ end
43
48
 
44
49
  # Sets the SOAP header. Expected to be a Hash that can be translated
45
50
  # to XML via Hash.to_soap_xml or any other Object responding to to_s.
@@ -84,7 +89,7 @@ module Savon
84
89
  xml << (header.to_soap_xml rescue header.to_s) + wsse_header
85
90
  end
86
91
  xml.env(:Body) do
87
- xml.wsdl(@input.to_sym) do
92
+ xml.tag!(:wsdl, *input_array) do
88
93
  xml << (@body.to_soap_xml rescue @body.to_s)
89
94
  end
90
95
  end
@@ -95,6 +100,15 @@ module Savon
95
100
 
96
101
  private
97
102
 
103
+ # Returns an Array of SOAP input names to append to the :wsdl namespace.
104
+ # Defaults to use the name of the SOAP action and may be an empty Array
105
+ # in case the specified SOAP input seems invalid.
106
+ def input_array
107
+ return [input.to_sym] if input && !input.empty?
108
+ return [action.to_sym] if action && !action.empty?
109
+ []
110
+ end
111
+
98
112
  # Returns the WSSE header or an empty String in case WSSE was not set.
99
113
  def wsse_header
100
114
  return "" unless @wsse.respond_to? :header
data/lib/savon/wsdl.rb CHANGED
@@ -2,74 +2,104 @@ module Savon
2
2
 
3
3
  # Savon::WSDL
4
4
  #
5
- # Represents a WSDL document.
5
+ # Represents the WSDL document.
6
6
  class WSDL
7
7
 
8
- # Expects a Savon::Request object.
8
+ # Initializer, expects a Savon::Request.
9
9
  def initialize(request)
10
10
  @request = request
11
11
  end
12
12
 
13
- # Returns the namespace URI from the WSDL.
13
+ # Returns the namespace URI of the WSDL.
14
14
  def namespace_uri
15
- @namespace_uri ||= parse_namespace_uri
15
+ @namespace_uri ||= stream.namespace_uri
16
16
  end
17
17
 
18
- # Returns a Hash of available SOAP actions mapped to snake_case (keys)
19
- # and their original names and inputs in another Hash (values).
18
+ # Returns an Array of available SOAP actions.
20
19
  def soap_actions
21
- @soap_actions ||= parse_soap_operations.inject({}) do |hash, (input, action)|
22
- hash.merge input.snakecase.to_sym => { :name => action, :input => input }
23
- end
20
+ @soap_actions ||= stream.operations.keys
21
+ end
22
+
23
+ # Returns a Hash of SOAP operations including their corresponding
24
+ # SOAP actions and inputs.
25
+ def operations
26
+ @operations ||= stream.operations
24
27
  end
25
28
 
26
29
  # Returns +true+ for available methods and SOAP actions.
27
30
  def respond_to?(method)
28
- return true if soap_actions.keys.include? method
31
+ return true if soap_actions.include? method
29
32
  super
30
33
  end
31
34
 
32
- # Returns the WSDL document.
35
+ # Returns the raw WSDL document.
33
36
  def to_s
34
- wsdl_response.body
37
+ @document ||= @request.wsdl.body
35
38
  end
36
39
 
37
40
  private
38
41
 
39
- # Retrieves and returns the WSDL response. Raises an ArgumentError in
40
- # case the WSDL seems to be invalid.
41
- def wsdl_response
42
- unless @wsdl_response
43
- @wsdl_response ||= @request.wsdl
44
- raise ArgumentError, "Invalid WSDL: #{@request.endpoint}" if soap_actions.empty?
42
+ # Returns the Savon::WSDLStream.
43
+ def stream
44
+ unless @stream
45
+ @stream = WSDLStream.new
46
+ REXML::Document.parse_stream to_s, @stream
45
47
  end
46
- @wsdl_response
48
+ @stream
47
49
  end
48
50
 
49
- # Returns a REXML::Document of the WSDL.
50
- def document
51
- @document ||= REXML::Document.new wsdl_response.body
52
- end
51
+ end
52
+
53
+ # Savon::WSDLStream
54
+ #
55
+ # Stream listener for parsing the WSDL document.
56
+ class WSDLStream
53
57
 
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
+ # Initializer, sets an empty Hash of operations.
59
+ def initialize
60
+ @operations = {}
58
61
  end
59
62
 
60
- # Parses the WSDL for available SOAP actions and inputs. Returns a Hash
61
- # containing the SOAP action inputs and corresponding SOAP actions.
62
- def parse_soap_operations
63
- wsdl_binding = document.elements["//wsdl:binding"]
64
- return {} unless wsdl_binding
63
+ # Returns the namespace URI from the WSDL document.
64
+ attr_reader :namespace_uri
65
65
 
66
- wsdl_binding.elements.inject("//wsdl:operation", {}) do |hash, operation|
67
- action = operation.elements["*:operation"].attributes["soapAction"] || ""
68
- action = operation.attributes["name"] if action.empty?
66
+ # Returns the SOAP operations found in the WSDL document.
67
+ attr_reader :operations
68
+
69
+ # Hook method called when the stream parser encounters a tag.
70
+ def tag_start(name, attrs)
71
+ section_from name
72
+ @namespace_uri ||= attrs["targetNamespace"] if @section == :definitions
73
+ operation_from name, attrs if @section == :binding && /.+:operation/ === name
74
+ end
75
+
76
+ # Sets the current section of the WSDL document from a given tag +name+.
77
+ def section_from(name)
78
+ section = case name
79
+ when "wsdl:definitions" then :definitions
80
+ when "wsdl:types" then :types
81
+ when "wsdl:message" then :message
82
+ when "wsdl:portType" then :port_type
83
+ when "wsdl:binding" then :binding
84
+ when "wsdl:service" then :service
85
+ end
86
+ @section = section if section
87
+ end
69
88
 
70
- hash.merge action.split("/").last => action
89
+ # Stores available operations from a given tag +name+ and +attrs+.
90
+ def operation_from(name, attrs)
91
+ if name == "wsdl:operation"
92
+ @action = attrs["name"]
93
+ elsif /.+:operation/ === name
94
+ @action = attrs["soapAction"] if attrs["soapAction"] && !attrs["soapAction"].empty?
95
+ input = @action.split("/").last
96
+ @operations[input.snakecase.to_sym] = { :action => @action, :input => input }
71
97
  end
72
98
  end
73
99
 
100
+ # Catches calls to unimplemented hook methods.
101
+ def method_missing(method, *args)
102
+ end
103
+
74
104
  end
75
105
  end
data/lib/savon/wsse.rb CHANGED
@@ -12,10 +12,10 @@ module Savon
12
12
  WSUNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
13
13
 
14
14
  # Default WSSE username.
15
- @username = ""
15
+ @username = nil
16
16
 
17
17
  # Default WSSE password.
18
- @password = ""
18
+ @password = nil
19
19
 
20
20
  # Default for whether to use WSSE digest.
21
21
  @digest = false
@@ -28,6 +28,7 @@ module Savon
28
28
  # Sets the default WSSE username.
29
29
  def username=(username)
30
30
  @username = username.to_s if username.respond_to? :to_s
31
+ @username = nil if username.nil?
31
32
  end
32
33
 
33
34
  # Returns the default WSSE password.
@@ -36,6 +37,7 @@ module Savon
36
37
  # Sets the default WSSE password.
37
38
  def password=(password)
38
39
  @password = password.to_s if password.respond_to? :to_s
40
+ @password = nil if password.nil?
39
41
  end
40
42
 
41
43
  # Sets whether to use WSSE digest by default.
@@ -51,6 +53,7 @@ module Savon
51
53
  # Sets the WSSE username.
52
54
  def username=(username)
53
55
  @username = username.to_s if username.respond_to? :to_s
56
+ @username = nil if username.nil?
54
57
  end
55
58
 
56
59
  # Returns the WSSE username. Defaults to the global default.
@@ -61,6 +64,7 @@ module Savon
61
64
  # Sets the WSSE password.
62
65
  def password=(password)
63
66
  @password = password.to_s if password.respond_to? :to_s
67
+ @password = nil if password.nil?
64
68
  end
65
69
 
66
70
  # Returns the WSSE password. Defaults to the global default.
@@ -1,9 +1,9 @@
1
1
  class UserFixture
2
2
 
3
3
  @namespace_uri = "http://v1_0.ws.user.example.com"
4
- @soap_actions = {
5
- :user_find_by_id => { :name => "User.FindById", :input => "User.FindById" },
6
- :find_user => { :name => "findUser", :input => "findUser" }
4
+ @operations = {
5
+ :user_find_by_id => { :action => "User.FindById", :input => "User.FindById" },
6
+ :find_user => { :action => "findUser", :input => "findUser" }
7
7
  }
8
8
 
9
9
  @datetime_string = "2010-11-22T11:22:33"
@@ -24,9 +24,13 @@ class UserFixture
24
24
 
25
25
  class << self
26
26
 
27
- attr_accessor :namespace_uri, :soap_actions,
27
+ attr_accessor :namespace_uri, :operations,
28
28
  :datetime_string, :datetime_object, :response_hash
29
29
 
30
+ def soap_actions
31
+ @operations.keys
32
+ end
33
+
30
34
  def user_wsdl
31
35
  load_fixture :user_wsdl
32
36
  end
data/spec/http_stubs.rb CHANGED
@@ -2,24 +2,22 @@ require "fakeweb"
2
2
 
3
3
  FakeWeb.allow_net_connect = false
4
4
 
5
- # Register fake WSDL and SOAP request.
6
- FakeWeb.register_uri :get, SpecHelper.some_endpoint, :body => UserFixture.user_wsdl
7
- FakeWeb.register_uri :post, SpecHelper.soap_call_endpoint, :body => UserFixture.user_response
5
+ # Some WSDL and SOAP request.
6
+ FakeWeb.register_uri :get, EndpointHelper.wsdl_endpoint, :body => UserFixture.user_wsdl
7
+ FakeWeb.register_uri :post, EndpointHelper.soap_endpoint, :body => UserFixture.user_response
8
8
 
9
- # Register fake WSDL and SOAP request with multiple "//return" nodes.
10
- FakeWeb.register_uri :get, SpecHelper.multiple_endpoint, :body => UserFixture.user_wsdl
11
- FakeWeb.register_uri :post, SpecHelper.soap_multiple_endpoint, :body => UserFixture.multiple_user_response
9
+ # WSDL and SOAP request with multiple "//return" nodes.
10
+ FakeWeb.register_uri :get, EndpointHelper.wsdl_endpoint(:multiple), :body => UserFixture.user_wsdl
11
+ FakeWeb.register_uri :post, EndpointHelper.soap_endpoint(:multiple), :body => UserFixture.multiple_user_response
12
12
 
13
- # Register fake WSDL and SOAP request for a Savon::SOAPFault.
14
- FakeWeb.register_uri :get, SpecHelper.soapfault_endpoint, :body => UserFixture.user_wsdl
15
- FakeWeb.register_uri :post, SpecHelper.soap_soapfault_endpoint, :body => UserFixture.soap_fault
13
+ # WSDL and SOAP request with a Savon::SOAPFault.
14
+ FakeWeb.register_uri :get, EndpointHelper.wsdl_endpoint(:soap_fault), :body => UserFixture.user_wsdl
15
+ FakeWeb.register_uri :post, EndpointHelper.soap_endpoint(:soap_fault), :body => UserFixture.soap_fault
16
16
 
17
- # Register fake WSDL and SOAP request for a Savon::HTTPError.
18
- FakeWeb.register_uri :get, SpecHelper.httperror_endpoint, :body => UserFixture.user_wsdl
19
- FakeWeb.register_uri :post, SpecHelper.soap_httperror_endpoint, :body => "",
20
- :status => ["404", "Not Found"]
17
+ # WSDL and SOAP request with a Savon::HTTPError.
18
+ FakeWeb.register_uri :get, EndpointHelper.wsdl_endpoint(:http_error), :body => UserFixture.user_wsdl
19
+ FakeWeb.register_uri :post, EndpointHelper.soap_endpoint(:http_error), :body => "", :status => ["404", "Not Found"]
21
20
 
22
- # Register fake WSDL and SOAP request for an invalid endpoint.
23
- FakeWeb.register_uri :get, SpecHelper.invalid_endpoint, :body => ""
24
- FakeWeb.register_uri :post, SpecHelper.soap_invalid_endpoint, :body => "",
25
- :status => ["404", "Not Found"]
21
+ # WSDL and SOAP request with an invalid endpoint.
22
+ FakeWeb.register_uri :get, EndpointHelper.wsdl_endpoint(:invalid), :body => ""
23
+ FakeWeb.register_uri :post, EndpointHelper.soap_endpoint(:invalid), :body => "", :status => ["404", "Not Found"]