From: Daniel Berger Date: 2002-10-22T00:57:45+09:00 Subject: XMLRPC and complex data structures Hi all, Ruby 1.6.7, REXML 2.4.2, Sys/ProcTable 3.1, XML-RPC 1.7.11 I'm getting the dreaded "Internal Server Error" when I try to return an array of structs within a handler. Here's the code: require "xmlrpc/server" require "sys/proctable" include Sys class Test def add(a,b) a + b end def ps a = [] a = ProcTable.ps # This fails #ProcTable.ps{|struct| a.push(struct.pid)} # This works return a end end server = XMLRPC::Server.new(8889,"1.2.3.4",4,$stdout) # Use a real IP server.add_handler("test",Test.new) server.serve The ProcTable.ps call returns an array of structs in lvalue context, and that seems to be the problem. I also tried just returning a list of pid's and that worked fine. The "add" method also works fine (I just threw that in for testing purposes). Here's the actual client code: require "xmlrpc/client" client = XMLRPC::Client.new("1.2.3.4",nil,8889) # Use a real IP begin v = client.call("test.ps") rescue RuntimeError => e puts "Error:" puts e.faultCode puts e.faultString rescue XMLRPC::FaultException => e puts "Error:" puts e.faultCode puts e.faultString end Here's the RuntimeError message: >ruby xmlrpcClientTest.rb Error: xmlrpcClientTest.rb:9: undefined method `faultCode' for # (NameError) Any ideas? Regards, Dan