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, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, SOAPNamespaceTag, SOAPProxy, TypeMap, ValueArray, ValueArrayName, Version, XSDNamespaceTag, XSINamespaceTag
Instance Attribute Summary collapse
#qualified
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #force_typed, #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
inherited, #init, types
Constructor Details
#initialize(data = nil, is_fault = false) ⇒ SOAPBody
Returns a new instance of SOAPBody.
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/soap/element.rb', line 100
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) && defined?(::REXML::Element) && 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.
98
99
100
|
# File 'lib/soap/element.rb', line 98
def is_fault
@is_fault
end
|
Instance Method Details
#encode(generator, ns, attrs = {}) ⇒ Object
121
122
123
124
125
126
127
128
|
# File 'lib/soap/element.rb', line 121
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
|
51
52
53
54
55
56
57
|
# File 'lib/soap/rpc/element.rb', line 51
def fault
if @is_fault
self['fault']
else
nil
end
end
|
#fault=(fault) ⇒ Object
59
60
61
62
|
# File 'lib/soap/rpc/element.rb', line 59
def fault=(fault)
@is_fault = true
add('fault', fault)
end
|
#outparams ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/soap/rpc/element.rb', line 40
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
|
20
21
22
|
# File 'lib/soap/rpc/element.rb', line 20
def request
root_node
end
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/soap/rpc/element.rb', line 24
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/soap/element.rb', line 130
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
|