Class: SOAP::RPC::Driver

Inherits:
Object show all
Includes:
AttrProxy
Defined in:
lib/soap/rpc/driver.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttrProxy

included

Constructor Details

#initialize(endpoint_url, namespace = nil, soapaction = nil) ⇒ Driver

Returns a new instance of Driver.



95
96
97
98
99
100
101
102
103
# 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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



43
44
45
# File 'lib/soap/rpc/driver.rb', line 43

def options
  @options
end

#proxyObject (readonly)

Returns the value of attribute proxy.



42
43
44
# File 'lib/soap/rpc/driver.rb', line 42

def proxy
  @proxy
end

#soapactionObject

Returns the value of attribute soapaction.



44
45
46
# File 'lib/soap/rpc/driver.rb', line 44

def soapaction
  @soapaction
end

Class Method Details

.http_loggerObject

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



50
51
52
# File 'lib/soap/rpc/driver.rb', line 50

def http_logger
  @@http_logger ||= nil
end

.http_logger=(http_logger) ⇒ Object



54
55
56
# File 'lib/soap/rpc/driver.rb', line 54

def http_logger=(http_logger)
  @@http_logger = http_logger
end

Instance Method Details

#add_document_method(name, soapaction, req_qname, res_qname) ⇒ Object



136
137
138
139
140
# 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 = {}) ⇒ Object



147
148
149
150
# 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_rpc_method(name, *params) ⇒ Object Also known as: add_method



111
112
113
# 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

#add_rpc_method_as(name, name_as, *params) ⇒ Object Also known as: add_method_as



115
116
117
# 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

#add_rpc_method_with_soapaction(name, soapaction, *params) ⇒ Object Also known as: add_method_with_soapaction



119
120
121
# 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

#add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params) ⇒ Object Also known as: add_method_with_soapaction_as



123
124
125
126
127
128
# 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

#add_rpc_operation(qname, soapaction, name, param_def, opt = {}) ⇒ Object



142
143
144
145
# 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) ⇒ Object



165
166
167
168
# File 'lib/soap/rpc/driver.rb', line 165

def call(name, *params)
  set_wiredump_file_base(name)
  @proxy.call(name, *params)
end

#httpproxyObject



63
64
65
# File 'lib/soap/rpc/driver.rb', line 63

def httpproxy
  options["protocol.http.proxy"]
end

#httpproxy=(httpproxy) ⇒ Object



67
68
69
# File 'lib/soap/rpc/driver.rb', line 67

def httpproxy=(httpproxy)
  options["protocol.http.proxy"] = httpproxy
end

#inspectObject



59
60
61
# File 'lib/soap/rpc/driver.rb', line 59

def inspect
  "#<#{self.class}:#{@proxy.inspect}>"
end

#invoke(headers, body) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
# 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) ⇒ Object



105
106
107
108
109
# 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

#mandatorycharsetObject



79
80
81
# File 'lib/soap/rpc/driver.rb', line 79

def mandatorycharset
  options["protocol.mandatorycharset"]
end

#mandatorycharset=(mandatorycharset) ⇒ Object



83
84
85
# File 'lib/soap/rpc/driver.rb', line 83

def mandatorycharset=(mandatorycharset)
  options["protocol.mandatorycharset"] = mandatorycharset
end

#wiredump_devObject



71
72
73
# File 'lib/soap/rpc/driver.rb', line 71

def wiredump_dev
  options["protocol.http.wiredump_dev"]
end

#wiredump_dev=(wiredump_dev) ⇒ Object



75
76
77
# File 'lib/soap/rpc/driver.rb', line 75

def wiredump_dev=(wiredump_dev)
  options["protocol.http.wiredump_dev"] = wiredump_dev
end

#wiredump_file_baseObject



87
88
89
# File 'lib/soap/rpc/driver.rb', line 87

def wiredump_file_base
  options["protocol.wiredump_file_base"]
end

#wiredump_file_base=(wiredump_file_base) ⇒ Object



91
92
93
# File 'lib/soap/rpc/driver.rb', line 91

def wiredump_file_base=(wiredump_file_base)
  options["protocol.wiredump_file_base"] = wiredump_file_base
end