Class: SOAP::WSDL::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl-reader/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Service

Returns a new instance of Service.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/wsdl-reader/service.rb', line 18

def initialize( element )
  @ports = Hash.new
  @name = element.attributes['name']
  
  # Process all ports
  element.find_all {|e| e.class == REXML::Element }.each { |port|
    case port.name
      when "port"
        @ports[port.attributes['name']] = Hash.new
        
        # Store port attributs             
        port.attributes.each { |name, value|
          case name
            when 'name'
              @ports[port.attributes['name']][:name] = value
            when 'binding'
              @ports[port.attributes['name']][:binding] = value
            else
              warn "Ignoring attribut `#{name}' in port `#{port.attributes['name']}' for service `#{element.attributes['name']}'"
          end
        }
        
        # Store port soap:address
        port.find_all {|e| e.class == REXML::Element }.each { |address|
          case address.name
            when "address"
              @ports[port.attributes['name']][:address] = address.attributes['location']
            else
              warn "Ignoring element `#{address.name}' in port `#{port.attributes['name']}' for service `#{element.attributes['name']}'"
          end
        }
      else
        warn "Ignoring element `#{port.name}' in service `#{element.attributes['name']}'"
    end
  }
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/wsdl-reader/service.rb', line 16

def name
  @name
end

#portsObject (readonly)

Returns the value of attribute ports.



15
16
17
# File 'lib/wsdl-reader/service.rb', line 15

def ports
  @ports
end