Created
June 30, 2016 18:18
-
-
Save agrare/ccd6c91bcca3c78a85a6f6a0dd67d552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/handsoap/service.rb b/lib/handsoap/service.rb | |
index 278f761..65bcf02 100644 | |
--- a/lib/handsoap/service.rb | |
+++ b/lib/handsoap/service.rb | |
@@ -36,8 +36,9 @@ module Handsoap | |
SOAP_NAMESPACE = { 1 => 'http://schemas.xmlsoap.org/soap/envelope/', 2 => 'http://www.w3.org/2001/12/soap-encoding' } | |
class Response | |
- def initialize(http_body, soap_namespace) | |
+ def initialize(http_body, http_headers, soap_namespace) | |
@http_body = http_body | |
+ @http_headers = http_headers | |
@soap_namespace = soap_namespace | |
@document = :lazy | |
@fault = :lazy | |
@@ -62,6 +63,9 @@ module Handsoap | |
end | |
return @fault | |
end | |
+ def cookie | |
+ @http_headers['Set-Cookie'] | |
+ end | |
end | |
class Fault < RuntimeError | |
@@ -265,7 +269,7 @@ module Handsoap | |
fire_on_log_header { "HandSoap Response [#{dispatch_id}]: length: [#{@http_client.body_str.length}], HTTP-Status: [#{@http_client.response_code}], Content-Type: [#{@http_client.content_type}]" } | |
fire_on_log_body { Handsoap.pretty_format_envelope(@http_client.body_str) } | |
- soap_response = Response.new(@http_client.body_str, envelope_namespace) | |
+ soap_response = Response.new(@http_client.body_str, @http_client.headers, envelope_namespace) | |
else | |
if !@http_client | |
require 'httpclient' | |
@@ -277,7 +281,7 @@ module Handsoap | |
fire_on_log_header { "HandSoap Response [#{dispatch_id}]: length: [#{response.content.length}], HTTP-Status: [#{response.status}], Content-Type: [#{response.contenttype}]" } | |
fire_on_log_body { Handsoap.pretty_format_envelope(response.content) } | |
- soap_response = Response.new(response.content, envelope_namespace) | |
+ soap_response = Response.new(response.content, response.headers, envelope_namespace) | |
end | |
if soap_response.fault? | |
return self.on_fault(soap_response.fault) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment