Results 1 to 5 of 5

Thread: Using QHttp in a QDS service

  1. #1
    Join Date
    Oct 2007
    Posts
    8
    Thanks
    1

    Default Using QHttp in a QDS service

    Hi all,

    In a standalone application, I can successfully use QHttp to communicate with a backend server.
    Now I'm trying to publish this communication as a QDS service. Basically, the same code (signal connecting, same slots etc) was transfered to the server.

    The service uses a utility class that executes this QHttp object successfully and retrieves the information I want, though it generates two requestFinished signals.
    The first is right after http->request() and returns a "" string
    The second takes a bit longer (as expected) and returns the desired information.

    I have tried placing the following after http->request():

    Qt Code:
    1. while (!reponseRetrieved) {
    2. loop.processEvents(QEventLoop::AllEvents); // with other parameter variations
    3. }
    To copy to clipboard, switch view to plain text mode 

    But the signal is still executing twice. I'm trying to synchronize the http so the service returns the information correctly.

    Any reason for this behavior?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using QHttp in a QDS service

    First requestFinished signal is probably the result of QHttp::setHost and in that case is perfectly normal. You need to use the request id to look for requests you're monitoring.

  3. The following user says thank you to wysota for this useful post:

    bowser (22nd October 2007)

  4. #3
    Join Date
    Oct 2007
    Posts
    8
    Thanks
    1

    Default Re: Using QHttp in a QDS service

    Hum, that would explain only one done signal, though the actual response should really have requestID = 2 (for the first service call)?

    If that's the normal behavior than ok by me. I'm just curious why wouldn't the setHost count as a request itself when running the same code in a standalone application?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using QHttp in a QDS service

    Maybe the signal was firing before you made the signal/slot connection? Hard to guess without seeing the actual code. I'm sure the behaviour is coherent on all platforms.

  6. #5
    Join Date
    Oct 2007
    Posts
    8
    Thanks
    1

    Default Re: Using QHttp in a QDS service

    Hum, probably. But since the actual purpose is to be in a service, and checking with stateChanged confirmed that only one request is actually sent to the backend server, I'm cool with that.
    Will improve request ID management. Thanks for the info.

Similar Threads

  1. new QHttp() Error
    By fengtian.we in forum Qt Programming
    Replies: 7
    Last Post: 6th October 2010, 17:56
  2. Creating QDS service
    By bowser in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 29th October 2007, 11:12
  3. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  4. QHttp with localhost.
    By William Wilson in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2007, 20:26
  5. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19

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.