I started off passing back a single SQL record to my xmlrpc client
using the following code on the xmlrpc server:
resultSet = query.fetch.to_a
return resultSet
Now I am looking to pass along an SQL recordset to my xmlrpc client. So
I tried the following code on the xmlrpc server:
resultSet = query.fetch_all.to_a
return resultSet
But the xmlrpc client end reports an HTTP 500 Internal Server error
when parsing this SQL recordset data back. I am using code like the
following on the xmlrpc client:
resultSet.collect {|line|
puts line
}
What should I do on the xmlrpc client end to correctly interpret the
results? When I print them to the console on the xmlrpc server I can
tell the SQL recordset is being passed back to the xmlrpc client as a
two dimensional array...
maybe you need to convert each single record to an array first, like
query.fetch_all.map { |record| record.to_a }
Just a guess...
Regards,
Pit
Digging deeper into the docs I see that xmlrpc can only handle a one
dimensional array being passed back to the client. So what I did was
pass back string values with ';' row delimiters and ',' record
delimiters. Then the client parses this out to in turn shuffle them
into the two-dimensional array I was looking for. The code is too ugly
to post here due to my clumsiness but it works!