WebService response is null in the code, but when I check in the customer REMAINS at this moment where I get the response ok

Hi all

Today, I try to call post webservice at this point, I get an answer anywhere via the webservice code I mentioned below, but when I try via the customer REMAINS this time that I get the right answer, so let me know what the problem?

WebService code: -.

QString ApplicationUI::postByWebUrl(QString qStrUrl, NetworkMethod method, QVariant data)
{
    QNetworkRequest request = QNetworkRequest();

    QNetworkAccessManager *networkAccessManager = new QNetworkAccessManager(this);
    QNetworkReply* reply;
    QString qStrReply;
    request.setUrl(QUrl(qStrUrl));
    request.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
    request.setRawHeader("Accept", "application/json");
    QByteArray *byteArray = new QByteArray();

    JsonDataAccess jda;
    jda.saveToBuffer(data, byteArray);
    QBuffer buffer(byteArray);
    buffer.open(QIODevice::ReadOnly);
    QEventLoop loop;
    reply = networkAccessManager->post(request, QString(buffer.readAll()).toAscii());
    connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
    loop.exit();
    if (!loop.isRunning()) {
        loop.exec();
    }

    qStrReply = reply->readAll();
    delete (byteArray);
    buffer.deleteLater();

    reply->deleteLater();
    networkAccessManager->deleteLater();
    return qStrReply;
}

I'm waiting for your positive response.

There are a number of problems with the code you have posted.  Take a look at this class, which accesses a REST web service and issues the response as a signal.  ForumRequest.cpp

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • Nothing in streaming-plug to the problem?

    Captain El 10.11.4, macbook pro 13 inch 2010 My mac suddenly stopped anything streaming on netflix, stan, ilary etc... It still allows me to play youtube videos. The video window is not appear at all (black screen) or it just sits on the load indefin

  • Gel downloads Firefox on 1 second after, after reboot download again (safe mode)

    This is starting to happen after the update from 28 to 32 (not sure about 28). 1. download whatever it is2 download is complete, the Download Manager (default or any plugin) still have this file fixed on 1 second3. I can't cancel, press 'x' pause.4.

  • Satellite 1410 S102: WLan card detect the SSID but cannot connect

    I have no PA3458U-1MPC installed part of the mini-map wireless in my PC Toshiba 1410 S102.The card works well, that it detects wireless (SSID) but the problem is that I can't able to connect to my router and also there is no light wireless ON my lapt

  • Range of HP printers and classes

    I e fax in the past with no problems until this week, I get a message that says I must be on a network and I am on a network, all my tests say I'm connected, what happens? Darling

  • D: drive is missing

    Original title: WINDOWS XP MEDIA PLAYYER my D: drive is missing could be in my compressed old files, & if its how that recover