class Sekken::WSDL::Input

Attributes

body_parts[R]

Public: Returns the body part Elements.

header_parts[R]

Public: Returns the header part Elements.

Public Class Methods

new(binding_operation, port_type_operation, wsdl) click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 6
def initialize(binding_operation, port_type_operation, wsdl)
  @binding_operation = binding_operation
  @port_type_operation = port_type_operation
  @wsdl = wsdl

  build_parts
end

Private Instance Methods

build_parts() click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 22
def build_parts
  body_parts = collect_body_parts
  header_parts = collect_header_parts

  # remove explicit header parts from the body parts
  header_part_names = header_parts.map { |part| part[:name] }
  body_parts.reject! { |part| header_part_names.include? part[:name] }

  @header_parts = XML::ElementBuilder.new(@wsdl.schemas).build(header_parts)
  @body_parts = XML::ElementBuilder.new(@wsdl.schemas).build(body_parts)
end
collect_body_parts() click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 34
def collect_body_parts
  find_message(message_name).parts
end
collect_header_parts() click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 42
def collect_header_parts
  parts = []

  headers.each do |header|
    next unless header[:message] && header[:part]
    message_parts = find_message(header[:message]).parts

    # only add the single header part from the message
    parts << message_parts.find { |part| part[:name] == header[:part] }
  end

  parts
end
find_message(qname) click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 60
def find_message(qname)
  local = qname.split(':').last

  @wsdl.documents.messages[local] or
    raise "Unable to find message #{qname.inspect}"
end
headers() click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 56
def headers
  @binding_operation.input_headers
end
message_name() click to toggle source
# File lib/sekken/wsdl/input_output.rb, line 38
def message_name
  @port_type_operation.input[:message]
end