source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/wsdl/portType.rb@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 1.4 KB
Line 
1# WSDL4R - WSDL portType definition.
2# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <[email protected]>.
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
9require 'wsdl/info'
10require 'xsd/namedelements'
11
12
13module WSDL
14
15
16class 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 def find_binding
31 root.bindings.find { |item| item.type == @name } or
32 raise RuntimeError.new("#{@name} not found")
33 end
34
35 def locations
36 bind_name = find_binding.name
37 result = []
38 root.services.each do |service|
39 service.ports.each do |port|
40 if port.binding == bind_name
41 result << port.soap_address.location if port.soap_address
42 end
43 end
44 end
45 result
46 end
47
48 def parse_element(element)
49 case element
50 when OperationName
51 o = Operation.new
52 @operations << o
53 o
54 when DocumentationName
55 o = Documentation.new
56 o
57 else
58 nil
59 end
60 end
61
62 def parse_attr(attr, value)
63 case attr
64 when NameAttrName
65 @name = XSD::QName.new(targetnamespace, value.source)
66 else
67 nil
68 end
69 end
70end
71
72
73end
Note: See TracBrowser for help on using the repository browser.