I am trying to create a client application for web service. In that application i need to pass some integer number with that web service link, then web service give me some data in XML format. I able to complete ping that web service, but i don't no how to pass integer value with that web service. Please give me some sample code for request-response web service in c++. The response data is in XML and i want to store in some text file or in vector. That data i need for print using printer.
Here is my code that i develop for web service:
void Downloader::doDownload()
{
manager = new QNetworkAccessManager(this);
connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(QUrl("http://api.flickr.com/services/soap/")));
exit(0);
}
void Downloader::replyFinished (QNetworkReply *reply)
{
if(reply->error())
{
qDebug() << "ERROR!!!!";
qDebug() << reply->errorString();
}
else
{
qDebug() << reply->header(QNetworkRequest::ContentTypeHeader).toString();
qDebug() << reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toString();
qDebug() << reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
QFile *file = new QFile("/root/Downloads/QT Web Services/WebServiceResponseData.txt");
if(file->open(QFile::Append))
{
file->write(reply->readAll());
file->flush();
file->close();
}
delete file;
}
reply->deleteLater();
}