【发布时间】:2022-11-14 18:56:41
【问题描述】:
我正在尝试为 c++ xml-rpc 服务器发出 curl 请求。经过一番阅读,我知道使用 curl 的 xml-rpc 请求看起来像这样
curl --connect-timeout 10 -d'
<xml request>
' -H 'Content-type:text/xml' https://<Billing Core server>:<Port>/RPC2
就我而言,它将是
curl --connect-timeout 10 -d'
<xml request>
' -H 'Content-type:text/xml' https://127.0.0.1:40405/RPC2
我不知道如何填写<xml request> 和xml_rpc c++ 代码看起来像这样
class Data {
public:
Data();
~Data();
std::string getTitle() const;
void setTitle(std::string title);
std::string getMessage(std::string name) const;
private:
std::string title;
};
class SetTitle: public xmlrpc_c::method {
public:
SetTitle(Data* data);
void execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value * const retvalP);
private:
SetTitle(); // Hereby disabled
Data* data;
};
void SetTitle::execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value * const retvalP) {
string const title(paramList.getString(0));
paramList.verifyEnd(1);
data->setTitle(title);
*retvalP = xmlrpc_c::value_string(title); // XML-RPC void return values are an extension to the protocol and not always available or compatible between languages.
}
serviceRegistry.addMethod("set_title", new SetTitle(data));
如何创建 xml_request ?我想调用 set_tittle 函数。如何在xml_request中填写Data信息
【问题讨论】:
标签: c++ curl xml-rpc xmlrpcclient