Class SOAP::RPC::Driver
In: lib/soap/rpc/driver.rb
Parent: Object

Methods

Attributes

options  [R] 
proxy  [R] 
soapaction  [RW] 

Public Class methods

[Source]

    # File lib/soap/rpc/driver.rb, line 27
27:       def __attr_proxy(symbol, assignable = false)
28:         name = symbol.to_s
29:         define_method(name) {
30:           @proxy.__send__(name)
31:         }
32:         if assignable
33:           aname = name + '='
34:           define_method(aname) { |rhs|
35:             @proxy.__send__(aname, rhs)
36:           }
37:         end
38:       end

[Source]

    # File lib/soap/rpc/driver.rb, line 40
40:       def __attr_proxy(symbol, assignable = false)
41:         name = symbol.to_s
42:         module_eval "def \#{name}\n@proxy.\#{name}\nend\n"
43:         if assignable
44:           module_eval "def \#{name}=(value)\n@proxy.\#{name} = value\nend\n"
45:         end
46:       end

[Source]

     # File lib/soap/rpc/driver.rb, line 110
110:   def initialize(endpoint_url, namespace = nil, soapaction = nil)
111:     @namespace = namespace
112:     @soapaction = soapaction
113:     @options = setup_options
114:     @wiredump_file_base = nil
115:     @proxy = Proxy.new(endpoint_url, @soapaction, @options)
116:   end

Public Instance methods

[Source]

     # File lib/soap/rpc/driver.rb, line 149
149:   def add_document_method(name, soapaction, req_qname, res_qname)
150:     param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
151:     @proxy.add_document_method(soapaction, name, param_def)
152:     add_document_method_interface(name, param_def)
153:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 160
160:   def add_document_operation(soapaction, name, param_def, opt = {})
161:     @proxy.add_document_operation(soapaction, name, param_def, opt)
162:     add_document_method_interface(name, param_def)
163:   end
add_method(name, *params)

Alias for add_rpc_method

add_method_as(name, name_as, *params)

Alias for add_rpc_method_as

add_method_with_soapaction(name, soapaction, *params)
add_method_with_soapaction_as(name, name_as, soapaction, *params)

[Source]

     # File lib/soap/rpc/driver.rb, line 124
124:   def add_rpc_method(name, *params)
125:     add_rpc_method_with_soapaction_as(name, name, @soapaction, *params)
126:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 128
128:   def add_rpc_method_as(name, name_as, *params)
129:     add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params)
130:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 132
132:   def add_rpc_method_with_soapaction(name, soapaction, *params)
133:     add_rpc_method_with_soapaction_as(name, name, soapaction, *params)
134:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 136
136:   def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
137:     param_def = SOAPMethod.create_rpc_param_def(params)
138:     qname = XSD::QName.new(@namespace, name_as)
139:     @proxy.add_rpc_method(qname, soapaction, name, param_def)
140:     add_rpc_method_interface(name, param_def)
141:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 155
155:   def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
156:     @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt)
157:     add_rpc_method_interface(name, param_def)
158:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 178
178:   def call(name, *params)
179:     set_wiredump_file_base(name)
180:     @proxy.call(name, *params)
181:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 78
78:   def httpproxy
79:     options["protocol.http.proxy"]
80:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 82
82:   def httpproxy=(httpproxy)
83:     options["protocol.http.proxy"] = httpproxy
84:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 74
74:   def inspect
75:     "#<#{self.class}:#{@proxy.inspect}>"
76:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 165
165:   def invoke(headers, body)
166:     if headers and !headers.is_a?(SOAPHeader)
167:       headers = create_header(headers)
168:     end
169:     set_wiredump_file_base(body.elename.name)
170:     env = @proxy.invoke(headers, body)
171:     if env.nil?
172:       return nil, nil
173:     else
174:       return env.header, env.body
175:     end
176:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 118
118:   def loadproperty(propertyname)
119:     unless options.loadproperty(propertyname)
120:       raise LoadError.new("No such property to load -- #{propertyname}")
121:     end
122:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 94
94:   def mandatorycharset
95:     options["protocol.mandatorycharset"]
96:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 98
 98:   def mandatorycharset=(mandatorycharset)
 99:     options["protocol.mandatorycharset"] = mandatorycharset
100:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 86
86:   def wiredump_dev
87:     options["protocol.http.wiredump_dev"]
88:   end

[Source]

    # File lib/soap/rpc/driver.rb, line 90
90:   def wiredump_dev=(wiredump_dev)
91:     options["protocol.http.wiredump_dev"] = wiredump_dev
92:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 102
102:   def wiredump_file_base
103:     options["protocol.wiredump_file_base"]
104:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 106
106:   def wiredump_file_base=(wiredump_file_base)
107:     options["protocol.wiredump_file_base"] = wiredump_file_base
108:   end

Private Instance methods

[Source]

     # File lib/soap/rpc/driver.rb, line 222
222:   def add_document_method_interface(name, param_def)
223:     param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN)
224:     add_method_interface(name, param_count)
225:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 228
228:     def add_method_interface(name, param_count)
229:       ::SOAP::Mapping.define_singleton_method(self, name) do |*arg|
230:         unless arg.size == param_count
231:           raise ArgumentError.new(
232:           "wrong number of arguments (#{arg.size} for #{param_count})")
233:         end
234:         call(name, *arg)
235:       end
236:       self.method(name)
237:     end

[Source]

     # File lib/soap/rpc/driver.rb, line 239
239:     def add_method_interface(name, param_count)
240:       instance_eval "def \#{name}(*arg)\nunless arg.size == \#{param_count}\nraise ArgumentError.new(\n\"wrong number of arguments (\\\#{arg.size} for \#{param_count})\")\nend\ncall(\#{name.dump}, *arg)\nend\n"
241:       self.method(name)
242:     end

[Source]

     # File lib/soap/rpc/driver.rb, line 216
216:   def add_rpc_method_interface(name, param_def)
217:     param_count = RPC::SOAPMethod.param_count(param_def,
218:       RPC::SOAPMethod::IN, RPC::SOAPMethod::INOUT)
219:     add_method_interface(name, param_count)
220:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 191
191:   def create_header(headers)
192:     header = SOAPHeader.new()
193:     headers.each do |content, mustunderstand, encodingstyle|
194:       header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
195:     end
196:     header
197:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 185
185:   def set_wiredump_file_base(name)
186:     if @wiredump_file_base
187:       @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}")
188:     end
189:   end

[Source]

     # File lib/soap/rpc/driver.rb, line 199
199:   def setup_options
200:     if opt = Property.loadproperty(::SOAP::PropertyName)
201:       opt = opt["client"]
202:     end
203:     opt ||= Property.new
204:     opt.add_hook("protocol.mandatorycharset") do |key, value|
205:       @proxy.mandatorycharset = value
206:     end
207:     opt.add_hook("protocol.wiredump_file_base") do |key, value|
208:       @wiredump_file_base = value
209:     end
210:     opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label
211:     opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
212:     opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
213:     opt
214:   end

[Validate]