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 Attribute Summary collapse
-
#multipart ⇒ Object
readonly
Returns the value of attribute multipart.
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.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/savon/builder.rb', line 24 def initialize(operation_name, wsdl, globals, locals) @operation_name = operation_name @wsdl = wsdl @globals = globals @locals = locals @signature = @locals[:wsse_signature] || @globals[:wsse_signature] @types = convert_type_definitions_to_hash @used_namespaces = convert_type_namespaces_to_hash end |
Instance Attribute Details
#multipart ⇒ Object (readonly)
Returns the value of attribute multipart.
10 11 12 |
# File 'lib/savon/builder.rb', line 10 def multipart @multipart end |
Instance Method Details
#body_attributes ⇒ Object
68 69 70 |
# File 'lib/savon/builder.rb', line 68 def body_attributes @body_attributes ||= @signature.nil? ? {} : @signature.body_attributes end |
#build_document ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/savon/builder.rb', line 40 def build_document xml_result = build_xml # if we have a signature sign the document if @signature @signature.document = xml_result 2.times do @header = nil @signature.document = build_xml end xml_result = @signature.document end # if there are attachments for the request, we should build a multipart message according to # https://www.w3.org/TR/SOAP-attachments if @locals[:attachments] (xml_result) else xml_result end end |
#header_attributes ⇒ Object
64 65 66 |
# File 'lib/savon/builder.rb', line 64 def header_attributes @globals[:use_wsa_headers] ? { 'xmlns:wsa' => WSA_NAMESPACE } : {} end |
#pretty ⇒ Object
36 37 38 |
# File 'lib/savon/builder.rb', line 36 def pretty Nokogiri.XML(to_s).to_xml(:indent => 2) end |
#to_s ⇒ Object
72 73 74 75 |
# File 'lib/savon/builder.rb', line 72 def to_s return @locals[:xml] if @locals.include? :xml build_document end |