Results 1 to 7 of 7

Thread: QT-wince and QHttp::readAll() trouble....

  1. #1
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QT-wince and QHttp::readAll() trouble....

    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 ...
    Thanks!

  2. #2
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT-wince and QHttp::readAll() trouble....

    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

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT-wince and QHttp::readAll() trouble....

    Are you using threads?
    J-P Nurmi

  4. #4
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT-wince and QHttp::readAll() trouble....

    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

    any idea???

  5. #5
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Angry Re: QT-wince and QHttp::readAll() trouble....

    So... I have recompiled QtNetwork with all DEBUG enabled what i have found in source code

    and the result is:
    Qt Code:
    1. Modul laden: PDA_Agent.exe
    2. Modul laden: QtNetwork4.dll
    3. Modul laden: msvcr90.dll
    4. Modul laden: QtCore4.dll
    5. Modul laden: QtGui4.dll
    6. Modul laden: CEShell.DLL
    7. Modul laden: commctrl.dll.0409.MUI
    8. Modul laden: commctrl.dll
    9. Modul laden: ossvcs.dll
    10. Modul laden: aygshell.dll
    11. Modul laden: OLEAUT32.dll
    12. Modul laden: WS2.dll
    13. Modul laden: WINSOCK.dll
    14. Modul laden: coredll.dll.0409.MUI
    15. Modul laden: ole32.dll
    16. Modul laden: coredll.dll
    17. Modul laden: MMTimer.dll
    18. Modul laden: compime.dll
    19. Modul laden: shellres.dll
    20. QHttp::bytesAvailable(): 0 bytes
    21. QHttp::bytesAvailable(): 0 bytes
    22. QAbstractSocket::QAbstractSocket(TcpSocket, QAbstractSocketPrivate == 00058EB0, parent == 00000000)
    23. QHttp state changed 0 -> 2
    24. QAbstractSocket::connectToHost("http://*******", 80, 3)...
    25. QAbstractSocket::connectToHost("http://*******", 80) == false (connection in progress)
    26. Modul laden: ShUtil.dll
    27. Modul laden: SSLLSP.DLL
    28. Modul laden: AutoBind_lsp.dll
    29. Modul laden: dtpt_lsp.dll
    30. Modul laden: cellcore.dll
    31. Modul laden: wspm.dll
    32. Modul laden: dtpt_nsp.dll
    33. Modul laden: nspm.dll
    34. Der Thread 0x17d0fabe hat mit Code 0 (0x0) geendet.
    35. QAbstractSocketPrivate::_q_startConnecting(hostInfo == {192.168.0.112})
    36. QAbstractSocketPrivate::_q_connectToNextAddress(), connecting to 192.168.0.112:80, 1 left to try
    37. QAbstractSocketPrivate::resetSocketLayer()
    38. [QSocks5] createSocketEngine QHostAddress( "192.168.0.112" )
    39. [QSocks5] not proxying
    40. WSA error : WSAENOPROTOOPT
    41. more details ()
    42. QAbstractSocketPrivate::initSocketLayer(TcpSocket, IPv4Protocol) success
    43. QNativeSocketEnginePrivate::nativeConnect() to 192.168.0.112 :: 80
    44. WSA error : WSAEWOULDBLOCK
    45. more details ()
    46. QNativeSocketEnginePrivate::nativeConnect(192.168.0.112, 80) == false (Connection in progress)
    47. QAbstractSocketPrivate::canWriteNotification() testing connection
    48. QNativeSocketEnginePrivate::nativeConnect() to 192.168.0.112 :: 80
    49. WSA error : WSAEISCONN
    50. more details ()
    51. QNativeSocketEnginePrivate::nativeConnect(192.168.0.112, 80) == true
    52. QNativeSocketEnginePrivate::fetchConnectionParameters() localAddress == 192.168.0.158, localPort = 1076, peerAddress == 192.168.0.112, peerPort = 80, socketProtocol == IPv4Protocol, socketType == TcpSocket
    53. QHttp state changed 2 -> 3
    54. QAbstractSocket::writeData(000A28D0 "POST /****/soap/index.php...", 230) == 0
    55. QAbstractSocket::writeData(00051E30 "<?xml version="1.0" encoding="UT...", 531) == 0
    56. QAbstractSocketPrivate::fetchConnectionParameters() connection to 192.168.0.112:80 established
    57. QAbstractSocketPrivate::canWriteNotification() flushing
    58. QNativeSocketEnginePrivate::nativeWrite(00088060 "POST /****/...", 761) == 761
    59. QAbstractSocketPrivate::flush() 761 bytes written to the network
    60. QAbstractSocketPrivate::canReadNotification()
    61. QAbstractSocketPrivate::readFromSocket() about to read 857 bytes
    62. QNativeSocketEnginePrivate::nativeRead(00080040 "HTTP/1.1 200 OK\r...", ) == 857
    63. QAbstractSocketPrivate::readFromSocket() got 857 bytes, buffer size = 857
    64. QHttp state changed 3 -> 4
    65. QAbstractSocket::canReadLine() == true, buffer size = 857, size = 0
    66. QAbstractSocket::readData(00059010 "HTTP/1.1 200 OK\r\nDate: Wed, 04 J...", 16384) == 0
    67. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 840
    68. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 803
    69. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 733
    70. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 708
    71. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 653
    72. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 632
    73. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 600
    74. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 576
    75. QAbstractSocket::canReadLine() == false, buffer size = 0, size = 537
    76. QAbstractSocket::bytesAvailable() == 535
    77. QHttp::bytesAvailable(): 0 bytes
    78. QHttp::bytesAvailable(): 535 bytes
    79. QHttp::_q_slotReadyRead(): read 535 bytes (0 bytes done)
    80. QHttp::bytesAvailable(): 535 bytes
    81. QHttp state changed 4 -> 5
    82. <finished> ok
    83. QHttp::bytesAvailable(): 535 bytes
    84. QHttp::read(): read 535 bytes (0 bytes done) //why 0 bytes done???? wtf?
    85. </finished>
    86. <parse>...</parse>
    87. QAbstractSocketPrivate::canReadNotification()
    88. QAbstractSocketPrivate::readFromSocket() about to read 4096 bytes
    89. QNativeSocketEnginePrivate::nativeRead(00080040 "", ) == 4096
    90. QAbstractSocketPrivate::readFromSocket() got -1 bytes, buffer size = 0
    91. QHttp state changed 5 -> 6
    92. QAbstractSocket::close()
    93. QAbstractSocket::disconnectFromHost()
    94. QAbstractSocket::disconnectFromHost() emits stateChanged()(ClosingState)
    95. QAbstractSocket::disconnectFromHost() disconnecting immediately
    96. QAbstractSocketPrivate::resetSocketLayer()
    97. QAbstractSocket::disconnectFromHost() disconnected!
    98. QAbstractSocket::disconnectFromHost() closed!
    99. QAbstractSocketPrivate::readFromSocket() read failed: Unknown error
    100. QAbstractSocketPrivate::resetSocketLayer()
    101. QAbstractSocketPrivate::canReadNotification() disconnecting socket
    102. QAbstractSocket::disconnectFromHost()
    103. QAbstractSocket::disconnectFromHost() was called on an unconnected socket
    104. QHttp state changed 6 -> 0
    105. Der Thread 0x76125fc2 hat mit Code 0 (0x0) geendet.
    106. ----------------------here I have clicked close button in my app--------------------------
    107. QWaitCondition: Destroyed while threads are still waiting
    108. Modul entladen: QtGui4.dll
    109. Modul entladen: CEShell.DLL
    110. Modul entladen: QtNetwork4.dll
    111. Modul entladen: QtCore4.dll
    112. Modul entladen: WINSOCK.dll
    113. Modul entladen: msvcr90.dll
    114. Modul entladen: ShUtil.dll
    115. Modul entladen: nspm.dll
    116. Modul entladen: dtpt_nsp.dll
    117. Modul entladen: MMTimer.dll
    118. Modul entladen: compime.dll
    119. Modul entladen: commctrl.dll
    120. Modul entladen: ossvcs.dll
    121. Modul entladen: aygshell.dll
    122. Modul entladen: wspm.dll
    123. Modul entladen: OLEAUT32.dll
    124. Modul entladen: cellcore.dll
    125. Modul entladen: dtpt_lsp.dll
    126. Modul entladen: AutoBind_lsp.dll
    127. Modul entladen: SSLLSP.DLL
    128. Modul entladen: WS2.dll
    129. Modul entladen: ole32.dll
    130. Das Programm "[0x56309F7E] PDA_Agent.exe" wurde mit Code 0 (0x0) beendet.
    To copy to clipboard, switch view to plain text mode 


    and this is my source code:
    Qt Code:
    1. void system::send(){
    2. QUrl url("http://***********/soap/index.php");
    3. header.setRequest("POST", QString("%1?op=logon").arg(url.path()));
    4. header.setValue("Host", url.host());
    5. header.setValue("SOAPAction", "urn:logonAction");
    6. header.setValue("User-Agent", "PDA Agent");
    7. header.setValue("Connection", "Keep-Alive");
    8. header.setContentType("text/xml; charset=utf-8");
    9.  
    10. 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/\">");
    11. data.append("<NS1:Login xmlns:NS1=\"urn:logon\">");
    12. data.append("<login xsi:type=\"xsd:string\">***</login>");
    13. data.append("<pass xsi:type=\"xsd:string\">***</pass>");
    14. data.append("</NS1:crmLogin>");
    15. data.append("</SOAP-ENV:Body> </SOAP-ENV:Envelope>");
    16.  
    17.  
    18.  
    19. http = new QHttp(this);
    20. connect(http, SIGNAL(done(bool)), this, SLOT(finished(bool)));
    21. http->setHost(url.host(),80);
    22. http->request(header, data);
    23. }
    24.  
    25. void system::finished(bool error){
    26. qDebug() << "<finished>" << (error?"error":"ok");
    27. qDebug() << http->readAll(); //can't get any data
    28. qDebug() << "</finished>";
    29. parse();
    30. }
    31.  
    32. void system::parse(){
    33. qDebug() << "<parse>...</parse>";
    34. }
    To copy to clipboard, switch view to plain text mode 


    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......

  6. #6
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT-wince and QHttp::readAll() trouble....

    Can someone who has QT-wince enveronment please test Http POST request?!? maybe it just SDK and platform or what ever trouble......


    Thanks!

  7. #7
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT-wince and QHttp::readAll() trouble....

    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.
    http://trolltech.com/developer/task-...5&method=entry

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.