Hi Everyone,

I am fresher, trying to develop a code for a my first project , need some help

I am writting a program , where am trying to pass the xml file body using QHttpMultiPart.
and the received data from the from the QNetworkAccessManager , i wanted to print and see that the data is coming from localhost port properly or not.
Please find the below code i have developed

Main.c


int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

Uploader obj;
QString xmllink = "C:/Users/ramachandrug/Documents/QT/XML_pharse/rtioInterface.xml";
obj.upload(xmllink);

return a.exec();
}



XmlComms.cpp

void Uploader::upload(QString xmlFilePath)
{

qDebug() << "Upload Starting";
QFileInfo fileInfo(xmlFilePath);
qDebug() << "file path is :" <<fileInfo.absoluteFilePath();
qDebug() << "file size is :" << fileInfo.size();

QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);

QHttpPart filePart;
filePart.setHeader(QNetworkRequest::ContentDisposi tionHeader, QVariant("HTTP/1.1 200 OK"));
filePart.setHeader(QNetworkRequest::ContentTypeHea der, QVariant("text/xml; charset=utf-8"));

QFile *file = new QFile(xmlFilePath);
if ( !file->exists() )
{
qDebug() << "File Does not exist";
}

file->open(QIODevice::ReadOnly);
filePart.setBodyDevice(file);
file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart

multiPart->append(filePart);

QUrl url("http://localhost:445");
qDebug() << "Host:" << url.host();
qDebug() << "Port:" << url.port();


QNetworkRequest request(url);

pManager = new QNetworkAccessManager();

pReply = pManager->post(request, multiPart);
multiPart->setParent(pReply);

//qDebug() <<"XML body is: "<<pReply->readAll();


QEventLoop *pELoop = new QEventLoop();


QObject::connect(pManager, SIGNAL(finished(QNetworkReply* )),this, SLOT(replyFinished(QNetworkReply*)));

pELoop->exec();


}



/**
* @brief Uploader::replyFinished
*/

void Uploader::replyFinished(QNetworkReply *reply)
{

QByteArray data = reply->readAll();
qDebug() << "data is::"<< data;
qDebug() << "Upload completed";

uploadInProgress = false;
if ( reply->error() > 0 )
{
qDebug() << "Error occured: " << reply->error() << " : " << reply->errorString();
}
else
{
qDebug() << "Upload success";
}

//_dataArrived(data); //passing the extracted XML body
reply->deleteLater();


}



When i run this code, am getting the below output

upload starting
file path is : C:/Users/ramachandrug/Documents/QT/XML_pharse/rtioInterface.xml

file size is 35440
Host : localhost
port: 445
data is :: "" //here no output is coming, empty byte array is coming
upload completed
Error occured: 99 : "unknown error" // for to fix this error, i installed the openssl also but still am getting this error



Am running this QT project in my host environment only.

Anyone please let me know , why am not able to print this xml body here. I am stuck here from last 2days.
please help me to fix this issue.

Thanks
Gowreesh