Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/trunk/lib/wsdl/portType.rb

Revision 1824, 1.4 kB (checked in by nahi, 2 years ago)
  • Copyright notice updated. add '2000-2007' uniformly.
  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1 # WSDL4R - WSDL portType definition.
2 # Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
4 # This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
5 # redistribute it and/or modify it under the same terms of Ruby's license;
6 # either the dual license version in 2003, or any later version.
7
8
9 require 'wsdl/info'
10 require 'xsd/namedelements'
11
12
13 module WSDL
14
15
16 class PortType < Info
17   attr_reader :name             # required
18   attr_reader :operations
19
20   def targetnamespace
21     parent.targetnamespace
22   end
23
24   def initialize
25     super
26     @name = nil
27     @operations = XSD::NamedElements.new
28   end
29
30   # may be nil if not defined
31   def find_binding
32     root.bindings.find { |item| item.type == @name }
33   end
34
35   def locations
36     binding = find_binding
37     return [] if binding.nil?
38     bind_name = binding.name
39     result = []
40     root.services.each do |service|
41       service.ports.each do |port|
42         if port.binding == bind_name
43           result << port.soap_address.location if port.soap_address
44         end
45       end
46     end
47     result
48   end
49
50   def parse_element(element)
51     case element
52     when OperationName
53       o = Operation.new
54       @operations << o
55       o
56     when DocumentationName
57       o = Documentation.new
58       o
59     else
60       nil
61     end
62   end
63
64   def parse_attr(attr, value)
65     case attr
66     when NameAttrName
67       @name = XSD::QName.new(targetnamespace, value.source)
68     else
69       nil
70     end
71   end
72 end
73
74
75 end
Note: See TracBrowser for help on using the browser.