Hi all,

I written a code to hit the the web service and print the response which is send by webservice.Its working fine but its behaving in different manner.

SampleClass.h
public slots:
void slotRequestFinished(QNetworkReply* reply);
public:
void postingTheDataToService();
QNetworkAccessManager *networkManager;
-------------------------------------------------------------------------------------------------------
SampleClass.cpp

SampleClass::SampleClass(QWidget *parent) : QWidget(parent), ui(new Ui::SampleClass)
{
-----somestatements-----
-----somestatements-----
-----somestatements-----
postingTheDataToService();
qdebug("test--------------------1");
qdebug("test--------------------2");
qdebug("test--------------------3");
}
void SampleClass:: postingTheDataToService()
{

qDebug("in posting------------11111");
networkManager=new QNetworkAccessManager(this);
qDebug("in posting------------22222222222");
QUrl serviceurl=QUrl("http://a.sampleserviceurl.appspot.com/qtservice");
qDebug("in posting------------333333333");
networkManager->post(QNetworkRequest(serviceurl),postData);
qDebug("in posting------------44444444");
connect(networkManager,SIGNAL(finished(QNetworkRep ly*)),this,SLOT(slotRequestFinished(QNetworkReply* )));
qDebug("in posting------------55555555555555");

}

void SampleClass::slotRequestFinished(QNetworkReply* reply)
{
qDebug()<<"Service TEst ------------T------------1111111----\n";
QByteArray data = reply->readAll();
qDebug()<<"Service TEst ------------T------------22222----\n";
qdebug()<<"required response is---------"<<data;
}
--------------------------------------------------------------------------------------------------------------------
Output which i am getting is
in posting------------11111
in posting------------22222222222
in posting------------333333333
in posting------------44444444
in posting------------55555555555555
test--------------------1
test--------------------2
test--------------------3
Service TEst ------------T------------1111111----
Service TEst ------------T------------22222----
required response is--------"something send by service"
Here MyQuestion is now before printing the print statements in "postingTheDataToService" it should print and i need to print "slotRequestFinished" printing statements but its printing the "constructor" print statements..? ,pls correct me where i am wrong.