16 int main(
int argc,
char* argv[])
19 std::cerr <<
"Usage: FileClient serverHost serverPort requestXmlFile\n";
22 int port = atoi(argv[2]);
28 std::ifstream infile(argv[3]);
30 std::cerr <<
"Could not open file '" << argv[3] <<
"'.\n";
35 infile.seekg(0L, std::ios::end);
36 long nb = infile.tellg();
39 char* b =
new char[nb+1];
43 std::cout <<
"Read file.\n";
51 std::cerr <<
"Could not parse file\n";
57 std::cout <<
"Calling " << name << std::endl;
58 if (c.
execute(name.c_str(), params, result))
59 std::cout << result <<
"\n\n";
61 std::cout <<
"Error calling '" << name <<
"'\n\n";
62 std::cout <<
"Again? [y]: ";
65 if (ans !=
"" && ans !=
"y")
break;
76 const char METHODNAME_TAG[] =
"<methodName>";
77 const char PARAMS_TAG[] =
"<params>";
78 const char PARAMS_ETAG[] =
"</params>";
79 const char PARAM_TAG[] =
"<param>";
80 const char PARAM_ETAG[] =
"</param>";
85 XmlRpcUtil::log(3,
"XmlRpcServerConnection::parseRequest: parsed methodName %s.", methodName.c_str());
91 std::cout <<
"Parsing arg " << nArgs+1 << std::endl;
94 std::cerr <<
"Invalid argument\n";
97 std::cout <<
"Adding arg " << nArgs+1 <<
" to params array." << std::endl;
98 params[nArgs++] = arg;
102 XmlRpcUtil::log(3,
"XmlRpcServerConnection::parseRequest: parsed %d params.", nArgs);
std::string parseRequest(std::string const &xml, XmlRpcValue ¶ms)
RPC method arguments and results are represented by Values.
static std::string parseTag(const char *tag, std::string const &xml, int *offset)
bool valid() const
Return true if the value has been set to something.
static bool findTag(const char *tag, std::string const &xml, int *offset)
Returns true if the tag is found and updates offset to the char after the tag.
XMLRPCPP_DECL void setVerbosity(int level)
Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level) ...
A class to send XML RPC requests to a server and return the results.
bool execute(const char *method, XmlRpcValue const ¶ms, XmlRpcValue &result)
int main(int argc, char *argv[])
static void log(int level, const char *fmt,...)
Dump messages somewhere.
static bool nextTagIs(const char *tag, std::string const &xml, int *offset)