XML-RPC is yet another method of implementing remote procedure calls. It used XML over HTTP to transmit data. In my past live working at TLO I used XML-RPC-C library to implement communication between cluster nodes and a cluster management system. I thought the library was well designed and easy to use so I wanted to introduce you to it.

Below is a simple client and server implementation using the XML-RPC-C library. The server implements one RPC that accepts one string parameter and returns one string. The client makes the call to the server saying hello and prints the reply. The code is easy to read and does not need any further explanation 🙂

The client. xmlrpc_c.cpp:

The server. xmlrpc_s.cpp:

8 Replies to “XML-RPC”

  1. Just a few nitpicks on the code:

    Arguments to

    main

    are declared but not used.

    return 1

    ;

    for

    main

    is needlessly using a not generally supported value, 1. The generally supported

    main

    return values are

    0

    ,

    EXIT_SUCCESS

    , which is usually defined as

    0

    , and

    EXIT_FAILURE

    , which is usually defined as

    1

    . Reportedly, in OpenVMS return value 1 denotes *success*, while in Unix (including MacOS) and Windows it denotes *failure*. Just remove that

    return

    . There is a default for

    main`, namely, that it returns 0, denoting success, by default.

    1. So you’re saying I shouldn’t name unused

      main

      arguments, and let it return by default? Like this:

        1. Use pre tags for code blocks, and code tags for inline code.

          #include "example_inline.h"

          btw, i though the only standard compliant signature for main was int main(int, char**). the one without any parameters is non standard. am i wrong?

Leave a Reply