Working on code to use a REST interfact to exchange information to a cloud service. My issue is that this service makes two replies to a JSON post:

URL1: Simple success message <<< This is the same URL that JSON is posted too
ULR2: Detailed message

This is how I would post to URL1...not showing JSON:

Qt Code:
  1. QUrl serviceUrl = QUrl("URL1");
  2. QNetworkRequest request(serviceUrl);
  3. QNetworkAccessManager *networkManager = new QNetworkAccessManager(this);
  4. connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_post_answer(QNetworkReply*)));
  5. networkManager->post(request, doc.toJson());
To copy to clipboard, switch view to plain text mode 

I get the simple success message here:
Qt Code:
  1. void MainWindow::on_post_answer(QNetworkReply *reply) {
  2. QString msg;
  3. QByteArray resp;
  4. QNetworkReply::NetworkError error_type;
  5.  
  6. error_type = reply->error();
  7. if (error_type == QNetworkReply::NoError) {
  8. resp = reply->readAll();
  9. msg = "Success - Response: " + resp;
  10. }
  11. else {
  12. msg = "Error - Response: " + reply->errorString();
  13. }
  14. QMessageBox::information(this, "", msg);
To copy to clipboard, switch view to plain text mode 

All of that works as expected. But how can I listen on another URL for a response? I've tried the following:

  • Send a HTTP get to URL2 after URL1 post is complete...returns error
  • Send a HTTP post to URL2 with "" as data packet after URL2 post is complete...returns error


Is there a way to simply listen on URL2 using QNetworkAcessManager and have a signal fire if anything appears on URL2?

Thanks!