Class: SOAP::RPC::Driver

Inherits:
Object show all
Defined in:
lib/action_web_service/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.



108
109
110
111
112
113
114
# File 'lib/action_web_service/soap/rpc/driver.rb', line 108

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.



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

def options
  @options
end

#proxyObject (readonly)

Returns the value of attribute proxy.



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

def proxy
  @proxy
end

#soapactionObject

Returns the value of attribute soapaction.



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

def soapaction
  @soapaction
end

Instance Method Details

#__attr_proxy(symbol, assignable = false) ⇒ Object



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

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



147
148
149
150
151
# File 'lib/action_web_service/soap/rpc/driver.rb', line 147

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



158
159
160
161
# File 'lib/action_web_service/soap/rpc/driver.rb', line 158

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



122
123
124
# File 'lib/action_web_service/soap/rpc/driver.rb', line 122

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



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

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



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

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



134
135
136
137
138
139
# File 'lib/action_web_service/soap/rpc/driver.rb', line 134

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



153
154
155
156
# File 'lib/action_web_service/soap/rpc/driver.rb', line 153

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



176
177
178
179
# File 'lib/action_web_service/soap/rpc/driver.rb', line 176

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

#httpproxyObject



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

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

#httpproxy=(httpproxy) ⇒ Object



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

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

#inspectObject



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

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

#invoke(headers, body) ⇒ Object



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

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



116
117
118
119
120
# File 'lib/action_web_service/soap/rpc/driver.rb', line 116

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

#mandatorycharsetObject



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

def mandatorycharset
  options["protocol.mandatorycharset"]
end

#mandatorycharset=(mandatorycharset) ⇒ Object



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

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

#wiredump_devObject



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

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

#wiredump_dev=(wiredump_dev) ⇒ Object



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

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

#wiredump_file_baseObject



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

def wiredump_file_base
  options["protocol.wiredump_file_base"]
end

#wiredump_file_base=(wiredump_file_base) ⇒ Object



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

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