reference: XmlRpcCall, XmlRpcSever, XmlRpcClient

git-svn-id: svn://ultimatepp.org/upp/trunk@1822 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-12-20 20:27:56 +00:00
commit 52f85319ad
10 changed files with 167 additions and 0 deletions

View file

@ -0,0 +1,12 @@
description "XML-RPC simple server\377";
uses
Core,
XmlRpc;
file
XmlRpcSrvTst.cpp;
mainconfig
"" = "";

View file

@ -0,0 +1,43 @@
#include <XmlRpc/XmlRpc.h>
using namespace Upp;
XMLRPC_METHOD(compute)
{
double a, b;
String op;
rpc >> a >> op >> b;
Cout() << "Request: " << a << op << b << '\n';
if(op.GetCount() == 1)
switch(*op) {
case '+':
rpc << a + b;
return;
case '-':
rpc << a - b;
return;
case '/':
if(b == 0)
rpc << ErrorValue("division by zero");
else
rpc << a / b;
return;
case '*':
rpc << a * b;
return;
}
rpc << ErrorValue("unknown operator");
}
XMLRPC_METHOD(ping)
{
rpc << GetSysTime();
}
namespace Upp { extern bool HttpClient_Trace__; }
CONSOLE_APP_MAIN
{
Cout() << "Server..\n";
XmlRpcServer(1234);
}

View file

@ -0,0 +1,5 @@
#ifndef _XmlRpcSrvTst_icpp_init_stub
#define _XmlRpcSrvTst_icpp_init_stub
#include "Core/init"
#include "XmlRpc/init"
#endif