View Full Version : QT-wince and QHttp::readAll() trouble....

3rd June 2008, 12:06
By porting my app into wince i get very strange trouble with QHttp.

App send request to SOAP webservice get response, parse XML and shows data or add it to POutlook.... response is always ~ 50kb, max 200 kb.

I use slot (done(bool)) to get response data, and set this data to xml class in this slot with xml.setData(http->readAll()), it works OK in windows version, but it doesn't on wince both with wincewm50standart sdk and wince60professional sdk.... if i do http->readAll() http instance fall into infinity loop and i don't get any data, with read(&data, sizeof(data)) i can get data but http don't want to release itself....... and if i set request to redirect it output in file, like http->request(header, blob, &outfile); all works ok and http finish release itself....

have someone get same problemm?
any idea how to get response without saving it to file ... :confused:

3rd June 2008, 12:33
Mmm.... with redirecting response in file it doesn't close http loop....
After I close app I get this message in debug window:
QWaitCondition: Destroyed while threads are still waiting


3rd June 2008, 18:27
Are you using threads?

4th June 2008, 10:05
No, I don't.... I use QHttp inside main QObject class plus QWidget class for GUI.... I don't really need threads... app should just request webservice, get response message do parsing and show result ....

But QHttp use Threads itself, isn't it?
I have tryed to stop QHttp like http->thread()->exit(0); it stops http ok, but it also close my App with status code 0 = Ok :eek:

any idea??? :confused:

4th June 2008, 11:36
So... I have recompiled QtNetwork with all DEBUG enabled what i have found in source code :)

and the result is:

Modul laden: PDA_Agent.exe
Modul laden: QtNetwork4.dll
Modul laden: msvcr90.dll
Modul laden: QtCore4.dll
Modul laden: QtGui4.dll
Modul laden: CEShell.DLL
Modul laden: commctrl.dll.0409.MUI
Modul laden: commctrl.dll
Modul laden: ossvcs.dll
Modul laden: aygshell.dll
Modul laden: OLEAUT32.dll
Modul laden: WS2.dll
Modul laden: WINSOCK.dll
Modul laden: coredll.dll.0409.MUI
Modul laden: ole32.dll
Modul laden: coredll.dll
Modul laden: MMTimer.dll
Modul laden: compime.dll
Modul laden: shellres.dll
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 0 bytes
QAbstractSocket::QAbstractSocket(TcpSocket, QAbstractSocketPrivate == 00058EB0, parent == 00000000)
QHttp state changed 0 -> 2
QAbstractSocket::connectToHost("http://*******", 80, 3)...
QAbstractSocket::connectToHost("http://*******", 80) == false (connection in progress)
Modul laden: ShUtil.dll
Modul laden: SSLLSP.DLL
Modul laden: AutoBind_lsp.dll
Modul laden: dtpt_lsp.dll
Modul laden: cellcore.dll
Modul laden: wspm.dll
Modul laden: dtpt_nsp.dll
Modul laden: nspm.dll
Der Thread 0x17d0fabe hat mit Code 0 (0x0) geendet.
QAbstractSocketPrivate::_q_startConnecting(hostInf o == {})
QAbstractSocketPrivate::_q_connectToNextAddress(), connecting to, 1 left to try
[QSocks5] createSocketEngine QHostAddress( "" )
[QSocks5] not proxying
more details ()
QAbstractSocketPrivate::initSocketLayer(TcpSocket, IPv4Protocol) success
QNativeSocketEnginePrivate::nativeConnect() to :: 80
more details ()
QNativeSocketEnginePrivate::nativeConnect(192.168. 0.112, 80) == false (Connection in progress)
QAbstractSocketPrivate::canWriteNotification() testing connection
QNativeSocketEnginePrivate::nativeConnect() to :: 80
more details ()
QNativeSocketEnginePrivate::nativeConnect(192.168. 0.112, 80) == true
QNativeSocketEnginePrivate::fetchConnectionParamet ers() localAddress ==, localPort = 1076, peerAddress ==, peerPort = 80, socketProtocol == IPv4Protocol, socketType == TcpSocket
QHttp state changed 2 -> 3
QAbstractSocket::writeData(000A28D0 "POST /****/soap/index.php...", 230) == 0
QAbstractSocket::writeData(00051E30 "<?xml version="1.0" encoding="UT...", 531) == 0
QAbstractSocketPrivate::fetchConnectionParameters( ) connection to established
QAbstractSocketPrivate::canWriteNotification() flushing
QNativeSocketEnginePrivate::nativeWrite(00088060 "POST /****/...", 761) == 761
QAbstractSocketPrivate::flush() 761 bytes written to the network
QAbstractSocketPrivate::readFromSocket() about to read 857 bytes
QNativeSocketEnginePrivate::nativeRead(00080040 "HTTP/1.1 200 OK\r...", ) == 857
QAbstractSocketPrivate::readFromSocket() got 857 bytes, buffer size = 857
QHttp state changed 3 -> 4
QAbstractSocket::canReadLine() == true, buffer size = 857, size = 0
QAbstractSocket::readData(00059010 "HTTP/1.1 200 OK\r\nDate: Wed, 04 J...", 16384) == 0
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 840
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 803
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 733
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 708
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 653
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 632
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 600
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 576
QAbstractSocket::canReadLine() == false, buffer size = 0, size = 537
QAbstractSocket::bytesAvailable() == 535
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 535 bytes
QHttp::_q_slotReadyRead(): read 535 bytes (0 bytes done)
QHttp::bytesAvailable(): 535 bytes
QHttp state changed 4 -> 5
<finished> ok
QHttp::bytesAvailable(): 535 bytes
QHttp::read(): read 535 bytes (0 bytes done) //why 0 bytes done???? wtf?
QAbstractSocketPrivate::readFromSocket() about to read 4096 bytes
QNativeSocketEnginePrivate::nativeRead(00080040 "", ) == 4096
QAbstractSocketPrivate::readFromSocket() got -1 bytes, buffer size = 0
QHttp state changed 5 -> 6
QAbstractSocket::disconnectFromHost() emits stateChanged()(ClosingState)
QAbstractSocket::disconnectFromHost() disconnecting immediately
QAbstractSocket::disconnectFromHost() disconnected!
QAbstractSocket::disconnectFromHost() closed!
QAbstractSocketPrivate::readFromSocket() read failed: Unknown error
QAbstractSocketPrivate::canReadNotification() disconnecting socket
QAbstractSocket::disconnectFromHost() was called on an unconnected socket
QHttp state changed 6 -> 0
Der Thread 0x76125fc2 hat mit Code 0 (0x0) geendet.
----------------------here I have clicked close button in my app--------------------------
QWaitCondition: Destroyed while threads are still waiting
Modul entladen: QtGui4.dll
Modul entladen: CEShell.DLL
Modul entladen: QtNetwork4.dll
Modul entladen: QtCore4.dll
Modul entladen: WINSOCK.dll
Modul entladen: msvcr90.dll
Modul entladen: ShUtil.dll
Modul entladen: nspm.dll
Modul entladen: dtpt_nsp.dll
Modul entladen: MMTimer.dll
Modul entladen: compime.dll
Modul entladen: commctrl.dll
Modul entladen: ossvcs.dll
Modul entladen: aygshell.dll
Modul entladen: wspm.dll
Modul entladen: OLEAUT32.dll
Modul entladen: cellcore.dll
Modul entladen: dtpt_lsp.dll
Modul entladen: AutoBind_lsp.dll
Modul entladen: SSLLSP.DLL
Modul entladen: WS2.dll
Modul entladen: ole32.dll
Das Programm "[0x56309F7E] PDA_Agent.exe" wurde mit Code 0 (0x0) beendet.

and this is my source code:

void system::send(){
QUrl url("http://***********/soap/index.php");
header.setRequest("POST", QString("%1?op=logon").arg(url.path()));
header.setValue("Host", url.host());
header.setValue("SOAPAction", "urn:logonAction");
header.setValue("User-Agent", "PDA Agent");
header.setValue("Connection", "Keep-Alive");
header.setContentType("text/xml; charset=utf-8");

data.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"> <SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">");
data.append("<NS1:Login xmlns:NS1=\"urn:logon\">");
data.append("<login xsi:type=\"xsd:string\">***</login>");
data.append("<pass xsi:type=\"xsd:string\">***</pass>");
data.append("</SOAP-ENV:Body> </SOAP-ENV:Envelope>");

http = new QHttp(this);
connect(http, SIGNAL(done(bool)), this, SLOT(finished(bool)));
http->request(header, data);

void system::finished(bool error){
qDebug() << "<finished>" << (error?"error":"ok");
qDebug() << http->readAll(); //can't get any data
qDebug() << "</finished>";

void system::parse(){
qDebug() << "<parse>...</parse>";

I have changed url and pass with "****"
also I have checked http request with Wireshark... all is ok, request sended, response with status code 200 and data what I need returned.... but can't read this in programm and this QWaitCondition makes me crazy...... :(:mad::crying:

6th June 2008, 08:19
Can someone who has QT-wince enveronment please test Http POST request?!? maybe it just SDK and platform or what ever trouble......


12th June 2008, 09:40
seems to be a bug:
MSG from Support Engineer:

It might be a bug. I have reported the bug to our developers. The
problem is that Windows CE does not support asynchronous hooks like
WSASelect() etc. Thus we needed to implement them on our own using
QThread/QWaitCondition. This might be where your problem is.