Class: SOAP::SOAPHeader

Inherits:
SOAPStruct show all
Includes:
SOAPEnvelopeElement
Defined in:
lib/soap/element.rb

Constant Summary

Constants included from SOAP

AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, 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, NS, NextActor, PropertyName, RPCRouter, RPCServerException, RPCUtils, SOAPNamespaceTag, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName, XSDNamespaceTag, XSINamespaceTag

Instance Attribute Summary collapse

Attributes included from SOAPCompoundtype

#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

#[], #[]=, decode, #each, #have_member, #key?, #members, #replace, #to_obj, #to_s

Methods included from Enumerable

#inject

Methods included from SOAPType

#inspect, #rootnode

Methods inherited from XSD::NSDBase

inherited, #init, types

Constructor Details

#initializeSOAPHeader

Returns a new instance of SOAPHeader.


194
195
196
197
198
199
# File 'lib/soap/element.rb', line 194

def initialize
  super(nil)
  @elename = EleHeaderName
  @encodingstyle = nil
  @force_encode = false
end

Instance Attribute Details

#force_encode=(value) ⇒ Object (writeonly)

Sets the attribute force_encode

Parameters:

  • value

    the value to set the attribute force_encode to.


192
193
194
# File 'lib/soap/element.rb', line 192

def force_encode=(value)
  @force_encode = value
end

Instance Method Details

#add(name, value) ⇒ Object


210
211
212
213
214
215
216
# File 'lib/soap/element.rb', line 210

def add(name, value)
  actor = value.extraattr[AttrActorName]
  mu = (value.extraattr[AttrMustUnderstandName] == '1')
  encstyle = value.extraattr[AttrEncodingStyleName]
  item = SOAPHeaderItem.new(value, mu, encstyle, actor)
  super(name, item)
end

#encode(generator, ns, attrs = {}) ⇒ Object


201
202
203
204
205
206
207
208
# File 'lib/soap/element.rb', line 201

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

#encode?Boolean

Returns:

  • (Boolean)

223
224
225
# File 'lib/soap/element.rb', line 223

def encode?
  @force_encode or length > 0
end

#lengthObject Also known as: size


218
219
220
# File 'lib/soap/element.rb', line 218

def length
  @data.length
end