#include "HelloRequest.hpp"
#include "../../include/XmlRpc.h"
#include "../../responses/HelloResponse.hpp"
#include "../../XmlRpcppClient.hpp"

using namespace mole;
using namespace ctx;
using namespace xmlrpcpp;
using namespace XmlRpc;

xmlrpcpp::HelloRequest::HelloRequest(){}

xmlrpcpp::HelloRequest::~HelloRequest(){}

xmlrpcpp::HelloRequest *
xmlrpcpp::HelloRequest::newRequest(){
    return new xmlrpcpp::HelloRequest();
}

mole::serv::Response *
xmlrpcpp::HelloRequest::execute(Client * c){
    XmlRpcppClient * client = static_cast <XmlRpcppClient *> (c);
    XmlRpcClient * rpcClient = client->getRealClient();
    XmlRpcValue args, result;
    args = text;
    if (rpcClient->execute(name().c_str(), args, result)){
	mole::serv::HelloResponse * resp = new mole::serv::HelloResponse();
	resp->setText(result);
	return resp;
    }
    return NULL;
}
