Class: Savon::Header
- Inherits:
-
Object
- Object
- Savon::Header
- Defined in:
- lib/savon/header.rb
Overview
Assembles the SOAP Header element of a request envelope and renders it to
XML.
A SOAP Header carries a request's out-of-band metadata. This object is responsible for every header block Savon can emit, concatenated in this order:
- application headers supplied by the caller (the
soap_headeroption), - the WS-Addressing headers, rendered by Addressing,
- the WS-Security header with UsernameToken credentials, a
wsu:Timestampand an XML Signature (OASIS WSS SOAP Message Security 1.1).
WS-Security markup is delegated to Akami and Hash-to-XML conversion to Gyoku.
Instance Attribute Summary collapse
-
#gyoku_options ⇒ Object
readonly
Returns the value of attribute gyoku_options.
-
#wsse_auth ⇒ Object
readonly
Returns the value of attribute wsse_auth.
-
#wsse_signature ⇒ Object
readonly
Returns the value of attribute wsse_signature.
-
#wsse_timestamp ⇒ Object
readonly
Returns the value of attribute wsse_timestamp.
Instance Method Summary collapse
-
#attributes ⇒ Hash{String => String}
Returns the XML attributes of the enclosing Header element.
-
#empty? ⇒ Boolean
Whether the rendered header is empty, i.e.
-
#initialize(globals, effective) ⇒ Header
constructor
A new instance of Header.
-
#to_s ⇒ String
Returns the rendered SOAP header XML.
Constructor Details
#initialize(globals, effective) ⇒ Header
Returns a new instance of Header.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/savon/header.rb', line 27 def initialize(globals, effective) @gyoku_options = { key_converter: globals[:convert_request_keys_to] } @wsse_auth = effective.wsse_auth @wsse_timestamp = effective. @wsse_signature = effective.wsse_signature @soap_header = effective.soap_header @addressing = build_addressing(globals, effective) @header = build end |
Instance Attribute Details
#gyoku_options ⇒ Object (readonly)
Returns the value of attribute gyoku_options.
39 40 41 |
# File 'lib/savon/header.rb', line 39 def @gyoku_options end |
#wsse_auth ⇒ Object (readonly)
Returns the value of attribute wsse_auth.
39 40 41 |
# File 'lib/savon/header.rb', line 39 def wsse_auth @wsse_auth end |
#wsse_signature ⇒ Object (readonly)
Returns the value of attribute wsse_signature.
39 40 41 |
# File 'lib/savon/header.rb', line 39 def wsse_signature @wsse_signature end |
#wsse_timestamp ⇒ Object (readonly)
Returns the value of attribute wsse_timestamp.
39 40 41 |
# File 'lib/savon/header.rb', line 39 def @wsse_timestamp end |
Instance Method Details
#attributes ⇒ Hash{String => String}
Returns the XML attributes of the enclosing Header element. Only the
WS-Addressing section declares one, the xmlns:wsa prefix.
45 46 47 |
# File 'lib/savon/header.rb', line 45 def attributes @addressing.namespace_attributes end |
#empty? ⇒ Boolean
Returns whether the rendered header is empty, i.e. there is no header content to include in the envelope.
51 52 53 |
# File 'lib/savon/header.rb', line 51 def empty? @header.empty? end |
#to_s ⇒ String
Returns the rendered SOAP header XML. The header is built once during construction and cached, so this is a cheap, repeatable read.
59 60 61 |
# File 'lib/savon/header.rb', line 59 def to_s @header end |