troelskn-handsoap 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/handsoap/service.rb +14 -5
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/handsoap/service.rb
CHANGED
@@ -122,6 +122,15 @@ module Handsoap
|
|
122
122
|
super
|
123
123
|
end
|
124
124
|
end
|
125
|
+
def envelope_namespace
|
126
|
+
self.class.envelope_namespace
|
127
|
+
end
|
128
|
+
def request_content_type
|
129
|
+
self.class.request_content_type
|
130
|
+
end
|
131
|
+
def uri
|
132
|
+
self.class.uri
|
133
|
+
end
|
125
134
|
# Creates an XML document and sends it over HTTP.
|
126
135
|
#
|
127
136
|
# +action+ is the QName of the rootnode of the envelope.
|
@@ -229,10 +238,10 @@ module Handsoap
|
|
229
238
|
def dispatch(doc, action)
|
230
239
|
on_before_dispatch
|
231
240
|
headers = {
|
232
|
-
"Content-Type" => "#{self.
|
241
|
+
"Content-Type" => "#{self.request_content_type};charset=UTF-8"
|
233
242
|
}
|
234
243
|
headers["SOAPAction"] = action unless action.nil?
|
235
|
-
response = send_http_request(self.
|
244
|
+
response = send_http_request(self.uri, doc.to_s, headers)
|
236
245
|
# Start the parsing pipe-line.
|
237
246
|
# There are various stages and hooks for each, so that you can override those in your service classes.
|
238
247
|
xml_document = parse_soap_response_document(response.primary_part.body)
|
@@ -256,7 +265,7 @@ module Handsoap
|
|
256
265
|
# Creates a standard SOAP envelope and yields the +Body+ element.
|
257
266
|
def make_envelope # :yields: Handsoap::XmlMason::Element
|
258
267
|
doc = XmlMason::Document.new do |doc|
|
259
|
-
doc.alias 'env', self.
|
268
|
+
doc.alias 'env', self.envelope_namespace
|
260
269
|
doc.add "env:Envelope" do |env|
|
261
270
|
env.add "*:Header"
|
262
271
|
env.add "*:Body"
|
@@ -280,8 +289,8 @@ module Handsoap
|
|
280
289
|
# XmlDocument -> [Fault | nil]
|
281
290
|
def parse_soap_fault(document)
|
282
291
|
unless document.nil?
|
283
|
-
node = document.xpath('/env:Envelope/env:Body/descendant-or-self::env:Fault', { 'env' => self.
|
284
|
-
Fault.from_xml(node, :namespace => self.
|
292
|
+
node = document.xpath('/env:Envelope/env:Body/descendant-or-self::env:Fault', { 'env' => self.envelope_namespace }).first
|
293
|
+
Fault.from_xml(node, :namespace => self.envelope_namespace) unless node.nil?
|
285
294
|
end
|
286
295
|
end
|
287
296
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: troelskn-handsoap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Troels Knak-Nielsen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-23 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|