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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus