I'm trying to use the QJsonRpcHttpClient class, but only the first request to a remote webservice works. I always get QJsonRpcMessage(type=QJsonRpcMessage::Error, id=3, code=-32700, message="unable to process incoming JSON data", data=QJsonValue(string, " ? ") ) after the first one. Follow my code below:
//HEADER
class MSync{
MSync(QObject *parent);
void requestData();
private:
QNetworkAccessManager *manager;
QJsonRpcHttpClient *clientX;
};
//SOURCE
MSync::MSync(QObject *parent) : QObject(parent){
manager=new QNetworkAccessManager(this);
clientX=new QJsonRpcHttpClient(manager,this);
clientX->setEndPoint(MCommon::obj()->getSVCUrl());
}
MSync::requestData(){
QJsonRpcServiceReply *reply = clientX->invokeRemoteMethod("GetData",1,1,"test");
connect(reply, SIGNAL(finished()), this, SLOT(slotRespRequestData()));
}
MSync::slotRespRequestData(){
QJsonRpcServiceReply *reply = static_cast<QJsonRpcServiceReply *>(sender());
if (!reply) {qDebug() << "invalid response received";return;}
QJsonRpcMessage resp= reply->response();
qDebug()<<"resp:"<<resp; //after first request, I always get QJsonRpcMessage(type=QJsonRpcMessage::Error, id=2, code=-32700, message="unable to process incoming JSON data", data=QJsonValue(string, " ? ") )
}
The webservice is working fine everytime. I'm doing something stupid?
Thank you,
Bruno.
--
You received this message because you are subscribed to the Google Groups "qjsonrpc-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qjsonrpc-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Matt, thanks for the quick response.
I executed it using QJSONRPC_DEBUG, but I received no relevant info for this case.
I'm using the latest version of jayrock under .net:
https://code.google.com/p/jayrock/.
I didn't have time to run wireshark on it to confirm if data received is correct. As soon as I test it, I let you know.
Thanks again,
Bruno