class WSDL::Operation

Constants

EMPTY

Attributes

fault[R]
input[R]
name[R]
output[R]
parameter_order[R]
type[R]

Public Class Methods

new() click to toggle source
Calls superclass method WSDL::Info::new
# File lib/wsdl/operation.rb, line 24
def initialize
  super
  @name = nil
  @type = nil
  @parameter_order = nil
  @input = nil
  @output = nil
  @fault = []
end

Public Instance Methods

inputname() click to toggle source
# File lib/wsdl/operation.rb, line 52
def inputname
  if input
    as_operationname(input.name ? input.name.name : @name)
  else
    nil
  end
end
inputparts() click to toggle source

TODO: remove once after OperationInfo created

# File lib/wsdl/operation.rb, line 44
def inputparts
  if message = input_message
    sort_parts(message.parts)
  else
    EMPTY
  end
end
operationname() click to toggle source
# File lib/wsdl/operation.rb, line 38
def operationname
  as_operationname(@name)
end
outputname() click to toggle source
# File lib/wsdl/operation.rb, line 69
def outputname
  if output
    as_operationname(output.name ? output.name.name : @name + 'Response')
  else
    nil
  end
end
outputparts() click to toggle source

TODO: remove once after OperationInfo created

# File lib/wsdl/operation.rb, line 61
def outputparts
  if message = output_message
    sort_parts(message.parts)
  else
    EMPTY
  end
end
parse_attr(attr, value) click to toggle source
# File lib/wsdl/operation.rb, line 99
def parse_attr(attr, value)
  case attr
  when NameAttrName
    @name = value.source
  when TypeAttrName
    @type = value
  when ParameterOrderAttrName
    @parameter_order = value.source.split(/\s+/)
  else
    nil
  end
end
parse_element(element) click to toggle source
# File lib/wsdl/operation.rb, line 77
def parse_element(element)
  case element
  when InputName
    o = Param.new
    @input = o
    o
  when OutputName
    o = Param.new
    @output = o
    o
  when FaultName
    o = Param.new
    @fault << o
    o
  when DocumentationName
    o = Documentation.new
    o
  else
    nil
  end
end
targetnamespace() click to toggle source
# File lib/wsdl/operation.rb, line 34
def targetnamespace
  parent.targetnamespace
end

Private Instance Methods

as_operationname(name) click to toggle source
# File lib/wsdl/operation.rb, line 146
def as_operationname(name)
  XSD::QName.new(targetnamespace, name)
end
input_message() click to toggle source
# File lib/wsdl/operation.rb, line 114
def input_message
  if input and message = input.find_message
    message
  else
    nil
  end
end
output_message() click to toggle source
# File lib/wsdl/operation.rb, line 122
def output_message
  if output and message = output.find_message
    message
  else
    nil
  end
end
sort_parts(parts) click to toggle source
# File lib/wsdl/operation.rb, line 130
def sort_parts(parts)
  return parts.dup unless parameter_order
  result = []
  parameter_order.each do |orderitem|
    if (ele = parts.find { |part| part.name == orderitem })
      result << ele
    end
  end
  if result.length == 0
    return parts.dup
  end
  # result length can be shorter than parts's.
  # return part must not be a part of the parameterOrder.
  result
end