Congratulations to our 2022 Qt Champions!

Problem using qtSoap

  • problem i am facing while using qtsoap is that i am get request refused, web sertvice i am trying to connect is developed in java and is currently running on a local machine , here is the code

    qt .h File
    @#ifndef WSCLIENT_H
    #define WSCLIENT_H

    #include <QMainWindow>

    namespace Ui {
    class wSClient;

    class wSClient : public QMainWindow

    explicit wSClient(QWidget *parent = 0);

    private slots:
    void getResponse(const QtSoapMessage &);

    Ui::wSClient *ui;
    QtSoapHttpTransport http;

    #endif // WSCLIENT_H

    Qt .cpp file

    @#include "wsclient.h"
    #include "ui_wsclient.h"

    wSClient::wSClient(QWidget *parent) :
    ui(new Ui::wSClient)
    connect(&http, SIGNAL(responseReady(const QtSoapMessage &)),
    this, SLOT(getResponse(const QtSoapMessage &)));

    QtSoapMessage request;
    request.addMethodArgument("userName", "", "Saad");

    // http.setAction("");
    http.submitRequest(request, "chatWSpackage/chatApp/loginCheckRequest");

    qDebug("sending request");


    delete ui;

    void wSClient::getResponse(const QtSoapMessage &message)
    if (message.isFault()) {
    qDebug("Error: %s", qPrintable(message.faultString().toString()));
    else {
    QString res = message.returnValue().toString();
    // QDateTime dt = QDateTime::fromString(res, Qt::ISODate);
    // if (dt.isValid())
    // res = QLocale::c().toString(;


    // QCoreApplication::quit();

    method name if "loginCheck"

    and Soap Address is
    <soap:address location=""/>
    please help me. And is there some way of generating C++ class(stub) from WSDL. I tried using gsoap but it is very complex.

    [edit: Soap address returned / Denis Kormaev]

  • I tried qt soap 2 years ago, it had some features missing (not a bug) with large scale and complex business web services because it was under development. Then I had to use gsoap. gsoap is great and could be complex for some users though is very powerful.

    Your web service seems to be simple one so qt soap should suffice. You need to provide more inputs in order to let others know about exact problem.

    If your server is refusing your request, you need to first make sure that everything is fine with your web service. You can test your web service by either web browser or some other web tool.

    And there is no issues if WS is developed using JAVA.

  • I would recommend trying KDSoap, which we (KDAB) just released it. See for more details.
    It does include a code generator in order to generate a C++ class from a WSDL file, and is a much more complete solution than Qt Soap: support for sync and async calls, support for RPC and document types of communication, etc.

    KDSoap is available under the GPL license from (for opensource applications and for evaluation purposes), and under a commercial license from

Log in to reply