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. QtSoap generates wrong xml request

QtSoap generates wrong xml request

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 795 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Devoo
    wrote on last edited by
    #1

    Hi,
    I have problem with QtSoap plugin that generates wrong xml request.
    Plugin from link: https://github.com/commontk/QtSOAP

    In response I always receive message that echo parameter is not given, so I wrote a simple soap client using PHP (response is correct).
    I'm sure the problem only affects xml request (not header), because I injected PHP xml request statically in QtSoap plugin (reponse was correct).

    PHP xml request:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:StWebApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
       <SOAP-ENV:Body>
          <ns1:test>
             <test xsi:type="ns1:test">
                <echo xsi:type="xsd:string">aaaaaaaaaaaaaaddd</echo>
             </test>
          </ns1:test>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    C++ xml request:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
       <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
          <test>
             <echo xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="xsd:string">aaaaaaaaaaaaaaddd</echo>
          </test>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    C++ code:

    Test::Test(QObject* parent) :
        QObject(parent)
    {
        connect(&http, SIGNAL(responseReady()), SLOT(getResponse()));
        http.setAction("urn:StWebApiSoapServer");
        http.setHost("mywebpage.com", true);
    }
    
    Test::~Test()
    {
    }
    
    void Test::sendRequest()
    {
        QtSoapMessage request;
        request.setMethod(QtSoapQName("test", ""));
        request.addMethodArgument("echo", "", "aaaaaaaaaaaaaaddd");
    
        // Submit the method request to the web service.
        http.submitRequest(request, "/backend.php/webapi/soap");
    }
    
    void Test::getResponse()
    {
        // Get the response, check for error.
        const QtSoapMessage &resp = http.getResponse();
        if (resp.isFault())
        {
            qDebug() << (tr("Query failed: ")
                        + resp.faultString().value().toString());
            return;
        }
    
        // Extract the return value from this method response, check for
        // errors.
        const QtSoapType &res = resp.returnValue();
        if (!res.isValid())
        {
            qDebug() << (tr("Invalid return value"));
            return;
        }
        qDebug() << "response: " << resp.toXmlString();
                return;
    }
    

    As You can see xml requests are a bit different.
    What's wrong with my code?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      That's likely something you should as the author of the fork since he's likely the most recent developer having touch that code.

      As an alternative you might want to check KDAB's KDSoap project which is actively maintained.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • D Offline
        D Offline
        Devoo
        wrote on last edited by
        #3

        Yeah, but KDAB's KDSoap is paid.
        I just wrote my own class and it looks that everything works correctly.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Devoo said in QtSoap generates wrong xml request:

          Yeah, but KDAB's KDSoap is paid.

          That is not accurate:

          From the projects readme:

          License
          
          KD Soap is (C) 2010-2019, Klaralvdalens Datakonsult AB, and is available under the terms of:
          
          * the LGPL (see LICENSE.LGPL.txt for details) (except libkdsoap-server, see LICENSE.AGPL3-modified.txt)
          
          * the GPL (see LICENSE.GPL.txt for details) (except libkdsoap-server, see LICENSE.AGPL3-modified.txt)
          
          * the KDAB commercial license, provided that you buy a license. please contact sales@kdab.com if you are interested in buying commercial licenses.
          

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

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