Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • soap/element.rb
  • soap/rpc/element.rb

Class/Module Index [+]

Quicksearch

SOAP::SOAPBody

Add method definitions for RPC to common definition in element.rb

Public Class Methods

new(data = nil, is_fault = false) click to toggle source
 
               # File soap/element.rb, line 98
def initialize(data = nil, is_fault = false)
  super(nil)
  @elename = EleBodyName
  @encodingstyle = nil
  if data
    if data.respond_to?(:elename)
      add(data.elename.name, data)
    else
      data.to_a.each do |datum|
        add(datum.elename.name, datum)
      end
    end
  end
  @is_fault = is_fault
end
            

Public Instance Methods

encode(generator, ns, attrs = {}) click to toggle source
 
               # File soap/element.rb, line 114
def encode(generator, ns, attrs = {})
  name = ns.name(@elename)
  generator.encode_tag(name, attrs)
  if @is_fault
    yield(@data)
  else
    @data.each do |data|
      yield(data)
    end
  end
  generator.encode_tag_end(name, true)
end
            
fault() click to toggle source
 
               # File soap/rpc/element.rb, line 49
def fault
  if @is_fault
    self['fault']
  else
    nil
  end
end
            
fault=(fault) click to toggle source
 
               # File soap/rpc/element.rb, line 57
def fault=(fault)
  @is_fault = true
  add_member('fault', fault)
end
            
outparams() click to toggle source
 
               # File soap/rpc/element.rb, line 38
def outparams
  root = root_node
  if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
    op = root[1..-1]
    op = nil if op && op.empty?
    op
  else
    nil
  end
end
            
request() click to toggle source
 
               # File soap/rpc/element.rb, line 18
def request
  root_node
end
            
response() click to toggle source
 
               # File soap/rpc/element.rb, line 22
def response
  root = root_node
  if !@is_fault
    if root.nil?
      nil
    elsif root.is_a?(SOAPBasetype)
      root
    else
      # Initial element is [retval].
      root[0]
    end
  else
    root
  end
end
            
root_node() click to toggle source
 
               # File soap/element.rb, line 127
def root_node
  @data.each do |node|
    if node.root == 1
      return node
    end
  end
  # No specified root...
  @data.each do |node|
    if node.root != 0
      return node
    end
  end

  raise Parser::FormatDecodeError.new('no root element')
end