Reputation: 1599
I'm working on some code using XML RPC in ruby and need to see some debug info, how do you do that?
Upvotes: 9
Views: 2101
Reputation: 117507
Fine answer here, but do note that the http-level dump may often be gzip encoded and thus not very good for debugging through. Another option is to use client.http_last_response
. E.g.:
server = XMLRPC::Client.new2("http://rpc.technorati.com/rpc/ping")
result = server.call("weblogUpdates.ping", "Copenhagen.rb", "http://www.copenhagenrb.dk/")
puts server.http_last_response.body
Upvotes: 0
Reputation: 5107
Reading the source of the package, XMLRPC::Client uses Net::HTTP in turn as its transport.
So I think you should be able to monkey-patch a method into the XMLRPC::Client accordingly:
require 'pp'
# the magic happens here
class XMLRPC::Client
def set_debug
@http.set_debug_output($stderr);
end
end
server = XMLRPC::Client.new2("http://rpc.technorati.com/rpc/ping")
server.set_debug
result = server.call("weblogUpdates.ping", "Copenhagen.rb", "http://www.copenhagenrb.dk/")
pp result
(sample for XMLRPC snarfed from here).
Upvotes: 20