Class: SOAP::RPC::Driver

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Driver.



111
112
113
114
115
116
117
# File 'lib/soap/rpc/driver.rb', line 111

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)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#proxyObject (readonly)

Returns the value of attribute proxy.



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

def proxy
  @proxy
end

#soapactionObject

Returns the value of attribute soapaction.



73
74
75
# File 'lib/soap/rpc/driver.rb', line 73

def soapaction
  @soapaction
end

Instance Method Details

#__attr_proxy(symbol, assignable = false) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/soap/rpc/driver.rb', line 26

def __attr_proxy(symbol, assignable = false)
  name = symbol.to_s
  define_method(name) {
    @proxy.__send__(name)
  }
  if assignable
    aname = name + '='
    define_method(aname) { |rhs|
      @proxy.__send__(aname, rhs)
    }
  end
end

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



150
151
152
153
154
# File 'lib/soap/rpc/driver.rb', line 150

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



161
162
163
164
# File 'lib/soap/rpc/driver.rb', line 161

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



125
126
127
# File 'lib/soap/rpc/driver.rb', line 125

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



129
130
131
# File 'lib/soap/rpc/driver.rb', line 129

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



133
134
135
# File 'lib/soap/rpc/driver.rb', line 133

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



137
138
139
140
141
142
# File 'lib/soap/rpc/driver.rb', line 137

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



156
157
158
159
# File 'lib/soap/rpc/driver.rb', line 156

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



179
180
181
182
# File 'lib/soap/rpc/driver.rb', line 179

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

#httpproxyObject



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

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

#httpproxy=(httpproxy) ⇒ Object



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

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

#inspectObject



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

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

#invoke(headers, body) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/soap/rpc/driver.rb', line 166

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



119
120
121
122
123
# File 'lib/soap/rpc/driver.rb', line 119

def loadproperty(propertyname)
  unless options.loadproperty(propertyname)
    raise LoadError.new("No such property to load -- #{propertyname}")
  end
end

#mandatorycharsetObject



95
96
97
# File 'lib/soap/rpc/driver.rb', line 95

def mandatorycharset
  options["protocol.mandatorycharset"]
end

#mandatorycharset=(mandatorycharset) ⇒ Object



99
100
101
# File 'lib/soap/rpc/driver.rb', line 99

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

#wiredump_devObject



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

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

#wiredump_dev=(wiredump_dev) ⇒ Object



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

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

#wiredump_file_baseObject



103
104
105
# File 'lib/soap/rpc/driver.rb', line 103

def wiredump_file_base
  options["protocol.wiredump_file_base"]
end

#wiredump_file_base=(wiredump_file_base) ⇒ Object



107
108
109
# File 'lib/soap/rpc/driver.rb', line 107

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