I am trying to make a curl request for a c++ xml-rpc server. After a bit of reading, I came to know the xml-rpc request using curl will look like this
curl --connect-timeout 10 -d'
<xml request>
' -H 'Content-type:text/xml' https://<Billing Core server>:<Port>/RPC2
In my case it will be
curl --connect-timeout 10 -d'
<xml request>
' -H 'Content-type:text/xml' https://127.0.0.1:40405/RPC2
I am not sure how to fill in <xml request>
and xml_rpc c++ code looks like this
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));
How to create xml_request ? I would like to call set_tittle function. How to fill in Data
information in xml_request
I created a file name set_title.xml
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>set_title</methodName>
<params>
<param>
<value>
<string>BhanuKiran</string>
</value>
</param>
</params>
</methodCall>
And made a curl request
curl -H "Content-Type: text/xml" -d @set_title.xml -X POST http://127.0.0.1:40405/RPC2 -v
Here are specs from http://xmlrpc.com/