def call method, desc, this, params
fail "this is not a managed object" unless this.is_a? BasicTypes::ManagedObject
fail "parameters must be passed as a hash" unless params.is_a? Hash
fail unless desc.is_a? Hash
t1 = Time.now
body = soap_envelope do |xml|
emit_request xml, method, desc['params'], this, params
end.target!
t2 = Time.now
resp, resp_size = request "#{@ns}/#{@rev}", body
t3 = Time.now
out = parse_response resp, desc['result']
if @profiling
t4 = Time.now
@profile[method] ||= []
profile_info = {
:network_latency => (t3 - t2),
:request_emit => t2 - t1,
:response_parse => t4 - t3,
:params => params,
:obj => this,
:backtrace => caller,
:request_size => body.length,
:response_size => resp_size,
}
@profile[method] << profile_info
@profile_summary[:network_latency] += profile_info[:network_latency]
@profile_summary[:response_parse] += profile_info[:response_parse]
@profile_summary[:request_emit] += profile_info[:request_emit]
@profile_summary[:num_calls] += 1
end
out
end