17{
18 if (argc != 4) {
19 std::cerr << "Usage: FileClient serverHost serverPort requestXmlFile\n";
20 return -1;
21 }
22 int port = atoi(argv[2]);
23
26
27
28 std::ifstream infile(argv[3]);
29 if (infile.fail()) {
30 std::cerr << "Could not open file '" << argv[3] << "'.\n";
31 return -1;
32 }
33
34
35 infile.seekg(0L, std::ios::end);
36 long nb = infile.tellg();
37 infile.clear();
38 infile.seekg(0L);
39 char* b = new char[nb+1];
40 infile.read(b, nb);
41 b[nb] = 0;
42
43 std::cout << "Read file.\n";
44
45
49
50 if (name.empty()) {
51 std::cerr << "Could not parse file\n";
52 return -1;
53 }
54
55 for (;;) {
57 std::cout << "Calling " << name << std::endl;
58 if (c.execute(name.c_str(), params, result))
59 std::cout << result << "\n\n";
60 else
61 std::cout << "Error calling '" << name << "'\n\n";
62 std::cout << "Again? [y]: ";
63 std::string ans;
64 std::cin >> ans;
65 if (ans != "" && ans != "y") break;
66 }
67
68 return 0;
69}
std::string parseRequest(std::string const &xml, XmlRpcValue ¶ms)
A class to send XML RPC requests to a server and return the results.
RPC method arguments and results are represented by Values.
void setVerbosity(int level)
Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)