Hello everyone,
I had a problem with the http connection with my server, im trying to post the data to the server but the server returns with the error code 406-not acceptable. i couldn't find the solution why it happens. this is the code i am using for the Http connection to post the data..

QUrl serviceUrl = QUrl("URL which i am using"); QByteArray postData;
QString s = "content to be posted";
postData.append(s);
QNetworkAccessManager *networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this,SLOT(serviceRequestFinished(QNetworkReply*)));
QNetworkRequest request;
request.setUrl(serviceUrl);
QNetworkReply* reply = networkManager->post(request, postData);


void Signupscreen::serviceRequestFinished(QNetworkReply* reply) {

QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
// Or the target URL if it was a redirect:
QVariant redirectionTargetUrl =
reply->attribute(QNetworkRequest::RedirectionTargetAttribute);

QNetworkReply::NetworkError error = reply->error();

if (error == QNetworkReply::NoError) {
}

else {
// handling error here
}

}

this is the code i am using.

I conformed that the url and the content which i am posting to the server is correct... so i couldn't find any other solution y this happens... let me know any one face the same problem and found any solutions. i searched in forum wiki and i also tried using the example code in that. used as follow
posted the content as same as in the example...

QByteArray postData(""); QList<QPair<QByteArray, QByteArray> > headers;
QString postBody = "posted content";
postData = postBody.toAscii();
if (!HttpCommunicator::splitIntoHeaders("",
headers)) {
//ui->m_textBrowserResp->setText(tr("Failed to parse HTTP headers."));
return;
}
HttpCommunicator::HttpRequestType requestType = HttpCommunicator::httpRequestTypeForText(
"GET");
m_httpCommunicator = new HttpCommunicator(requestType,"URL TO WHICH I POSTED",
postData, headers, "True");

connect(m_httpCommunicator, SIGNAL(finishedRequest()), this,
SLOT(processResponse()));
m_httpCommunicator->makeRequest();

iT ALSO RESULTS IN THE SAME ERROR 406 - NOT ACCEPTABLE.. wat may be the solution for this ???? to note i tried using the header values to like. application/json but it displays as "Failed to parse HTTP headers" so it ill be helpful if anyone has a solution for this strange problem.

thanks for any replies..