Class: Savon::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/builder.rb

Constant Summary collapse

SCHEMA_TYPES =
{
  "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
  "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"
}
SOAP_NAMESPACE =
{
  1 => "http://schemas.xmlsoap.org/soap/envelope/",
  2 => "http://www.w3.org/2003/05/soap-envelope"
}

Instance Method Summary collapse

Constructor Details

#initialize(operation_name, wsdl, globals, locals) ⇒ Builder

Returns a new instance of Builder.



20
21
22
23
24
25
26
27
28
29
# File 'lib/savon/builder.rb', line 20

def initialize(operation_name, wsdl, globals, locals)
  @operation_name = operation_name

  @wsdl    = wsdl
  @globals = globals
  @locals  = locals

  @types = convert_type_definitions_to_hash
  @used_namespaces = convert_type_namespaces_to_hash
end

Instance Method Details

#prettyObject



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

def pretty
  Nokogiri.XML(to_s).to_xml(:indent => 2)
end

#to_sObject



35
36
37
38
39
40
41
42
# File 'lib/savon/builder.rb', line 35

def to_s
  return @locals[:xml] if @locals.include? :xml

  tag(builder, :Envelope, namespaces_with_globals) do |xml|
    tag(xml, :Header) { xml << header.to_s } unless header.empty?
    tag(xml, :Body)   { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
  end
end