Important: Please read the Qt Code of Conduct -

QtSoap generates wrong xml request

  • Hi,
    I have problem with QtSoap plugin that generates wrong xml request.
    Plugin from link:

    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="" xmlns:ns1="urn:StWebApi" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC="" SOAP-ENV:encodingStyle="">
             <test xsi:type="ns1:test">
                <echo xsi:type="xsd:string">aaaaaaaaaaaaaaddd</echo>

    C++ xml request:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" SOAP-ENV:encodingStyle="">
       <SOAP-ENV:Body xmlns:SOAP-ENV="">
             <echo xmlns:xsi="" xsi:type="xsd:string">aaaaaaaaaaaaaaddd</echo>

    C++ code:

    Test::Test(QObject* parent) :
        connect(&http, SIGNAL(responseReady()), SLOT(getResponse()));
        http.setHost("", true);
    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());
        // Extract the return value from this method response, check for
        // errors.
        const QtSoapType &res = resp.returnValue();
        if (!res.isValid())
            qDebug() << (tr("Invalid return value"));
        qDebug() << "response: " << resp.toXmlString();

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

  • Lifetime Qt Champion


    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.

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

  • Lifetime Qt Champion

    @Devoo said in QtSoap generates wrong xml request:

    Yeah, but KDAB's KDSoap is paid.

    That is not accurate:

    From the projects readme:

    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 if you are interested in buying commercial licenses.

Log in to reply