Class: VimSdk::Soap::SoapResponseDeserializer
Instance Method Summary
collapse
#end_element_namespace, #namespace_and_wsdl_name, #start_element_namespace
Constructor Details
Returns a new instance of SoapResponseDeserializer.
252
253
254
255
256
|
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 252
def initialize(stub)
super
@stub = stub
@deserializer = SoapDeserializer.new(stub)
end
|
Instance Method Details
#characters(string) ⇒ Object
294
295
296
|
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 294
def characters(string)
@data += string
end
|
#deserialize(contents, result_type, namespace_map = nil) ⇒ Object
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 258
def deserialize(contents, result_type, namespace_map = nil)
@result_type = result_type
@stack = []
@message = ""
@data = ""
@deserializer.result = nil
@is_fault = false
@delegated_document = DelegatedDocument.new(self)
@parser = Nokogiri::XML::SAX::Parser.new(@delegated_document)
@namespace_map = namespace_map || {}
@parser.parse(contents)
result = @deserializer.result
if @is_fault
result = Vmodl::RuntimeFault.new if result.nil?
result.msg = @message
end
result
end
|
#end_namespaced_element(name) ⇒ Object
288
289
290
291
292
|
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 288
def end_namespaced_element(name)
if @is_fault && name[1] == "faultstring"
@message = @data
end
end
|
#start_namespaced_element(name, attrs = {}) ⇒ Object
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 277
def start_namespaced_element(name, attrs = {})
@data = ""
if name == [XMLNS_SOAPENV, "Fault"]
@is_fault = true
elsif @is_fault && name[1] == "detail"
@deserializer.deserialize(@delegated_document, Class, true, @namespace_map)
elsif name[1] =~ /Response$/
@deserializer.deserialize(@delegated_document, @result_type, false, @namespace_map)
end
end
|