Class: WSDL::SOAP::Header

Inherits:
Info show all
Defined in:
lib/wsdl/soap/header.rb

Instance Attribute Summary collapse

Attributes inherited from Info

#id, #parent, #root

Instance Method Summary collapse

Methods inherited from Info

#inspect, #parse_epilogue

Constructor Details

#initializeHeader

Returns a new instance of Header.



25
26
27
28
29
30
31
32
33
# File 'lib/wsdl/soap/header.rb', line 25

def initialize
  super
  @message = nil
  @part = nil
  @use = nil
  @encodingstyle = nil
  @namespace = nil
  @headerfault = nil
end

Instance Attribute Details

#encodingstyleObject (readonly)

Returns the value of attribute encodingstyle.



22
23
24
# File 'lib/wsdl/soap/header.rb', line 22

def encodingstyle
  @encodingstyle
end

#headerfaultObject (readonly)

Returns the value of attribute headerfault.



17
18
19
# File 'lib/wsdl/soap/header.rb', line 17

def headerfault
  @headerfault
end

#messageObject (readonly)

required



19
20
21
# File 'lib/wsdl/soap/header.rb', line 19

def message
  @message
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



23
24
25
# File 'lib/wsdl/soap/header.rb', line 23

def namespace
  @namespace
end

#partObject (readonly)

required



20
21
22
# File 'lib/wsdl/soap/header.rb', line 20

def part
  @part
end

#useObject (readonly)

required



21
22
23
# File 'lib/wsdl/soap/header.rb', line 21

def use
  @use
end

Instance Method Details

#find_messageObject



39
40
41
# File 'lib/wsdl/soap/header.rb', line 39

def find_message
  root.message(@message) or raise RuntimeError.new("#{@message} not found")
end

#find_partObject

Raises:

  • (RuntimeError)


43
44
45
46
47
48
49
50
# File 'lib/wsdl/soap/header.rb', line 43

def find_part
  find_message.parts.each do |part|
    if part.name == @part
	return part
    end
  end
  raise RuntimeError.new("#{@part} not found")
end

#parse_attr(attr, value) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/wsdl/soap/header.rb', line 63

def parse_attr(attr, value)
  case attr
  when MessageAttrName
    if value.namespace.nil?
      value = XSD::QName.new(targetnamespace, value.source)
    end
    @message = value
  when PartAttrName
    @part = value.source
  when UseAttrName
    @use = value.source
  when EncodingStyleAttrName
    @encodingstyle = value.source
  when NamespaceAttrName
    @namespace = value.source
  else
    nil
  end
end

#parse_element(element) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/wsdl/soap/header.rb', line 52

def parse_element(element)
  case element
  when HeaderFaultName
    o = WSDL::SOAP::HeaderFault.new
    @headerfault = o
    o
  else
    nil
  end
end

#targetnamespaceObject



35
36
37
# File 'lib/wsdl/soap/header.rb', line 35

def targetnamespace
  parent.targetnamespace
end