Class: SOAP::SOAPBody
Overview
Add method definitions for RPC to common definition in element.rb
Constant Summary
Constants included
from SOAP
AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrHref, AttrHrefName, AttrId, AttrIdName, AttrMustUnderstand, AttrMustUnderstandName, AttrOffset, AttrOffsetName, AttrPosition, AttrPositionName, AttrRoot, AttrRootName, Base64Literal, Charset, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, RPCRouter, RPCServerException, RPCUtils, SOAPGenerator, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName
Instance Attribute Summary collapse
#qualified
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #id, #parent, #position, #precedents, #root
Attributes inherited from XSD::NSDBase
#type
Instance Method Summary
collapse
Methods inherited from SOAPStruct
#[], #[]=, #add, decode, #each, #have_member, #key?, #members, #replace, #to_obj, #to_s
Methods included from SOAPType
#inspect, #rootnode
Methods included from Enumerable
#inject
inherited, #init, types
Constructor Details
#initialize(data = nil, is_fault = false) ⇒ SOAPBody
Returns a new instance of SOAPBody.
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/soap/element.rb', line 99
def initialize(data = nil, is_fault = false)
super(nil)
@elename = EleBodyName
@encodingstyle = nil
if data
if data.respond_to?(:to_xmlpart)
data = SOAP::SOAPRawData.new(data)
elsif defined?(::REXML) and data.is_a?(::REXML::Element)
data = SOAP::SOAPRawData.new(SOAP::SOAPREXMLElementWrap.new(data))
end
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
|
Instance Attribute Details
Returns the value of attribute is_fault.
97
98
99
|
# File 'lib/soap/element.rb', line 97
def is_fault
@is_fault
end
|
Instance Method Details
#encode(generator, ns, attrs = {}) ⇒ Object
120
121
122
123
124
125
126
127
|
# File 'lib/soap/element.rb', line 120
def encode(generator, ns, attrs = {})
name = ns.name(@elename)
generator.encode_tag(name, attrs)
@data.each do |data|
yield(data)
end
generator.encode_tag_end(name, @data.size > 0)
end
|
49
50
51
52
53
54
55
|
# File 'lib/soap/rpc/element.rb', line 49
def fault
if @is_fault
self['fault']
else
nil
end
end
|
#fault=(fault) ⇒ Object
57
58
59
60
|
# File 'lib/soap/rpc/element.rb', line 57
def fault=(fault)
@is_fault = true
add('fault', fault)
end
|
#outparams ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/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
|
18
19
20
|
# File 'lib/soap/rpc/element.rb', line 18
def request
root_node
end
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/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
root[0]
end
else
root
end
end
|
#root_node ⇒ Object
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/soap/element.rb', line 129
def root_node
@data.each do |node|
if node.root == 1
return node
end
end
@data.each do |node|
if node.root != 0
return node
end
end
raise Parser::FormatDecodeError.new('no root element')
end
|