A command-line client for interacting with "book" and "member" servers via XMLRPC calls. Servers were created by other students.

xmlrpc_server.cpp 978B

    #include <cassert> #include <xmlrpc-c/base.hpp> #include <xmlrpc-c/registry.hpp> #include <xmlrpc-c/server_abyss.hpp> using namespace std; class sampleAddMethod : public xmlrpc_c::method { public: sampleAddMethod() {} void execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value * const retvalP) { int const addend(paramList.getInt(0)); int const adder(paramList.getInt(1)); paramList.verifyEnd(2); *retvalP = xmlrpc_c::value_int(addend + adder); } }; int main(int const argc, const char** argv) { xmlrpc_c::registry myRegistry; xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod); myRegistry.addMethod("sample.add", sampleAddMethodP); xmlrpc_c::serverAbyss myAbyssServer( myRegistry, 8080, // TCP port on which to listen "/tmp/xmlrpc_log" // Log file ); myAbyssServer.run(); // xmlrpc_c::serverAbyss.run() never returns assert(false); return 0; }