Class: WSDL::PortType

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

#initializePortType

Returns a new instance of PortType.



25
26
27
28
29
# File 'lib/wsdl/portType.rb', line 25

def initialize
  super
  @name = nil
  @operations = XSD::NamedElements.new
end

Instance Attribute Details

#nameObject (readonly)

required



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

def name
  @name
end

#operationsObject (readonly)

Returns the value of attribute operations.



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

def operations
  @operations
end

Instance Method Details

#find_bindingObject

may be nil if not defined



32
33
34
# File 'lib/wsdl/portType.rb', line 32

def find_binding
  root.bindings.find { |item| item.type == @name }
end

#locationsObject



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

def locations
  binding = find_binding
  return [] if binding.nil?
  bind_name = binding.name
  result = []
  root.services.each do |service|
    service.ports.each do |port|
      if port.binding == bind_name
        result << port.soap_address.location if port.soap_address
      end
    end
  end
  result
end

#parse_attr(attr, value) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/wsdl/portType.rb', line 65

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

#parse_element(element) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/wsdl/portType.rb', line 51

def parse_element(element)
  case element
  when OperationName
    o = Operation.new
    @operations << o
    o
  when DocumentationName
    o = Documentation.new
    o
  else
    nil
  end
end

#targetnamespaceObject



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

def targetnamespace
  parent.targetnamespace
end