我正在尝试对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_title函数,如何在xml_request中填写Data
信息
设置标题
1条答案
按热度按时间14ifxucb1#
我创建了一个文件名
set_title.xml
做了一个
curl request
以下是来自http://xmlrpc.com/的specs