Class: Savon::SOAP
Overview
Savon::SOAP
Represents the SOAP parameters and envelope.
Constant Summary collapse
- SOAPNamespace =
SOAP namespaces by SOAP version.
{ 1 => "http://schemas.xmlsoap.org/soap/envelope/", 2 => "http://www.w3.org/2003/05/soap-envelope" }
- ContentType =
Content-Types by SOAP version.
{ 1 => "text/xml", 2 => "application/soap+xml" }
- @@version =
The global SOAP version.
1
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the SOAP action.
-
#body ⇒ Object
writeonly
Sets the SOAP body.
-
#endpoint ⇒ Object
Accessor for the SOAP endpoint.
-
#header ⇒ Object
Returns the SOAP header.
-
#input ⇒ Object
Returns the SOAP input.
-
#namespaces ⇒ Object
Returns the namespaces.
-
#wsse ⇒ Object
writeonly
Sets the WSSE options.
Class Method Summary collapse
-
.version ⇒ Object
Returns the global SOAP version.
-
.version=(version) ⇒ Object
Sets the global SOAP version.
Instance Method Summary collapse
-
#initialize ⇒ SOAP
constructor
A new instance of SOAP.
-
#namespace=(namespace) ⇒ Object
Convenience method for setting the “xmlns:wsdl” namespace.
-
#to_xml ⇒ Object
Returns the SOAP envelope XML.
-
#version ⇒ Object
Returns the SOAP version.
-
#version=(version) ⇒ Object
Sets the SOAP version.
Constructor Details
#initialize ⇒ SOAP
Returns a new instance of SOAP.
30 31 32 |
# File 'lib/savon/soap.rb', line 30 def initialize @builder = Builder::XmlMarkup.new end |
Instance Attribute Details
#action ⇒ Object
Returns the SOAP action.
41 42 43 |
# File 'lib/savon/soap.rb', line 41 def action @action ||= "" end |
#body=(value) ⇒ Object (writeonly)
Sets the SOAP body. Expected to be a Hash that can be translated to XML via Hash.to_soap_xml or any other Object responding to to_s.
67 68 69 |
# File 'lib/savon/soap.rb', line 67 def body=(value) @body = value end |
#endpoint ⇒ Object
Accessor for the SOAP endpoint.
54 55 56 |
# File 'lib/savon/soap.rb', line 54 def endpoint @endpoint end |
#header ⇒ Object
Returns the SOAP header. Defaults to an empty Hash.
61 62 63 |
# File 'lib/savon/soap.rb', line 61 def header @header ||= {} end |
#input ⇒ Object
Returns the SOAP input.
49 50 51 |
# File 'lib/savon/soap.rb', line 49 def input @input ||= "" end |
#namespaces ⇒ Object
Returns the namespaces. A Hash containing the namespaces (keys) and the corresponding URI’s (values).
75 76 77 |
# File 'lib/savon/soap.rb', line 75 def namespaces @namespaces ||= { "xmlns:env" => SOAPNamespace[version] } end |
#wsse=(value) ⇒ Object (writeonly)
Sets the WSSE options.
35 36 37 |
# File 'lib/savon/soap.rb', line 35 def wsse=(value) @wsse = value end |
Class Method Details
.version ⇒ Object
Returns the global SOAP version.
21 22 23 |
# File 'lib/savon/soap.rb', line 21 def self.version @@version end |
.version=(version) ⇒ Object
Sets the global SOAP version.
26 27 28 |
# File 'lib/savon/soap.rb', line 26 def self.version=(version) @@version = version if Savon::SOAPVersions.include? version end |
Instance Method Details
#namespace=(namespace) ⇒ Object
Convenience method for setting the “xmlns:wsdl” namespace.
80 81 82 |
# File 'lib/savon/soap.rb', line 80 def namespace=(namespace) namespaces["xmlns:wsdl"] = namespace end |
#to_xml ⇒ Object
Returns the SOAP envelope XML.
95 96 97 98 99 100 101 102 103 |
# File 'lib/savon/soap.rb', line 95 def to_xml unless @xml_body @xml_body = @builder.env :Envelope, namespaces do |xml| xml_header xml xml_body xml end end @xml_body end |
#version ⇒ Object
Returns the SOAP version. Defaults to the global default.
90 91 92 |
# File 'lib/savon/soap.rb', line 90 def version @version ||= self.class.version end |
#version=(version) ⇒ Object
Sets the SOAP version.
85 86 87 |
# File 'lib/savon/soap.rb', line 85 def version=(version) @version = version if Savon::SOAPVersions.include? version end |