开发者

how to wrap, return and get the object of vector<map<string, string> > in C++ version of xmlrpc-c library?

I am using xmlrpc-c library (http://xmlrpc-c.sourceforge.net) and I am writing both the server and client side code. I know that xmlrpc provides lots of builtin structures like xmlrpc_c::value_struct, but the docs cannot help me figure out how to achieve my object.

In the server I am attempting to return a structure vector<map<string,string>>,开发者_Python百科 and the code snippet is like:

SomeDefaultMethod::execute(string const& methodName, xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const retvalP)
{
    *retvalP = structure; // suppose the variable structure is of type vector<map<string,string> >
}

In the client side I am attempting to print all the values from server, that is, print each map's key and value of the whole vector.

string const serverUrl("http://localhost:8183/RPC2");
string const methodName("webcommands.bulkpagestatus");
xmlrpc_c::clientSimple myClient;
xmlrpc_c::value result;
myClient.call(serverUrl, methodName, &result)
// do not know how to get the values then through result in this situation.

Can anybody give me a C++ sample code or dummy code using xmlrpc-c to achieve my object? I really appreciate your help!


You'll have to do marshalling on server side and un-marshalling on client side. Also known as serialize and de-serialise.

You are asking us for a lot of code. Try googling for marshalling code samples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜