Line | |
---|
1 | # WSDL4R - WSDL bound operation 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 |
|
---|
9 | require 'wsdl/info'
|
---|
10 |
|
---|
11 |
|
---|
12 | module WSDL
|
---|
13 |
|
---|
14 |
|
---|
15 | class OperationBinding < Info
|
---|
16 | attr_reader :name # required
|
---|
17 | attr_reader :input
|
---|
18 | attr_reader :output
|
---|
19 | attr_reader :fault
|
---|
20 | attr_reader :soapoperation
|
---|
21 |
|
---|
22 | def initialize
|
---|
23 | super
|
---|
24 | @name = nil
|
---|
25 | @input = nil
|
---|
26 | @output = nil
|
---|
27 | @fault = []
|
---|
28 | @soapoperation = nil
|
---|
29 | end
|
---|
30 |
|
---|
31 | def targetnamespace
|
---|
32 | parent.targetnamespace
|
---|
33 | end
|
---|
34 |
|
---|
35 | def porttype
|
---|
36 | root.porttype(parent.type)
|
---|
37 | end
|
---|
38 |
|
---|
39 | def find_operation
|
---|
40 | porttype.operations[@name] or raise RuntimeError.new("#{@name} not found")
|
---|
41 | end
|
---|
42 |
|
---|
43 | def soapoperation_name
|
---|
44 | if @soapoperation
|
---|
45 | @soapoperation.input_info.op_name
|
---|
46 | else
|
---|
47 | find_operation.name
|
---|
48 | end
|
---|
49 | end
|
---|
50 |
|
---|
51 | def soapoperation_style
|
---|
52 | style = nil
|
---|
53 | if @soapoperation
|
---|
54 | style = @soapoperation.operation_style
|
---|
55 | elsif parent.soapbinding
|
---|
56 | style = parent.soapbinding.style
|
---|
57 | else
|
---|
58 | raise TypeError.new("operation style definition not found")
|
---|
59 | end
|
---|
60 | style || :document
|
---|
61 | end
|
---|
62 |
|
---|
63 | def soapaction
|
---|
64 | if @soapoperation
|
---|
65 | @soapoperation.soapaction
|
---|
66 | else
|
---|
67 | nil
|
---|
68 | end
|
---|
69 | end
|
---|
70 |
|
---|
71 | def parse_element(element)
|
---|
72 | case element
|
---|
73 | when InputName
|
---|
74 | o = Param.new
|
---|
75 | @input = o
|
---|
76 | o
|
---|
77 | when OutputName
|
---|
78 | o = Param.new
|
---|
79 | @output = o
|
---|
80 | o
|
---|
81 | when FaultName
|
---|
82 | o = Param.new
|
---|
83 | @fault << o
|
---|
84 | o
|
---|
85 | when SOAPOperationName
|
---|
86 | o = WSDL::SOAP::Operation.new
|
---|
87 | @soapoperation = o
|
---|
88 | o
|
---|
89 | when DocumentationName
|
---|
90 | o = Documentation.new
|
---|
91 | o
|
---|
92 | else
|
---|
93 | nil
|
---|
94 | end
|
---|
95 | end
|
---|
96 |
|
---|
97 | def parse_attr(attr, value)
|
---|
98 | case attr
|
---|
99 | when NameAttrName
|
---|
100 | @name = XSD::QName.new(targetnamespace, value.source)
|
---|
101 | else
|
---|
102 | nil
|
---|
103 | end
|
---|
104 | end
|
---|
105 | end
|
---|
106 |
|
---|
107 |
|
---|
108 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.