Class: WSDL::OperationBinding

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

#initializeOperationBinding

Returns a new instance of OperationBinding.



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

def initialize
  super
  @name = nil
  @input = nil
  @output = nil
  @fault = []
  @soapoperation = nil
end

Instance Attribute Details

#faultObject (readonly)

Returns the value of attribute fault.



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

def fault
  @fault
end

#inputObject (readonly)

Returns the value of attribute input.



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

def input
  @input
end

#nameObject (readonly)

required



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

def name
  @name
end

#outputObject (readonly)

Returns the value of attribute output.



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

def output
  @output
end

#soapoperationObject (readonly)

Returns the value of attribute soapoperation.



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

def soapoperation
  @soapoperation
end

Instance Method Details

#find_operationObject

Raises:

  • (RuntimeError)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/wsdl/operationBinding.rb', line 39

def find_operation
  porttype.operations.each do |op|
    next if op.name != @name
    next if op.input and @input and op.input.name and @input.name and
      op.input.name != @input.name
    next if op.output and @output and op.output.name and @output.name and
      op.output.name != @output.name
    return op
  end
  raise RuntimeError.new("#{@name} not found")
end

#parse_attr(attr, value) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/wsdl/operationBinding.rb', line 113

def parse_attr(attr, value)
  case attr
  when NameAttrName
    @name = value.source
  else
    nil
  end
end

#parse_element(element) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/wsdl/operationBinding.rb', line 87

def parse_element(element)
  case element
  when InputName
    o = Param.new
    @input = o
    o
  when OutputName
    o = Param.new
    @output = o
    o
  when FaultName
    o = Param.new
    @fault << o
    o
  when SOAPOperationName
    o = WSDL::SOAP::Operation.new
    @soapoperation = o
    o
  when DocumentationName
    o = Documentation.new
    o
  else
    nil
  end
end

#porttypeObject



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

def porttype
  root.porttype(parent.type)
end

#soapactionObject



79
80
81
82
83
84
85
# File 'lib/wsdl/operationBinding.rb', line 79

def soapaction
  if @soapoperation
    @soapoperation.soapaction
  else
    nil
  end
end

#soapbody_use_inputObject



71
72
73
# File 'lib/wsdl/operationBinding.rb', line 71

def soapbody_use_input
  soapbody_use(@input)
end

#soapbody_use_outputObject



75
76
77
# File 'lib/wsdl/operationBinding.rb', line 75

def soapbody_use_output
  soapbody_use(@output)
end

#soapoperation_nameObject



51
52
53
54
55
56
57
# File 'lib/wsdl/operationBinding.rb', line 51

def soapoperation_name
  op_name = find_operation.operationname
  if @input and @input.soapbody and @input.soapbody.namespace
    op_name = XSD::QName.new(@input.soapbody.namespace, op_name.name)
  end
  op_name
end

#soapoperation_styleObject



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/wsdl/operationBinding.rb', line 59

def soapoperation_style
  style = nil
  if @soapoperation
    style = @soapoperation.operation_style
  elsif parent.soapbinding
    style = parent.soapbinding.style
  else
    raise TypeError.new("operation style definition not found")
  end
  style || :document
end

#targetnamespaceObject



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

def targetnamespace
  parent.targetnamespace
end