class LolSoap::Request
Represents a HTTP request containing a SOAP Envelope
Attributes
envelope[R]
xml_options[RW]
Public Class Methods
new(envelope)
click to toggle source
# File lib/lolsoap/request.rb, line 7 def initialize(envelope) @envelope = envelope @xml_options = default_xml_options end
Public Instance Methods
body(&block)
click to toggle source
@see Envelope#body
# File lib/lolsoap/request.rb, line 13 def body(&block) envelope.body(&block) end
charset()
click to toggle source
The charset of the request. This is always UTF-8, but it could be overridden in a subclass.
# File lib/lolsoap/request.rb, line 59 def charset 'UTF-8' end
content()
click to toggle source
The content to be sent in the HTTP request
# File lib/lolsoap/request.rb, line 79 def content @content ||= envelope.to_xml(xml_options) end
content_type()
click to toggle source
header(&block)
click to toggle source
@see Envelope#header
# File lib/lolsoap/request.rb, line 18 def header(&block) envelope.header(&block) end
headers()
click to toggle source
Headers that must be set when making the request
# File lib/lolsoap/request.rb, line 70 def headers { 'Content-Type' => content_type, 'Content-Length' => content.bytesize.to_s, 'SOAPAction' => envelope.action } end
input_type()
click to toggle source
The type of the element sent in the request body
# File lib/lolsoap/request.rb, line 38 def input_type envelope.input_body_content_type end
mime()
click to toggle source
The MIME type of the request. This is always application/soap+xml, but it could be overridden in a subclass.
# File lib/lolsoap/request.rb, line 49 def mime if soap_version == '1.1' 'text/xml' else 'application/soap+xml' end end
output_type()
click to toggle source
The type of the element that will be received in the response body
# File lib/lolsoap/request.rb, line 43 def output_type envelope.output_body_content_type end
soap_namespace()
click to toggle source
Namespace used for SOAP envelope tags
# File lib/lolsoap/request.rb, line 23 def soap_namespace envelope.soap_namespace end
soap_version()
click to toggle source
The SOAP version in use
# File lib/lolsoap/request.rb, line 28 def soap_version envelope.soap_version end
url()
click to toggle source
URL to be POSTed to
# File lib/lolsoap/request.rb, line 33 def url envelope.endpoint end
Private Instance Methods
default_xml_options()
click to toggle source
# File lib/lolsoap/request.rb, line 85 def default_xml_options { encoding: charset } end