Overview
Examples
Screenshots
Comparisons
Applications
Download
Manual
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Language
English











SourceForge.net Logo



XmlRpcCall

 

Using XmlRpc with public XmlRpc server

 

 

main.cpp

 

#include <XmlRpc/XmlRpc.h>

 

using namespace Upp;

 

struct FoxResult {

    bool   flerror;

    double amount;

    String message;

    

    void Map(ValueMapper& m) {

        m("flerror", flerror)("amount", amount)("message", message);

    }

};

 

XMLRPC_STRUCT(FoxResult)

 

CONSOLE_APP_MAIN

{

    StdLogSetup(LOG_COUT|LOG_FILE);

    XmlRpcRequest xr("http://foxrate.org/rpc");

    xr.Method("foxrate.currencyConvert") << "USD" << "GBP" << 120;

    Value v = xr.Execute();

    if(v.IsError())

        LOG("Error: " << v);

    else

        if(v["flerror"] == 0)

            LOG(v["amount"]);

        else

            LOG("Failed.");

 

    FoxResult r;

    if(XmlRpcRequest("http://foxrate.org/rpc").Method("foxrate.currencyConvert")

          << "USD" << "GBP" << 120

          >> r)

        if(r.flerror)

            LOG("Server reported erro");

        else

            LOG(r.amount);

    else

        LOG("Failed.");

}

 

 

 

 

This page is also in català, čeština, deutsch, español, euskara, français, română, русский, 中文(简体) and 中文(繁體). Do you want to contribute?