Class: Savon::Builder
- Inherits:
-
Object
- Object
- Savon::Builder
- 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" }
- WSA_NAMESPACE =
"http://www.w3.org/2005/08/addressing"
Instance Method Summary collapse
- #body_attributes ⇒ Object
- #build_document ⇒ Object
- #header_attributes ⇒ Object
-
#initialize(operation_name, wsdl, globals, locals) ⇒ Builder
constructor
A new instance of Builder.
- #pretty ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(operation_name, wsdl, globals, locals) ⇒ Builder
Returns a new instance of Builder.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/savon/builder.rb', line 22 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
#body_attributes ⇒ Object
52 53 54 |
# File 'lib/savon/builder.rb', line 52 def body_attributes {} end |
#build_document ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/savon/builder.rb', line 37 def build_document tag(builder, :Envelope, namespaces_with_globals) do |xml| tag(xml, :Header, header_attributes) { xml << header.to_s } unless header.empty? if @globals[:no_message_tag] tag(xml, :Body, body_attributes) { xml << .to_s } else tag(xml, :Body, body_attributes) { xml.tag!(*) { xml << .to_s } } end end end |
#header_attributes ⇒ Object
48 49 50 |
# File 'lib/savon/builder.rb', line 48 def header_attributes { 'xmlns:wsa' => WSA_NAMESPACE } if @globals[:use_wsa_headers] end |
#pretty ⇒ Object
33 34 35 |
# File 'lib/savon/builder.rb', line 33 def pretty Nokogiri.XML(to_s).to_xml(:indent => 2) end |
#to_s ⇒ Object
56 57 58 59 |
# File 'lib/savon/builder.rb', line 56 def to_s return @locals[:xml] if @locals.include? :xml build_document end |