Functions

xmlrpc_clnt_example.cpp File Reference

#include "httpclnt.h"
#include <iostream>
Include dependency graph for xmlrpc_clnt_example.cpp:

Go to the source code of this file.

Functions

static void client_test ()
int main ()

Function Documentation

static void client_test (  ) [static]

Definition at line 42 of file xmlrpc_clnt_example.cpp.

Referenced by main().

{
    const char* url = "http://localhost:8080/";

    XMLRPCClient client(url, _T("XMLStorage XMLRPC"));

     // allow persistent HTTP connections
//  client.enable_extensions();

    ISODate start;

    for(int i=0; i<1; ++i) {
        XMLRPCResult& result1 = client.call(url, XMLRPCCall("examples.getStateName") % 17);
        cout << result1.get_string() << endl;

        XMLRPCResult& result2 = client.call(url, XMLRPCCall("Calculator.add") % 17 % 4);
        cout << result2.get_double() << endl;

        XMLRPCResult& result3 = client.call(url, XMLRPCCall("Calculator.subtract") % 17 % 4);
        cout << result3.get_int() << endl;

        XMLRPCResult& result4 = client.call(url, XMLRPCCall("examples.getArray") % 41 % "test" % 3.14 % false);
        const XMLRPCArray& arr = result4.get_array();
        for(XMLRPCArray::const_iterator it_arr=arr.begin(); it_arr!=arr.end(); ++it_arr)
            cout << *it_arr << endl;

        XMLRPCResult& result5 = client.call(url, XMLRPCCall("examples.getStruct") % "A" % "B" % "C");
        const XMLRPCStruct& str = result5.get_struct();
        for(XMLRPCStruct::const_iterator it_str=str.begin(); it_str!=str.end(); ++it_str)
            cout << it_str->first << "=" << it_str->second << endl;

        XMLRPCResult& result6 = client.call(url, XMLRPCCall("examples.transferBinary") % Binary("Hello binary world", 18));
        cout << result6.get_string() << endl;

        XMLRPCResult& result7 = client.call(url, XMLRPCCall("examples.readBinary"));
        cout << result7.get_binary().str() << endl;

        XMLRPCResult& last_result = client.call(url, XMLRPCCall("examples.getTime"));
        ISODate now = last_result.get_date();
        cout << now.str() << endl;

        XMLRPCResult& result_time = client.call(url, XMLRPCCall("Calculator.subtract") % now % start);
        cout << result_time.get_int() << " Sekunden Laufzeit" << endl;
    }
}

Here is the caller graph for this function:

int main (  )

Definition at line 89 of file xmlrpc_clnt_example.cpp.

References client_test().

{
    try {
        client_test();
    } catch(exception& e) {
        cerr << endl << e.what() << endl;
    }

    return 0;
}

Here is the call graph for this function: