Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a wiredump of XMLRPC::Client in ruby?

Tags:

xml

ruby

xml-rpc

I'm working on some code using XML RPC in ruby and need to see some debug info, how do you do that?

like image 605
bwizzy Avatar asked Aug 12 '09 00:08

bwizzy


1 Answers

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).

like image 66
Andrew Y Avatar answered Oct 13 '22 18:10

Andrew Y