Results 1 to 6 of 6

Thread: How to invoke a executable that sends n/w request & gets xml response

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How to invoke a executable that sends n/w request & gets xml response

    I have a executable that takes some arguments and sends n/w request and gets xml file/bytes as response. How do I execute this ?

    On my CentOS, I execute it in terminal as
    Qt Code:
    1. ./myUtil --xml-output --password-file=myPassword --trf-downrate myUsername@my.serverName.com::home/
    To copy to clipboard, switch view to plain text mode 
    As a result, I get
    Qt Code:
    1. <item trf_type="download" trf_rate="447.14kB/s"/>
    To copy to clipboard, switch view to plain text mode 

    How do I replicate the same from Qt program. Kindly help me with this.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to invoke a executable that sends n/w request & gets xml response

    QProcess

    Cheers,
    _

  3. #3
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to invoke a executable that sends n/w request & gets xml response

    Yeah, I tried the same.
    For this
    Qt Code:
    1. ./myUtil --xml-output --password-file=myPassword --trf-downrate myUsername@my.serverName.com::home/
    To copy to clipboard, switch view to plain text mode 
    I tried like this
    Qt Code:
    1. void CWorker::startProcess()
    2. {
    3. QString idevsUtil = "./idevsutil";
    4. QStringList args = "--xml-output" << "--password-file=myPasswrd" << "--trf-downrate" << "myUsernameUser1@gmail.com@irs345.server.com::home/";
    5.  
    6. mProcess->startDetached(idevsUtil, args); // mProcess is a member variable allocated in constructor
    7. }
    8.  
    9.  
    10. // In main
    11. CWorker worker;
    12. worker.startProcess();
    To copy to clipboard, switch view to plain text mode 

    But I got error saying -
    Qt Code:
    1. error: invalid operands of types 'const char [13]' and 'const char [26]' to binary 'operator<<'
    To copy to clipboard, switch view to plain text mode 

    I'm unable to crack this.
    Last edited by rawfool; 21st February 2014 at 14:24.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to invoke a executable that sends n/w request & gets xml response

    Yours Qt have disabled QString::QString ( const QByteArray & ba ) constructor. Read more in QString doc.

  5. #5
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to invoke a executable that sends n/w request & gets xml response

    There is no operator << for character arrays:
    Qt Code:
    1. "--xml-output" << "--password-file=myPasswrd" << "--trf-downrate" << "myUsernameUser1@gmail.com@irs345.server.com::home/"
    To copy to clipboard, switch view to plain text mode 
    I think you meant
    Qt Code:
    1. args << "--xml-output" << "--password-file=myPasswrd" << "--trf-downrate" << "myUsernameUser1@gmail.com@irs345.server.com::home/";
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to stampede for this useful post:

    rawfool (21st February 2014)

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to invoke a executable that sends n/w request & gets xml response

    And just in case you have noticed by now: startDetached() is a static method.

    Cheers,
    _

Similar Threads

  1. Request ID of QNetworkaccessmanager get and post request
    By dineshkumar in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2011, 21:56
  2. Qhttp request and response debugging
    By William Wilson in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2010, 22:51
  3. Replies: 0
    Last Post: 25th April 2010, 15:50
  4. Replies: 0
    Last Post: 13th March 2010, 21:00
  5. Qhttp::request(...) method and GET request
    By mikhailt in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2006, 12:26

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
  •  
Qt is a trademark of The Qt Company.