Results 1 to 12 of 12

Thread: Send XML 1st line to Amazon

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jun 2014
    Posts
    14
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: Send XML 1st line to Amazon

    Quote Originally Posted by anda_skoa View Post
    At which stage to you get into problems? Creating the XML? Sending it? How does you current code look like? What does it do that you do not expect? What does it not do that you would expect it to do?
    Sorry for being brief. I'm having trouble sending the XML, each time I get an invalid reply. See below:

    Request:
    Qt Code:
    1. QByteArray XMLTest;
    2.  
    3. QXmlStreamWriter swTest(&XMLTest);
    4. swTest.setAutoFormatting(true);
    5. swTest.writeStartDocument();
    6. swTest.writeEndDocument();
    7.  
    8. QUrl Params(BuildRequest(1, account, marketplaces));
    9.  
    10. QNetworkRequest request(Params);
    11.  
    12. QString BodyMD5 = QString(QCryptographicHash::hash((XMLTest),QCryptographicHash::Md5).toHex());
    13.  
    14. request.setRawHeader("Content-Type", "text/xml; charset=iso-8859-1");
    15. request.setRawHeader("Content-MD5", BodyMD5.toLatin1().toBase64());
    16. request.setRawHeader("User-Agent", "TestBuild");
    17. request.setRawHeader("Host", "mws.amazonservices.co.uk");
    18. request.setRawHeader("Transfer-Encoding", "chunked");
    19. request.setRawHeader("MWSClientVersion", "2009-03-09");
    20.  
    21. QNetworkAccessManager test;
    22.  
    23. QEventLoop loop2;
    24. connect(&test, SIGNAL(finished(QNetworkReply*)), &loop2, SLOT(quit()));
    25. QNetworkReply *reply = test.post(request, request.url().query().toUtf8());
    26. loop2.exec();
    27.  
    28. QString str = reply->readAll();
    To copy to clipboard, switch view to plain text mode 

    str returns an empty string, and the status code is 0.


    BuildRequest:
    Qt Code:
    1. QUrl req("https://mws.amazonservices.co.uk");
    2.  
    3. QUrlQuery q;
    4.  
    5. q.addQueryItem("AWSAccessKeyId", AccessKey);
    6. q.addQueryItem("Action", action);
    7. q.addQueryItem("Merchant", MerchantID);
    8. q.addQueryItem("SignatureVersion", "2");
    9. q.addQueryItem("Timestamp", Timestamp.toString());
    10. q.addQueryItem("Version", "2009-01-01");
    11. q.addQueryItem("Signature", Signature);
    12. q.addQueryItem("SignatureMethod", "HmacSHA256");
    13. q.addQueryItem("FeedType", type);
    14. q.addQueryItem("MarketplaceIdList.Id." + MarketplaceListID, marketplace.value("MarketplaceID").toString());
    15. q.addQueryItem("PurgeAndReplace", "false");
    16.  
    17. req.setQuery(q);
    18. return req;
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by ChrisW67 View Post
    What does "XML 1st line" even mean?
    I just want to send the XML 1st line (the XML declaration) to Amazon, for testing purposes.
    Last edited by Poonarge; 8th July 2014 at 09:40.

Similar Threads

  1. HTTPS request returns damaged HTML body
    By ljuhrich in forum Qt Programming
    Replies: 6
    Last Post: 2nd June 2013, 08:37
  2. Replies: 1
    Last Post: 6th February 2013, 12:18
  3. send a special request using AT command
    By baobui in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 13th December 2011, 11:28
  4. send request via ISA PROXY SERVER
    By rmagro in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2010, 22:56
  5. How do I send data with http post request?
    By Morea in forum Qt Programming
    Replies: 13
    Last Post: 21st January 2009, 22:51

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.