Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. KDSoap: how to build a XML struct with a deeper level?
Qt 6.11 is out! See what's new in the release blog

KDSoap: how to build a XML struct with a deeper level?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    carpajr
    wrote on last edited by carpajr
    #1

    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"?

    jsulmJ JonBJ 2 Replies Last reply
    0
    • C carpajr

      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"?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @carpajr https://docs.kdab.com/kdsoap/1.0.0/class_k_d_soap_value_list.html#acf2e157835a7ba96970204f53d0ff727 ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      2
      • C carpajr

        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"?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @carpajr
        Per @jsulm's reference, in

        // p.addArgument("available_item", ??>  <--- How could I do that?
        

        your ?? needs to be a

        argumentValue this QVariant can hold either a simple value, or a KDSoapValueList of child values.

        You need to create a (new) KDSoapValueList, which itself will have addArgument("item","umbrela");, and another available_item for the hat one similarly.

        1 Reply Last reply
        1
        • jsulmJ jsulm

          @carpajr https://docs.kdab.com/kdsoap/1.0.0/class_k_d_soap_value_list.html#acf2e157835a7ba96970204f53d0ff727 ?

          C Offline
          C Offline
          carpajr
          wrote on last edited by carpajr
          #4

          @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

          0_1559051063291_2019-05-28 (1).png

          1 Reply Last reply
          0
          • C Offline
            C Offline
            carpajr
            wrote on last edited by carpajr
            #5

            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.

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved