I am trying to send my parameters to HTTP Post in XML and this is what I have for now. The server side does not however recognize that my params are in XML and it is being treated as QUrl. Do I not have my ContentTypeHeader setup correctly?
QNetworkRequest url;
url.setUrl(QUrl(user->rootUrl.append("GetAccount.xml")));
url.setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(getAccountParams.size()));
url.setHeader(QNetworkRequest::ContentTypeHeader, "application/XML");
QEventLoop waitLoop;
reply = connection->post(url, getAccountParams);
QObject::connect(reply, SIGNAL(finished()), &waitLoop, SLOT(quit()));
waitLoop.exec();
getAccountParams is a QByteArray and has a value which resembles this:
<?xml version="1.0" encoding="UTF-8"?><user><api_key>1234</api_key><app_id>4324</app_id><device_id>null</device_id><email>test+dev@test.com</email><password>testPassword</password></user>
No comments:
Post a Comment