Class: SOAP::WSDL::PortType

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/lc/wsdl/portType.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ PortType

Returns a new instance of PortType.



10
11
12
13
14
15
16
17
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/soap/lc/wsdl/portType.rb', line 10

def initialize( element )
  @operations = Hash.new
  @name = element.attributes['name']
  
  # Process all operations
  element.find_all {|e| e.class == REXML::Element }.each { |operation| 
    case operation.name
      when "operation"
        @operations[operation.attributes['name']] = Hash.new
        
        # Store operation attributs
        operation.attributes.each { |name, value|
          case name
            when 'name'
              @operations[operation.attributes['name']][:name] = value
            else
              warn "Ignoring attribut `#{name}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
          end
        }
        
        # Store operation input, output and/or fault
        operation.find_all {|e| e.class == REXML::Element }.each { |action|
          case action.name
            when "input"
              @operations[operation.attributes['name']][:input] = Hash.new
              
              # Store input attributs
              action.attributes.each { |name, value|
                case name
                  when 'name'
                    @operations[operation.attributes['name']][:input][:name] = value
                  when 'message'
                    @operations[operation.attributes['name']][:input][:message] = value
                  else
                    warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
                end
              }
            when "output"
              @operations[operation.attributes['name']][:output] = Hash.new
              
              # Store output attributs
              action.attributes.each { |name, value|
                case name
                  when 'name'
                    @operations[operation.attributes['name']][:output][:name] = value
                  when 'message'
                    @operations[operation.attributes['name']][:output][:message] = value
                  else
                    warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
                end
              }
            when "fault"
              @operations[operation.attributes['name']][:fault] = Hash.new
              
              # Store output attributs
              action.attributes.each { |name, value|
                case name
                  when 'name'
                    @operations[operation.attributes['name']][:fault][:name] = value
                  when 'message'
                    @operations[operation.attributes['name']][:fault][:message] = value
                  else
                    warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
                end
              }
            else
              warn "Ignoring element `#{action.name}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
          end
        }
      else
        warn "Ignoring element `#{operation.name}' in portType `#{element.attributes['name']}'"
    end
  }
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/soap/lc/wsdl/portType.rb', line 8

def name
  @name
end

#operationsObject (readonly)

Returns the value of attribute operations.



7
8
9
# File 'lib/soap/lc/wsdl/portType.rb', line 7

def operations
  @operations
end