source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/wsdl/port.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.6 KB
Line 
1# WSDL4R - WSDL port 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'
10
11
12module WSDL
13
14
15class Port < Info
16 attr_reader :name # required
17 attr_reader :binding # required
18 attr_reader :soap_address
19
20 def initialize
21 super
22 @name = nil
23 @binding = nil
24 @soap_address = nil
25 end
26
27 def targetnamespace
28 parent.targetnamespace
29 end
30
31 def porttype
32 root.porttype(find_binding.type)
33 end
34
35 def find_binding
36 root.binding(@binding) or raise RuntimeError.new("#{@binding} not found")
37 end
38
39 def inputoperation_map
40 result = {}
41 find_binding.operations.each do |op_bind|
42 op_info = op_bind.soapoperation.input_info
43 result[op_info.op_name] = op_info
44 end
45 result
46 end
47
48 def outputoperation_map
49 result = {}
50 find_binding.operations.each do |op_bind|
51 op_info = op_bind.soapoperation.output_info
52 result[op_info.op_name] = op_info
53 end
54 result
55 end
56
57 def parse_element(element)
58 case element
59 when SOAPAddressName
60 o = WSDL::SOAP::Address.new
61 @soap_address = o
62 o
63 when DocumentationName
64 o = Documentation.new
65 o
66 else
67 nil
68 end
69 end
70
71 def parse_attr(attr, value)
72 case attr
73 when NameAttrName
74 @name = XSD::QName.new(targetnamespace, value.source)
75 when BindingAttrName
76 @binding = value
77 else
78 nil
79 end
80 end
81end
82
83
84end
Note: See TracBrowser for help on using the repository browser.