Class: WSDL::Param

Inherits:
Info
  • Object
show all
Defined in:
lib/wsdl/param.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

#initializeParam

Returns a new instance of Param.



22
23
24
25
26
27
28
29
# File 'lib/wsdl/param.rb', line 22

def initialize
  super
  @message = nil
  @name = nil
  @soapbody = nil
  @soapheader = []
  @soapfault = nil
end

Instance Attribute Details

#messageObject (readonly)

required



16
17
18
# File 'lib/wsdl/param.rb', line 16

def message
  @message
end

#nameObject (readonly)

optional but required for fault.



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

def name
  @name
end

#soapbodyObject (readonly)

Returns the value of attribute soapbody



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

def soapbody
  @soapbody
end

#soapfaultObject (readonly)

Returns the value of attribute soapfault



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

def soapfault
  @soapfault
end

#soapheaderObject (readonly)

Returns the value of attribute soapheader



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

def soapheader
  @soapheader
end

Instance Method Details

#find_messageObject



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

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

#parse_attr(attr, value) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/wsdl/param.rb', line 69

def parse_attr(attr, value)
  case attr
  when MessageAttrName
    if value.namespace.nil?
      value = XSD::QName.new(targetnamespace, value.source)
    end
    @message = value
  when NameAttrName
    @name = XSD::QName.new(targetnamespace, value.source)
  else
    nil
  end
end

#parse_element(element) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/wsdl/param.rb', line 47

def parse_element(element)
  case element
  when SOAPBodyName
    o = WSDL::SOAP::Body.new
    @soapbody = o
    o
  when SOAPHeaderName
    o = WSDL::SOAP::Header.new
    @soapheader << o
    o
  when SOAPFaultName
    o = WSDL::SOAP::Fault.new
    @soap_fault = o
    o
  when DocumentationName
    o = Documentation.new
    o
  else
    nil
  end
end

#soapbody_useObject



39
40
41
42
43
44
45
# File 'lib/wsdl/param.rb', line 39

def soapbody_use
  if @soapbody
    @soapbody.use || :literal
  else
    raise RuntimeError.new("soap:body not found")
  end
end

#targetnamespaceObject



31
32
33
# File 'lib/wsdl/param.rb', line 31

def targetnamespace
  parent.targetnamespace
end