lib/lolsoap/envelope.rb in lolsoap-0.2.0 vs lib/lolsoap/envelope.rb in lolsoap-0.3.0

- old
+ new

@@ -24,11 +24,11 @@ # @example # env.body do |b| # b.some 'data' # end def body(klass = Builder) - builder = klass.new(input, operation.input) + builder = klass.new(content, input_type) yield builder if block_given? builder end # Build the header of the envelope @@ -44,18 +44,26 @@ def action operation.action end - def input_type + def input operation.input end - def output_type + def input_type + input.type + end + + def output operation.output end + def output_type + output.type + end + def to_xml(options = {}) doc.to_xml(options) end def soap_prefix @@ -71,27 +79,27 @@ end private # @private - def input; @input; end + def content; @content; end # @private def initialize_doc doc.root = root = doc.create_element('Envelope') namespaces = Hash[wsdl.type_namespaces.map { |prefix, uri| [prefix, root.add_namespace(prefix, uri)] }] namespaces[soap_prefix] = root.add_namespace(soap_prefix, soap_namespace) @header = doc.create_element 'Header' - @body = doc.create_element 'Body' - @input = doc.create_element input_type.name + @body = doc.create_element 'Body' + @content = doc.create_element input.name [root, @header, @body].each { |el| el.namespace = namespaces[soap_prefix] } - @input.namespace = namespaces[input_type.prefix] + @content.namespace = namespaces[input.prefix] - @body << @input + @body << @content root << @header root << @body end end end