class SOAP::RPC::Driver
Attributes
options[R]
proxy[R]
soapaction[RW]
Public Class Methods
http_logger()
click to toggle source
http logger should be set once on initialization It should be a subclass of SOAP::HttpLogger
, for example: SPA::RPC::Driver.http_logger = SOAP::SimpleHttpLogger.new
# File lib/soap/rpc/driver.rb, line 50 def http_logger @@http_logger ||= nil end
http_logger=(http_logger)
click to toggle source
# File lib/soap/rpc/driver.rb, line 54 def http_logger=(http_logger) @@http_logger = http_logger end
new(endpoint_url, namespace = nil, soapaction = nil)
click to toggle source
# File lib/soap/rpc/driver.rb, line 95 def initialize(endpoint_url, namespace = nil, soapaction = nil) @namespace = namespace @soapaction = soapaction @options = setup_options @wiredump_file_base = nil @proxy = Proxy.new(endpoint_url, @soapaction, @options) @proxy.driver_class = self.class @proxy.http_logger = self.class.http_logger end
Public Instance Methods
add_document_method(name, soapaction, req_qname, res_qname)
click to toggle source
# File lib/soap/rpc/driver.rb, line 136 def add_document_method(name, soapaction, req_qname, res_qname) param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname) @proxy.add_document_method(soapaction, name, param_def) add_document_method_interface(name, param_def) end
add_document_operation(soapaction, name, param_def, opt = {})
click to toggle source
# File lib/soap/rpc/driver.rb, line 147 def add_document_operation(soapaction, name, param_def, opt = {}) @proxy.add_document_operation(soapaction, name, param_def, opt) add_document_method_interface(name, param_def) end
add_method(name, *params)
add_method
is for shortcut of typical rpc/encoded method definition.
Alias for: add_rpc_method
add_method_with_soapaction_as(name, name_as, soapaction, *params)
Alias for: add_rpc_method_with_soapaction_as
add_rpc_method(name, *params)
click to toggle source
# File lib/soap/rpc/driver.rb, line 111 def add_rpc_method(name, *params) add_rpc_method_with_soapaction_as(name, name, @soapaction, *params) end
Also aliased as: add_method
add_rpc_method_as(name, name_as, *params)
click to toggle source
# File lib/soap/rpc/driver.rb, line 115 def add_rpc_method_as(name, name_as, *params) add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params) end
Also aliased as: add_method_as
add_rpc_method_with_soapaction(name, soapaction, *params)
click to toggle source
# File lib/soap/rpc/driver.rb, line 119 def add_rpc_method_with_soapaction(name, soapaction, *params) add_rpc_method_with_soapaction_as(name, name, soapaction, *params) end
Also aliased as: add_method_with_soapaction
add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
click to toggle source
# File lib/soap/rpc/driver.rb, line 123 def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params) param_def = SOAPMethod.create_rpc_param_def(params) qname = XSD::QName.new(@namespace, name_as) @proxy.add_rpc_method(qname, soapaction, name, param_def) add_rpc_method_interface(name, param_def) end
Also aliased as: add_method_with_soapaction_as
add_rpc_operation(qname, soapaction, name, param_def, opt = {})
click to toggle source
# File lib/soap/rpc/driver.rb, line 142 def add_rpc_operation(qname, soapaction, name, param_def, opt = {}) @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt) add_rpc_method_interface(name, param_def) end
call(name, *params)
click to toggle source
# File lib/soap/rpc/driver.rb, line 165 def call(name, *params) set_wiredump_file_base(name) @proxy.call(name, *params) end
httpproxy()
click to toggle source
# File lib/soap/rpc/driver.rb, line 63 def httpproxy options["protocol.http.proxy"] end
httpproxy=(httpproxy)
click to toggle source
# File lib/soap/rpc/driver.rb, line 67 def httpproxy=(httpproxy) options["protocol.http.proxy"] = httpproxy end
inspect()
click to toggle source
# File lib/soap/rpc/driver.rb, line 59 def inspect "#<#{self.class}:#{@proxy.inspect}>" end
invoke(headers, body)
click to toggle source
# File lib/soap/rpc/driver.rb, line 152 def invoke(headers, body) if headers and !headers.is_a?(SOAPHeader) headers = create_header(headers) end set_wiredump_file_base(body.elename.name) env = @proxy.invoke(headers, body) if env.nil? return nil, nil else return env.header, env.body end end
loadproperty(propertyname)
click to toggle source
# File lib/soap/rpc/driver.rb, line 105 def loadproperty(propertyname) unless options.loadproperty(propertyname) raise LoadError.new("No such property to load -- #{propertyname}") end end
mandatorycharset()
click to toggle source
# File lib/soap/rpc/driver.rb, line 79 def mandatorycharset options["protocol.mandatorycharset"] end
mandatorycharset=(mandatorycharset)
click to toggle source
# File lib/soap/rpc/driver.rb, line 83 def mandatorycharset=(mandatorycharset) options["protocol.mandatorycharset"] = mandatorycharset end
wiredump_dev()
click to toggle source
# File lib/soap/rpc/driver.rb, line 71 def wiredump_dev options["protocol.http.wiredump_dev"] end
wiredump_dev=(wiredump_dev)
click to toggle source
# File lib/soap/rpc/driver.rb, line 75 def wiredump_dev=(wiredump_dev) options["protocol.http.wiredump_dev"] = wiredump_dev end
wiredump_file_base()
click to toggle source
# File lib/soap/rpc/driver.rb, line 87 def wiredump_file_base options["protocol.wiredump_file_base"] end
wiredump_file_base=(wiredump_file_base)
click to toggle source
# File lib/soap/rpc/driver.rb, line 91 def wiredump_file_base=(wiredump_file_base) options["protocol.wiredump_file_base"] = wiredump_file_base end
Private Instance Methods
add_document_method_interface(name, param_def)
click to toggle source
# File lib/soap/rpc/driver.rb, line 213 def add_document_method_interface(name, param_def) param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN) add_method_interface(name, param_count) end
add_method_interface(name, param_count)
click to toggle source
Mapping.define_singleton_method
calls define_method with proc and it exhausts much memory for each singleton Object
. just instance_eval instead of it.
# File lib/soap/rpc/driver.rb, line 221 def add_method_interface(name, param_count) instance_eval <<-EOS def #{name}(*arg) unless arg.size == #{param_count} raise ArgumentError.new( "wrong number of arguments (\#{arg.size} for #{param_count})") end call(#{name.dump}, *arg) end EOS self.method(name) end
add_rpc_method_interface(name, param_def)
click to toggle source
# File lib/soap/rpc/driver.rb, line 207 def add_rpc_method_interface(name, param_def) param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN, RPC::SOAPMethod::INOUT) add_method_interface(name, param_count) end
attrproxy()
click to toggle source
# File lib/soap/rpc/driver.rb, line 172 def attrproxy @proxy end
create_header(headers)
click to toggle source
# File lib/soap/rpc/driver.rb, line 182 def create_header(headers) header = SOAPHeader.new() headers.each do |content, mustunderstand, encodingstyle| header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle)) end header end
set_wiredump_file_base(name)
click to toggle source
# File lib/soap/rpc/driver.rb, line 176 def set_wiredump_file_base(name) if @wiredump_file_base @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}") end end
setup_options()
click to toggle source
# File lib/soap/rpc/driver.rb, line 190 def setup_options if opt = Property.loadproperty(::SOAP::PropertyName) opt = opt["client"] end opt ||= Property.new opt.add_hook("protocol.mandatorycharset") do |key, value| @proxy.mandatorycharset = value end opt.add_hook("protocol.wiredump_file_base") do |key, value| @wiredump_file_base = value end opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label opt["protocol.http.proxy"] ||= Env::HTTP_PROXY opt["protocol.http.no_proxy"] ||= Env::NO_PROXY opt end