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.


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

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


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

def options
  @options
end

#proxyObject (readonly)

Returns the value of attribute proxy


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

def proxy
  @proxy
end

#soapactionObject

Returns the value of attribute soapaction


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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

#httpproxyObject


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

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

#httpproxy=(httpproxy) ⇒ Object


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

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

#inspectObject


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

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

#invoke(headers, body) ⇒ Object


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

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


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

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

#mandatorycharsetObject


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

def mandatorycharset
  options["protocol.mandatorycharset"]
end

#mandatorycharset=(mandatorycharset) ⇒ Object


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

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

#wiredump_devObject


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

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

#wiredump_dev=(wiredump_dev) ⇒ Object


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

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

#wiredump_file_baseObject


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

def wiredump_file_base
  options["protocol.wiredump_file_base"]
end

#wiredump_file_base=(wiredump_file_base) ⇒ Object


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

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