Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
KDSoap: how to build a XML struct with a deeper level?
I'm trying to build an XML message based on the structure followed exemplified, and I don't know how to add some params. I read the docs and see the function signature, but I didn't understand how I can do to build the message.
Could someone help me?
<param> <user>abc</user> <available_item> <item>umbrela</item> <available_item> <available_item> <item>hat</item> </available_item> </param>
KDSoapMessage m; KDSoapValueList p; p.addArgument("user","abc"); // p.addArgument("available_item", ??> <--- How could I do that? m.addArgument("param", p);
How can I do to add "item" as a child of "available_item"?
JonB last edited by JonB
// p.addArgument("available_item", ??> <--- How could I do that?
??needs to be a
QVariantcan hold either a simple value, or a
KDSoapValueListof child values.
You need to create a (new)
KDSoapValueList, which itself will have
addArgument("item","umbrela");, and another
You need to create a (new) KDSoapValueList, which itself will have addArgument("item","umbrela");, and another available_item for the hat one similarly.
It seems a silly question, I know.
But I read the documentation and found the same as you. It should be effortless, but after some revision, the method has changed.
The function signature doesn't match for KDSoapValueList in the latest revision: https://docs.kdab.com/kdsoap/latest/class_k_d_soap_value_list.html#acf2e157835a7ba96970204f53d0ff727
KDSoapList.addArgument("name", KDSoapList p>
It is not possible to add a KDSoapList using this method since 1.3 version of this lib.
I found a way to solve my question, and I will explain how.
KDSoapList a, b; a.addArgument("user", "abc"); b.addArgument("item", "umbrella"); KDSoapValue v("available_item", b) a.append(v) b.clear() b.addArgument("item", "hat"); KDSoapValue v("available_item", b) a.append(v)
It is a kind verbose, but it works.