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>
    #include<qtsoap.h>

    namespace Ui {
    class wSClient;
    }

    class wSClient : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit wSClient(QWidget *parent = 0);
    ~wSClient();

    private slots:
    void getResponse(const QtSoapMessage &);

    private:
    Ui::wSClient *ui;
    QtSoapHttpTransport http;
    };

    #endif // WSCLIENT_H
    @

    Qt .cpp file

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

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

    QtSoapMessage request;
    request.setMethod("loginCheck",
                      "http://192.168.10.119:8080/ChatAppWebService");
    request.addMethodArgument("userName", "", "Saad");
    request.addMethodArgument("password","","abc");
    
    http.setHost("192.168.10.119");
    

    // http.setAction("http://192.168.10.119:8080/ChatAppWebService/chatAppService");
    http.submitRequest(request, "chatWSpackage/chatApp/loginCheckRequest");

    qDebug("sending request");
    

    }

    wSClient::~wSClient()
    {
    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(dt.date());

        qDebug(res.toLatin1().constData());
    }
    

    // QCoreApplication::quit();
    }@

    method name if "loginCheck"

    and Soap Address is
    @
    <soap:address location="http://192.168.10.119:8080/ChatAppWebService/chatAppService"/>
    @
    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 http://www.kdab.com/products/kd-soap 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 ftp://ftp.kdab.com/pub/kdsoap (for opensource applications and for evaluation purposes), and under a commercial license from http://www.kdab.com/products/license-prices


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.