Kunal Wadhawe - 2010-03-26

Hi,
I am trying to get a LINUX (RHEL5 x86_64) machine's system stats using c++ using xmlrpc-c (ver 1.21.1) library.

Here's the code:

#include <cstdlib>
#include <string>
#include <iostream>
#include <xmlrpc-c/girerr.hpp>
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/client_simple.hpp>
using namespace std;
int
main(int argc, char **) {
    if (argc-1 > 0) {
        cerr << "This program has no arguments" << endl;
        exit(1);
    }
    try {
        string const serverUrl("http://root:PASSWORD@192.168.46.91:10000/xmlrpc.cgi");
        string const methodName("system-status.get_collected_info");
        xmlrpc_c::clientSimple myClient;
        xmlrpc_c::value result;
        myClient.call(serverUrl, methodName, "n", &result);
//        int const sum = xmlrpc_c::value_int(result);
            // Assume the method returned an integer; throws error if not
        cout << "Type is: " << result.type() << endl;
    } catch (exception const& e) {
        cerr << "Client threw error: " << e.what() << endl;
    } catch (...) {
        cerr << "Client threw unexpected error." << endl;
    }
    return 0;
}

But I am not getting correct response. As per the error xmlrpc-c threw "Client threw error: Response XML from server is not valid XML-RPC response.  Unable to find XML-RPC response in what server sent back.  <int> value -1739159552 is above the range allowed by XML-RPC (maximum is 2147483647)"

I have tried with JAVA (with Apache xmlrpc-2.0.1.jar ) too. And the result is the same.

Some methods (system-status.get_collected_info, useradmin.list_users) give this problem while others (useradmin.logged_in_users) do not.

TIA,
Kunal.