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.



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

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.



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

def encodingstyle
  @encodingstyle
end

#headerfaultObject (readonly)

Returns the value of attribute headerfault.



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

def headerfault
  @headerfault
end

#messageObject (readonly)

required



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

def message
  @message
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#partObject (readonly)

required



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

def part
  @part
end

#useObject (readonly)

required



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

def use
  @use
end

Instance Method Details

#find_messageObject



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

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

#find_partObject

Raises:

  • (RuntimeError)


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

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



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

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



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

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

#targetnamespaceObject



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

def targetnamespace
  parent.targetnamespace
end