Class: Savon::SOAP

Inherits:
Object show all
Includes:
WSSE
Defined in:
lib/savon/soap.rb

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" }

Constants included from WSSE

WSSE::WSENamespace, WSSE::WSUNamespace

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WSSE

digest?, #wsse?, #wsse_header

Constructor Details

#initialize(action, body, options, namespace_uri) ⇒ SOAP

Expects a SOAP action, body, options and the namespace_uri.



25
26
27
28
# File 'lib/savon/soap.rb', line 25

def initialize(action, body, options, namespace_uri)
  @action, @body = action, body
  @options, @namespace_uri = options, namespace_uri
end

Class Attribute Details

.versionObject

Accessor for the default SOAP version.



20
21
22
# File 'lib/savon/soap.rb', line 20

def version
  @version
end

Instance Attribute Details

#actionObject (readonly)

Returns the SOAP action.



31
32
33
# File 'lib/savon/soap.rb', line 31

def action
  @action
end

#optionsObject (readonly)

Returns the SOAP options.



34
35
36
# File 'lib/savon/soap.rb', line 34

def options
  @options
end

Instance Method Details

#bodyObject

Returns the XML for a SOAP request.



37
38
39
40
41
42
43
44
# File 'lib/savon/soap.rb', line 37

def body
  builder = Builder::XmlMarkup.new

  @xml_body ||= builder.env :Envelope, envelope_namespaces do |xml|
    xml.env(:Header) { envelope_header xml }
    xml.env(:Body) { envelope_body xml }
  end
end

#versionObject

Returns the SOAP version to use.



47
48
49
# File 'lib/savon/soap.rb', line 47

def version
  @options[:soap_version] || self.class.version
end