Created
June 30, 2016 18:17
-
-
Save agrare/24e275bdfcb0c26a919fb186f4b5c038 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..84ffef1 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 | |
@@ -96,9 +100,10 @@ module Handsoap | |
@@create_document_callback = nil | |
@@log_header_callback = nil | |
@@log_body_callback = nil | |
- attr_reader :http_client | |
+ attr_reader :http_client, :cookie | |
def initialize(ep) | |
@http_client = nil | |
+ @cookie = nil | |
@create_document_callback ||= @@create_document_callback | |
@log_header_callback ||= @@log_header_callback | |
@log_body_callback ||= @@log_body_callback | |
@@ -265,7 +270,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 +282,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