yandi
6th June 2013, 02:44
Hello Guys,
Recently I try libqxt and make web service, so far OK I try webslot with get method.
and I try make simple aplication using QNetworkAccesManager and doing a post wethod, the problem is in server side I can receive signal and byte send , but when I try to debug it's show nothing. below is some code
client :
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkRequest request;
request.setUrl(QUrl("http://192.168.88.131:8080/"));
request.setHeader(QNetworkRequest::ContentTypeHead er,QVariant("application/x-www-form-urlencoded"));
request.setRawHeader("Connection","Close");
QNetwork *reply = manager->post(request,"testdatasend");
and in server I sub class QxtWebServiceDirectory and reimplement indexRequested() here is the some code
void WebService::indexRequested(QxtWebRequestEvent *event)
{
qDebug() << "Request Headers service: " << event->headers;
if (event->method.compare("POST")==0)
{
qDebug() << "incoming...post";
QxtWebContent *myContent = event->content;
QByteArray requestContent = myContent->readAll();
qDebug() << "Content: " << requestContent
qDebug() << "Bytes to read: " << myContent->unreadBytes();
}
}
the problem is I try post "testdatasend" but in server I didn't receive anydata in "Content: " but in "Bytes to read: " I get 12(total data send),
so what am I missing in here.
tia,
yandi
Recently I try libqxt and make web service, so far OK I try webslot with get method.
and I try make simple aplication using QNetworkAccesManager and doing a post wethod, the problem is in server side I can receive signal and byte send , but when I try to debug it's show nothing. below is some code
client :
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkRequest request;
request.setUrl(QUrl("http://192.168.88.131:8080/"));
request.setHeader(QNetworkRequest::ContentTypeHead er,QVariant("application/x-www-form-urlencoded"));
request.setRawHeader("Connection","Close");
QNetwork *reply = manager->post(request,"testdatasend");
and in server I sub class QxtWebServiceDirectory and reimplement indexRequested() here is the some code
void WebService::indexRequested(QxtWebRequestEvent *event)
{
qDebug() << "Request Headers service: " << event->headers;
if (event->method.compare("POST")==0)
{
qDebug() << "incoming...post";
QxtWebContent *myContent = event->content;
QByteArray requestContent = myContent->readAll();
qDebug() << "Content: " << requestContent
qDebug() << "Bytes to read: " << myContent->unreadBytes();
}
}
the problem is I try post "testdatasend" but in server I didn't receive anydata in "Content: " but in "Bytes to read: " I get 12(total data send),
so what am I missing in here.
tia,
yandi