15 {
16 if ( argc != 4 )
17 {
18 std::cerr << "Usage: FileClient serverHost serverPort requestXmlFile\n";
19 return -1;
20 }
21 int port = atoi( argv[2] );
22
25
26
27 std::ifstream infile( argv[3] );
28 if ( infile.fail() )
29 {
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 {
52 std::cerr << "Could not parse file\n";
53 return -1;
54 }
55
56 for ( ;; )
57 {
59 std::cout << "Calling " << name << std::endl;
60 if ( c.execute( name.c_str(), params, result ) ) std::cout << result << "\n\n";
61 else 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).