Results 1 to 4 of 4

Thread: Problem with QHttp

  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with QHttp

    Hi,

    I want to send an XML Schema File to a MULTI-PART server running web-service and the server automatically replies back with an XML File.

    I have constructed the Http Header as follows.

    Qt Code:
    1. QFile infile;
    2. infile.setFileName("Path\\GetInfoSchema.xsd");
    3. if (!infile.open(QIODevice::ReadOnly))
    4. {
    5. return;
    6. }
    7. QByteArray inputStr(infile.readAll());
    8.  
    9. outfile.setFileName("Path\\webSrvResult.xml");
    10. outfile.open(QIODevice::WriteOnly | QIODevice::Truncate);
    11.  
    12. QUrl url("webserver/PelletTestWebServiceWeb/");
    13. http->setHost(url.host(), url.port(80));
    14.  
    15. QHttpRequestHeader header("POST", "http://xyzserver:8080/PelletTestWebServiceWeb/XmlQueryInterface");
    16. header.setValue("multipart/mixed", "application/x-www-form-urlencoded");
    17. http->request(header,inputStr, &outfile);
    To copy to clipboard, switch view to plain text mode 

    But the problem is that I am unable to get back the XML document from the server using this. I am being told that this is due to the fact that the server is Multipart.

    But I am unable to solve this.

    Can anyone please help?

    Thanks!
    Last edited by wysota; 19th March 2009 at 13:34. Reason: missing [code] tags

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

    Default Re: Problem with QHttp

    What do you mean that you are unable to get the xml document back? Don't you receive any response from the server?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QHttp

    Yeah I am unable to get the XML from the server because it is a Multi-part server. I don't know how to send multi-part requests in Qt.
    Please Help

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

    Default Re: Problem with QHttp

    So it's not that you can't get something back but rather that you don't know how to send a properly formatted data to the server, right? I suggest you take a network sniffer and intercept a browser connection to the server handling the request and look how the data should be formatted. Alternatively craft an artificial server (like using netcat or a simple hand-written tcp server), get a form that uses multipart formatting, redirect it to your artificial server and use a browser to send such request. Then you'll know how the data should look like. Yet another way is to use a web search engine to find out how multi-part requests are formed.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QHttp proxy problem
    By andre.rigon in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2008, 21:19
  2. problem in using QHttp
    By Ferdous in forum Newbie
    Replies: 4
    Last Post: 10th September 2008, 12:07
  3. Problem in using QHttp with QTimer
    By Ferdous in forum Newbie
    Replies: 2
    Last Post: 6th September 2008, 12:48
  4. QHttp download file problem.
    By fengtian.we in forum Qt Programming
    Replies: 12
    Last Post: 12th June 2007, 09:39
  5. QHttp Problem
    By musaulker in forum Newbie
    Replies: 4
    Last Post: 29th March 2007, 00:40

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.