savon 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/README.rdoc +5 -3
- data/Rakefile +2 -0
- data/lib/savon.rb +1 -0
- data/lib/savon/client.rb +54 -13
- data/lib/savon/core_ext.rb +0 -0
- data/lib/savon/core_ext/array.rb +20 -6
- data/lib/savon/core_ext/datetime.rb +0 -0
- data/lib/savon/core_ext/hash.rb +36 -15
- data/lib/savon/core_ext/net_http.rb +1 -2
- data/lib/savon/core_ext/object.rb +1 -3
- data/lib/savon/core_ext/string.rb +9 -2
- data/lib/savon/core_ext/symbol.rb +0 -0
- data/lib/savon/core_ext/uri.rb +1 -1
- data/lib/savon/logger.rb +56 -0
- data/lib/savon/request.rb +42 -50
- data/lib/savon/response.rb +62 -9
- data/lib/savon/soap.rb +157 -42
- data/lib/savon/wsdl.rb +71 -6
- data/lib/savon/wsdl_stream.rb +2 -2
- data/lib/savon/wsse.rb +36 -5
- data/spec/basic_spec_helper.rb +0 -0
- data/spec/endpoint_helper.rb +0 -0
- data/spec/fixtures/response/response_fixture.rb +0 -0
- data/spec/fixtures/response/xml/authentication.xml +0 -0
- data/spec/fixtures/response/xml/multi_ref.xml +0 -0
- data/spec/fixtures/response/xml/soap_fault.xml +0 -0
- data/spec/fixtures/response/xml/soap_fault12.xml +0 -0
- data/spec/fixtures/wsdl/wsdl_fixture.rb +0 -0
- data/spec/fixtures/wsdl/xml/authentication.xml +0 -0
- data/spec/fixtures/wsdl/xml/geotrust.xml +0 -0
- data/spec/fixtures/wsdl/xml/namespaced_actions.xml +0 -0
- data/spec/fixtures/wsdl/xml/no_namespace.xml +0 -0
- data/spec/http_stubs.rb +0 -0
- data/spec/integration/http_basic_auth_spec.rb +0 -0
- data/spec/integration/server.rb +0 -0
- data/spec/savon/client_spec.rb +5 -1
- data/spec/savon/core_ext/array_spec.rb +0 -0
- data/spec/savon/core_ext/datetime_spec.rb +0 -0
- data/spec/savon/core_ext/hash_spec.rb +10 -1
- data/spec/savon/core_ext/net_http_spec.rb +0 -0
- data/spec/savon/core_ext/object_spec.rb +0 -0
- data/spec/savon/core_ext/string_spec.rb +6 -2
- data/spec/savon/core_ext/symbol_spec.rb +0 -0
- data/spec/savon/core_ext/uri_spec.rb +4 -0
- data/spec/savon/request_spec.rb +5 -4
- data/spec/savon/response_spec.rb +0 -0
- data/spec/savon/soap_spec.rb +124 -130
- data/spec/savon/wsdl_spec.rb +0 -0
- data/spec/savon/wsse_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- metadata +55 -37
- data/readme/client.rdoc +0 -18
- data/readme/errors.rdoc +0 -11
- data/readme/logging.rdoc +0 -11
- data/readme/participate.rdoc +0 -21
- data/readme/request.rdoc +0 -37
- data/readme/response.rdoc +0 -46
- data/readme/soap.rdoc +0 -71
- data/readme/value_mapping.rdoc +0 -49
- data/readme/wsdl.rdoc +0 -39
- data/readme/wsse.rdoc +0 -28
data/lib/savon/wsdl_stream.rb
CHANGED
data/lib/savon/wsse.rb
CHANGED
@@ -1,8 +1,39 @@
|
|
1
1
|
module Savon
|
2
2
|
|
3
|
-
# Savon::WSSE
|
3
|
+
# = Savon::WSSE
|
4
4
|
#
|
5
|
-
#
|
5
|
+
# Savon::WSSE represents WSSE authentication. Pass a block to your SOAP call and the WSSE object
|
6
|
+
# is passed to it as the second argument. The object allows setting the WSSE username, password
|
7
|
+
# and whether to use digest authentication.
|
8
|
+
#
|
9
|
+
# == Credentials
|
10
|
+
#
|
11
|
+
# By default, Savon does not use WSSE authentication. Simply specify a username and password to
|
12
|
+
# change this.
|
13
|
+
#
|
14
|
+
# response = client.get_all_users do |soap, wsse|
|
15
|
+
# wsse.username = "eve"
|
16
|
+
# wsse.password = "secret"
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# == Digest
|
20
|
+
#
|
21
|
+
# To use WSSE digest authentication, just use the digest method and set it to +true+.
|
22
|
+
#
|
23
|
+
# response = client.get_all_users do |soap, wsse|
|
24
|
+
# wsse.username = "eve"
|
25
|
+
# wsse.password = "secret"
|
26
|
+
# wsse.digest = true
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# == Default to WSSE
|
30
|
+
#
|
31
|
+
# In case all you're services require WSSE authentication, you can set your credentials and whether
|
32
|
+
# to use WSSE digest for every request:
|
33
|
+
#
|
34
|
+
# Savon::WSSE.username = "eve"
|
35
|
+
# Savon::WSSE.password = "secret"
|
36
|
+
# Savon::WSSE.digest = true
|
6
37
|
class WSSE
|
7
38
|
|
8
39
|
# Base address for WSSE docs.
|
@@ -82,13 +113,13 @@ module Savon
|
|
82
113
|
# Sets whether to use WSSE digest per request.
|
83
114
|
attr_writer :digest
|
84
115
|
|
85
|
-
# Returns whether to use WSSE digest. Defaults to the global setting.
|
116
|
+
# Returns whether to use WSSE digest. Defaults to the global setting.
|
86
117
|
def digest?
|
87
118
|
@digest || self.class.digest?
|
88
119
|
end
|
89
120
|
|
90
|
-
# Returns the XML for a WSSE header or an empty String unless both
|
91
|
-
#
|
121
|
+
# Returns the XML for a WSSE header or an empty String unless both username and password
|
122
|
+
# were specified.
|
92
123
|
def header
|
93
124
|
return "" unless username && password
|
94
125
|
|
data/spec/basic_spec_helper.rb
CHANGED
File without changes
|
data/spec/endpoint_helper.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/http_stubs.rb
CHANGED
File without changes
|
File without changes
|
data/spec/integration/server.rb
CHANGED
File without changes
|
data/spec/savon/client_spec.rb
CHANGED
@@ -70,8 +70,12 @@ describe Savon::Client do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
it "should have a call method that forwards to method_missing for SOAP actions named after existing methods" do
|
74
|
+
@client.call(:authenticate) { |soap| soap.should be_a(Savon::SOAP) }
|
75
|
+
end
|
76
|
+
|
73
77
|
it "should raise a NoMethodError when the method does not match an available SOAP action or method" do
|
74
78
|
lambda { @client.some_undefined_method }.should raise_error(NoMethodError)
|
75
79
|
end
|
76
80
|
|
77
|
-
end
|
81
|
+
end
|
File without changes
|
File without changes
|
@@ -73,7 +73,6 @@ describe Hash do
|
|
73
73
|
|
74
74
|
it "should call to_s on Strings even if they respond to to_datetime" do
|
75
75
|
object = "gorilla"
|
76
|
-
object.expects(:to_s).returns object
|
77
76
|
object.expects(:to_datetime).never
|
78
77
|
|
79
78
|
hash, result = { :name => object }, "<name>gorilla</name>"
|
@@ -113,6 +112,16 @@ describe Hash do
|
|
113
112
|
soap_xml = hash.to_soap_xml
|
114
113
|
soap_xml.should include('id="666"', 'city="Hamburg"')
|
115
114
|
end
|
115
|
+
|
116
|
+
it "should add attributes to duplicate Hash keys specified through :attributes!" do
|
117
|
+
hash = { :find_user => { :person => ["Lucy", "Anna"], :attributes! => { :person => { :id => [1, 3] } } } }
|
118
|
+
result = '<findUser><person id="1">Lucy</person><person id="3">Anna</person></findUser>'
|
119
|
+
hash.to_soap_xml.should == result
|
120
|
+
|
121
|
+
hash = { :find_user => { :person => ["Lucy", "Anna"], :attributes! => { :person => { :active => "true" } } } }
|
122
|
+
result = '<findUser><person active="true">Lucy</person><person active="true">Anna</person></findUser>'
|
123
|
+
hash.to_soap_xml.should == result
|
124
|
+
end
|
116
125
|
end
|
117
126
|
|
118
127
|
describe "map_soap_response" do
|
File without changes
|
File without changes
|
@@ -75,8 +75,12 @@ describe String do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
describe "to_soap_value" do
|
78
|
-
it "
|
79
|
-
"string".to_soap_value.should == "string"
|
78
|
+
it "should return the string value and escape special characters" do
|
79
|
+
"string".to_soap_value.should == "string"
|
80
|
+
"<tag>".to_soap_value.should == "<tag>"
|
81
|
+
"at&t".to_soap_value.should == "at&t"
|
82
|
+
'"quotes"'.to_soap_value.should == ""quotes""
|
83
|
+
"'apos'".to_soap_value.should == "'apos'"
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
File without changes
|
data/spec/savon/request_spec.rb
CHANGED
@@ -22,8 +22,8 @@ describe Savon::Request do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "has both getter and setter for the logger to use (global setting)" do
|
25
|
-
Savon::Request.logger =
|
26
|
-
Savon::Request.logger.should
|
25
|
+
Savon::Request.logger = {}
|
26
|
+
Savon::Request.logger.should be_a(Hash)
|
27
27
|
Savon::Request.logger = Logger.new STDOUT
|
28
28
|
end
|
29
29
|
|
@@ -76,8 +76,9 @@ describe Savon::Request do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it "executes a SOAP request and returns the Net::HTTP response" do
|
79
|
-
|
80
|
-
|
79
|
+
operation = WSDLFixture.authentication(:operations)[:authenticate]
|
80
|
+
action, input = operation[:action], operation[:input]
|
81
|
+
soap = Savon::SOAP.new action, input, EndpointHelper.soap_endpoint
|
81
82
|
soap_response = @request.soap soap
|
82
83
|
|
83
84
|
soap_response.should be_a(Net::HTTPResponse)
|
data/spec/savon/response_spec.rb
CHANGED
File without changes
|
data/spec/savon/soap_spec.rb
CHANGED
@@ -2,30 +2,31 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Savon::SOAP do
|
4
4
|
before do
|
5
|
-
@
|
6
|
-
@
|
5
|
+
@operation = WSDLFixture.authentication(:operations)[:authenticate]
|
6
|
+
@action, @input = @operation[:action], @operation[:input]
|
7
|
+
@soap = Savon::SOAP.new @action, @input, EndpointHelper.soap_endpoint
|
7
8
|
end
|
8
9
|
|
9
|
-
it "
|
10
|
+
it "should contain the SOAP namespace for each supported SOAP version" do
|
10
11
|
Savon::SOAP::Versions.each do |soap_version|
|
11
12
|
Savon::SOAP::Namespace[soap_version].should be_a(String)
|
12
13
|
Savon::SOAP::Namespace[soap_version].should_not be_empty
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
it "
|
17
|
+
it "should contain the Content-Types for each supported SOAP version" do
|
17
18
|
Savon::SOAP::Versions.each do |soap_version|
|
18
19
|
Savon::SOAP::ContentType[soap_version].should be_a(String)
|
19
20
|
Savon::SOAP::ContentType[soap_version].should_not be_empty
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
|
-
it "
|
24
|
+
it "should contain an Array of supported SOAP versions" do
|
24
25
|
Savon::SOAP::Versions.should be_an(Array)
|
25
26
|
Savon::SOAP::Versions.should_not be_empty
|
26
27
|
end
|
27
28
|
|
28
|
-
it "
|
29
|
+
it "should contain the xs:dateTime format" do
|
29
30
|
Savon::SOAP::DateTimeFormat.should be_a(String)
|
30
31
|
Savon::SOAP::DateTimeFormat.should_not be_empty
|
31
32
|
|
@@ -33,175 +34,168 @@ describe Savon::SOAP do
|
|
33
34
|
should == "2012-03-22T16:22:33Z"
|
34
35
|
end
|
35
36
|
|
36
|
-
it "
|
37
|
+
it "should contain a Regexp matching the xs:dateTime format" do
|
37
38
|
Savon::SOAP::DateTimeRegexp.should be_a(Regexp)
|
38
39
|
(Savon::SOAP::DateTimeRegexp === "2012-03-22T16:22:33").should be_true
|
39
40
|
end
|
40
41
|
|
41
|
-
it "
|
42
|
+
it "should default to SOAP 1.1" do
|
42
43
|
Savon::SOAP.version.should == 1
|
43
44
|
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
describe "xml returned via to_xml" do
|
47
|
+
before do
|
48
|
+
@xml_declaration = '<?xml version="1.0" encoding="UTF-8"?>'
|
49
|
+
@namespace = { "xmlns:ns" => "http://example.com" }
|
50
|
+
@namespace_string = 'xmlns:ns="http://example.com"'
|
51
|
+
@namespaces = { "xmlns:ns" => "http://ns.example.com", "xmlns:ns2" => "http://ns2.example.com" }
|
52
|
+
|
53
|
+
# reset to defaults
|
54
|
+
Savon::SOAP.version = 1
|
55
|
+
Savon::SOAP.header = {}
|
56
|
+
Savon::SOAP.namespaces = {}
|
49
57
|
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it "has a setter for the Savon::WSSE" do
|
53
|
-
@soap.wsse = Savon::WSSE.new
|
54
|
-
end
|
55
|
-
|
56
|
-
it "has both getter and setter for the SOAP action" do
|
57
|
-
@soap.action.should == @authenticate_operation[:action]
|
58
|
-
|
59
|
-
@soap.action = "someAction"
|
60
|
-
@soap.action.should == "someAction"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "has both getter and setter for the SOAP input" do
|
64
|
-
@soap.input.should == @authenticate_operation[:input]
|
65
|
-
|
66
|
-
@soap.input = "whatever"
|
67
|
-
@soap.input.should == "whatever"
|
68
|
-
|
69
|
-
args = "FindUserRequest", { "username" => "auser", "anotherAttr" => "someVal" }
|
70
|
-
@soap.input = *args
|
71
|
-
@soap.input.should == [*args]
|
72
|
-
end
|
73
|
-
|
74
|
-
it "has both getter and setter for global SOAP headers" do
|
75
|
-
header = { "some" => "header" }
|
76
|
-
Savon::SOAP.header = header
|
77
|
-
Savon::SOAP.header.should == header
|
78
58
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
it "has both getter and setter for the SOAP header" do
|
83
|
-
@soap.header.should be_a(Hash)
|
84
|
-
@soap.header.should be_empty
|
85
|
-
|
86
|
-
@soap.header = { "specialAuthKey" => "secret" }
|
87
|
-
@soap.header.should == { "specialAuthKey" => "secret" }
|
88
|
-
end
|
59
|
+
it "should contain an xml declaration" do
|
60
|
+
@soap.to_xml.should include(@xml_declaration)
|
61
|
+
end
|
89
62
|
|
90
|
-
|
91
|
-
@soap.body = { :id => 666 }
|
92
|
-
@soap.body = "<id>666</id>"
|
93
|
-
end
|
63
|
+
# namespaces
|
94
64
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
@soap.namespaces.should == namespaces
|
99
|
-
end
|
65
|
+
it "should contain the namespace for SOAP 1.1" do
|
66
|
+
@soap.to_xml.should include('xmlns:env="' + Savon::SOAP::Namespace[1] + '"')
|
67
|
+
end
|
100
68
|
|
101
|
-
|
102
|
-
|
103
|
-
@soap.
|
69
|
+
it "should contain the namespace for SOAP 1.2 when defined globally" do
|
70
|
+
Savon::SOAP.version = 2
|
71
|
+
@soap.to_xml.should include('xmlns:env="' + Savon::SOAP::Namespace[2] + '"')
|
104
72
|
end
|
105
73
|
|
106
|
-
it "
|
74
|
+
it "should contain the namespace for SOAP 1.2 when defined per request" do
|
107
75
|
@soap.version = 2
|
108
|
-
@soap.
|
76
|
+
@soap.to_xml.should include('xmlns:env="' + Savon::SOAP::Namespace[2] + '"')
|
109
77
|
end
|
110
|
-
end
|
111
78
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
79
|
+
it "should containg a xmlns:wsdl namespace defined via the :namespace shortcut method" do
|
80
|
+
@soap.namespace = "http://wsdl.example.com"
|
81
|
+
@soap.to_xml.should include('xmlns:wsdl="http://wsdl.example.com"')
|
82
|
+
end
|
116
83
|
|
117
|
-
|
118
|
-
|
84
|
+
it "should accept custom namespaces when defined globally" do
|
85
|
+
Savon::SOAP.namespaces = @namespace
|
86
|
+
@soap.to_xml.should include("<env:Envelope " + @namespace_string)
|
87
|
+
end
|
119
88
|
|
120
|
-
|
121
|
-
|
89
|
+
it "should accept custom namespaces when defined per request" do
|
90
|
+
@soap.namespaces = @namespace
|
91
|
+
@soap.to_xml.should include("<env:Envelope " + @namespace_string)
|
92
|
+
end
|
122
93
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
94
|
+
it "should merge global and per request namespaces" do
|
95
|
+
Savon::SOAP.namespaces = @namespaces
|
96
|
+
@soap.namespaces = @namespace
|
97
|
+
@soap.to_xml.should include(
|
98
|
+
'xmlns:ns="http://example.com"',
|
99
|
+
'xmlns:ns2="http://ns2.example.com"'
|
100
|
+
)
|
101
|
+
end
|
127
102
|
|
128
|
-
|
129
|
-
soap_endpoint = URI EndpointHelper.soap_endpoint
|
103
|
+
# header
|
130
104
|
|
131
|
-
|
132
|
-
|
133
|
-
|
105
|
+
it "should not contain a header tag unless specified" do
|
106
|
+
@soap.to_xml.should_not include("<env:Header>")
|
107
|
+
end
|
134
108
|
|
135
|
-
|
136
|
-
|
137
|
-
|
109
|
+
it "should accept a custom (String) header defined globally" do
|
110
|
+
Savon::SOAP.header = "<key>value</key>"
|
111
|
+
@soap.to_xml.should include("<env:Header><key>value</key></env:Header>")
|
112
|
+
end
|
138
113
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
114
|
+
it "should accept a custom (Hash) header defined globally" do
|
115
|
+
Savon::SOAP.header[:key] = "value"
|
116
|
+
@soap.to_xml.should include("<env:Header><key>value</key></env:Header>")
|
117
|
+
end
|
143
118
|
|
144
|
-
|
145
|
-
|
119
|
+
it "should accept a custom (String) header defined per request" do
|
120
|
+
@soap.header = "<key>value</key>"
|
121
|
+
@soap.to_xml.should include("<env:Header><key>value</key></env:Header>")
|
122
|
+
end
|
146
123
|
|
147
|
-
it "
|
148
|
-
@soap.
|
149
|
-
@soap.
|
124
|
+
it "should accept a custom (Hash) header defined per request" do
|
125
|
+
@soap.header[:key] = "value"
|
126
|
+
@soap.to_xml.should include("<env:Header><key>value</key></env:Header>")
|
127
|
+
end
|
150
128
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
129
|
+
it "should merge global and per request headers defined as Strings" do
|
130
|
+
Savon::SOAP.header = "<key2>other value</key2>"
|
131
|
+
@soap.header = "<key>value</key>"
|
132
|
+
@soap.to_xml.should include(
|
133
|
+
"<env:Header><key2>other value</key2><key>value</key></env:Header>"
|
134
|
+
)
|
155
135
|
end
|
156
136
|
|
157
|
-
it "
|
158
|
-
|
137
|
+
it "should merge global and per request headers defined as Hashes" do
|
138
|
+
Savon::SOAP.header = { :key => "value", :key2 => "global value" }
|
139
|
+
@soap.header[:key2] = "request value"
|
140
|
+
@soap.to_xml.should include(
|
141
|
+
"<env:Header><key>value</key><key2>request value</key2></env:Header>"
|
142
|
+
)
|
159
143
|
end
|
160
|
-
|
161
|
-
it "returns the appropriate XML for a SOAP Body's root node when parameters are present" do
|
162
|
-
@soap.input = "authenticate", { "protocol" => "tls", "version" => "1.2" }
|
163
|
-
@soap.body = { :id => 666 }
|
164
144
|
|
165
|
-
|
145
|
+
it "should use the :header method from a given WSSE object to include a WSSE header" do
|
146
|
+
wsse = "some compliant object"
|
147
|
+
wsse.stubs(:header).returns("<wsse>authentication</wsse>")
|
148
|
+
|
149
|
+
@soap.wsse = wsse
|
150
|
+
@soap.to_xml.should include("<env:Header><wsse>authentication</wsse></env:Header>")
|
166
151
|
end
|
167
152
|
|
168
|
-
|
169
|
-
|
153
|
+
# input tag
|
154
|
+
|
155
|
+
it "should contain a :wsdl namespaced input tag matching the :input property on instantiation" do
|
156
|
+
@soap = Savon::SOAP.new "someAction", "someInput", EndpointHelper.soap_endpoint
|
157
|
+
@soap.to_xml.should include('<wsdl:someInput>')
|
170
158
|
end
|
171
159
|
|
172
|
-
it "
|
173
|
-
@soap
|
174
|
-
@soap.to_xml.should include(
|
160
|
+
it "should fall back to using the :action property whem :input is blank" do
|
161
|
+
@soap = Savon::SOAP.new "someAction", "", EndpointHelper.soap_endpoint
|
162
|
+
@soap.to_xml.should include('<wsdl:someAction>')
|
175
163
|
end
|
176
164
|
|
177
|
-
it "
|
178
|
-
|
179
|
-
@soap
|
165
|
+
it "should containg namespaces defined via an input tag Array containing the tag name and a Hash of namespaces" do
|
166
|
+
input = ["someInput", { "otherNs" => "http://otherns.example.com" }]
|
167
|
+
@soap = Savon::SOAP.new "someAction", input, EndpointHelper.soap_endpoint
|
168
|
+
@soap.to_xml.should include('<wsdl:someInput otherNs="http://otherns.example.com">')
|
180
169
|
end
|
181
170
|
|
182
|
-
|
183
|
-
Savon::SOAP.header = { "API-KEY" => "secret", "SOME-KEY" => "something" }
|
184
|
-
@soap.header["SOME-KEY"] = "somethingelse"
|
171
|
+
# xml body
|
185
172
|
|
186
|
-
|
187
|
-
@soap.
|
173
|
+
it "should contain the SOAP body defined as a Hash" do
|
174
|
+
@soap.body = { :someTag => "some value" }
|
175
|
+
@soap.to_xml.should include("<someTag>some value</someTag>")
|
188
176
|
end
|
189
177
|
|
190
|
-
it "
|
191
|
-
|
192
|
-
@soap.
|
178
|
+
it "should contain the SOAP body defined as an Object responding to :to_s" do
|
179
|
+
@soap.body = "<someTag>some value</someTag>"
|
180
|
+
@soap.to_xml.should include(@soap.body)
|
181
|
+
end
|
193
182
|
|
194
|
-
|
195
|
-
|
183
|
+
# xml
|
184
|
+
|
185
|
+
it "should be a completely custom XML when specified" do
|
186
|
+
@soap.xml = "custom SOAP body"
|
187
|
+
@soap.to_xml.should == @soap.xml
|
196
188
|
end
|
197
189
|
|
198
|
-
|
199
|
-
Savon::SOAP.namespaces = { "xmlns:wsdl" => "namespace", "xmlns:v1" => "v1namespace" }
|
200
|
-
@soap.namespaces["xmlns:v1"] = "newV1namespace"
|
190
|
+
# safety check
|
201
191
|
|
202
|
-
|
203
|
-
@soap.to_xml.should include(
|
192
|
+
it "should be a valid SOAP request" do
|
193
|
+
@soap.to_xml.should include(
|
194
|
+
@xml_declaration +
|
195
|
+
'<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">' <<
|
196
|
+
'<env:Body><wsdl:authenticate></wsdl:authenticate></env:Body>' <<
|
197
|
+
'</env:Envelope>'
|
198
|
+
)
|
204
199
|
end
|
205
200
|
end
|
206
|
-
|
207
|
-
end
|
201
|
+
end
|