Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Communicating with gSoap - QNetworkReply::NetworkError(ContentNotFoundError)
Qt 6.11 is out! See what's new in the release blog

Communicating with gSoap - QNetworkReply::NetworkError(ContentNotFoundError)

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
2 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PaperMoon
    wrote on last edited by
    #1

    The application on the other side uses gSoap for providing SOAP . I have the request samples from gSOAP to build the respective request XML in Qt. I have included one small sample below.

    I have been trying to get the request successfully built and sent from Qt but somehow it is not working.

    Thankful for any pointers/inputs to resolve this.

    Development Environment
    Linux Debian
    Qt 5.9.2
    SSL - 1.0.2 supported and available

    Error
    Network error: QNetworkReply::NetworkError(ContentNotFoundError)

    gSOAP request sample

    POST / HTTP/1.1
    Host: IP_Address:8000
    User-Agent: gSOAP/2.8
    Content-Type: text/xml; charset=utf-8
    Content-Length: 476
    Connection: close
    
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:ns2="http://tempuri.org/ns2.xsd"
        xmlns:ns1="http://tempuri.org/ns1.xsd">
     <SOAP-ENV:Body>
      <ns1:getAPTListByICAO>
       <icaoPart>YSSY</icaoPart>
      </ns1:getAPTListByICAO>
     </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    This is what I have in Qt
    (it looks a bit messy though)

        QNetworkAccessManager manager;
        QNetworkRequest request;
        request.setRawHeader("Content-Type", "text/xml;charset=UTF-8");
        request.setRawHeader("Content-Length", "1024");
        request.setRawHeader("SOAPAction", "getAPTListByICAO");
        request.setUrl(QUrl("http://tempuri.org/ns1.xsd"));
        request.setRawHeader("User-Agent","gSOAP/2.8");
        request.setRawHeader("Host","ip.ip.ip.ip:8000");
        request.setRawHeader("Connection","Close");
    
        QString query =
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                "<SOAP-ENV:Envelope"
                    "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""
                    "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\""
                    "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
                    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
                    "xmlns:ns2=\"http://tempuri.org/ns2.xsd\""
                    "xmlns:ns1=\"http://tempuri.org/ns1.xsd\">"
                 "<SOAP-ENV:Body>"
                  "<ns1:getAPTListByICAO>"
                   "<icaoPart>YSSY</icaoPart>"
                  "</ns1:getAPTListByICAO>"
                 "</SOAP-ENV:Body>"
                "</SOAP-ENV:Envelope>";
    
        QNetworkReply* reply = manager.post(request, query.toUtf8());
    
        QEventLoop eventLoop;
    
        QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
        eventLoop.exec();
    
        if (reply->error() != QNetworkReply::NoError)
        {
            qDebug() << "Network error: " << reply->error();
        }
        else
        {
            qDebug() << reply->readAll();
        }
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Not a direct answer but since you are doing SOAP, you might want to consider using the KDSoap.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved