KDSoap: how to build a XML struct with a deeper level?
-
Hello,
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?
Example:
<param> <user>abc</user> <available_item> <item>umbrela</item> <available_item> <available_item> <item>hat</item> </available_item> </param>
Code:
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"?
-
@carpajr
Per @jsulm's reference, in// p.addArgument("available_item", ??> <--- How could I do that?
your
??
needs to be aargumentValue this
QVariant
can hold either a simple value, or aKDSoapValueList
of child values.You need to create a (new)
KDSoapValueList
, which itself will haveaddArgument("item","umbrela");
, and anotheravailable_item
for thehat
one similarly. -
@jsulm said in KDSoap: how to build a XML struct with a deeper level?:
@carpajr https://docs.kdab.com/kdsoap/1.0.0/class_k_d_soap_value_list.html#acf2e157835a7ba96970204f53d0ff727 ?
@JonB said in KDSoap: how to build a XML struct with a deeper level?:
You need to create a (new) KDSoapValueList, which itself will have addArgument("item","umbrela");, and another available_item for the hat one similarly.
Hi!
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
-
Hello!
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.