Included Modules

Files

Class Index [+]

Quicksearch

SOAP::SOAPBody

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

Attributes

is_fault[R]

Public Class Methods

new(data = nil, is_fault = false) click to toggle source
     # File lib/soap/element.rb, line 99
 99:   def initialize(data = nil, is_fault = false)
100:     super(nil)
101:     @elename = EleBodyName
102:     @encodingstyle = nil
103:     if data
104:       if data.respond_to?(:to_xmlpart)
105:         data = SOAP::SOAPRawData.new(data)
106:       elsif defined?(::REXML) and data.is_a?(::REXML::Element)
107:         data = SOAP::SOAPRawData.new(SOAP::SOAPREXMLElementWrap.new(data))
108:       end
109:       if data.respond_to?(:elename)
110:         add(data.elename.name, data)
111:       else
112:         data.to_a.each do |datum|
113:           add(datum.elename.name, datum)
114:         end
115:       end
116:     end
117:     @is_fault = is_fault
118:   end

Public Instance Methods

encode(generator, ns, attrs = {}) click to toggle source
     # File lib/soap/element.rb, line 120
120:   def encode(generator, ns, attrs = {})
121:     name = ns.name(@elename)
122:     generator.encode_tag(name, attrs)
123:     @data.each do |data|
124:       yield(data)
125:     end
126:     generator.encode_tag_end(name, @data.size > 0)
127:   end
fault() click to toggle source
    # File lib/soap/rpc/element.rb, line 49
49:   def fault
50:     if @is_fault
51:       self['fault']
52:     else
53:       nil
54:     end
55:   end
fault=(fault) click to toggle source
    # File lib/soap/rpc/element.rb, line 57
57:   def fault=(fault)
58:     @is_fault = true
59:     add('fault', fault)
60:   end
outparams() click to toggle source
    # File lib/soap/rpc/element.rb, line 38
38:   def outparams
39:     root = root_node
40:     if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
41:       op = root[1..1]
42:       op = nil if op && op.empty?
43:       op
44:     else
45:       nil
46:     end
47:   end
request() click to toggle source
    # File lib/soap/rpc/element.rb, line 18
18:   def request
19:     root_node
20:   end
response() click to toggle source
    # File lib/soap/rpc/element.rb, line 22
22:   def response
23:     root = root_node
24:     if !@is_fault
25:       if root.nil?
26:         nil
27:       elsif root.is_a?(SOAPBasetype)
28:         root
29:       else
30:         # Initial element is [retval].
31:         root[0]
32:       end
33:     else
34:       root
35:     end
36:   end
root_node() click to toggle source
     # File lib/soap/element.rb, line 129
129:   def root_node
130:     @data.each do |node|
131:       if node.root == 1
132:         return node
133:       end
134:     end
135:     # No specified root...
136:     @data.each do |node|
137:       if node.root != 0
138:         return node
139:       end
140:     end
141:     raise Parser::FormatDecodeError.new('no root element')
142:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.