I am using SOAP API of Qt.
They have qtsoap.h & qtsoap.cpp files which I just simply included into my project.
I know this was originally was written for Qt4. And it works great with Qt 4.7.4 & Qt 4.8
Now, I wanted to port the same to Qt 5.3

The SOAP Message forms correctly by the API but the header is incorrect.

Header generated on Qt 4.7.3:
POST /service1.asmx HTTP/1.1
Content-Type: text/xml;charset=utf-8
SOAPAction: http://ireo.org/getBBProp
Content-Length: 457
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Host: 10.1.0.66:80

Header generated on Qt 5.3 (which is wrong, service1.asmx is missing):
POST HTTP/1.1
Content-Type: text/xml;charset=utf-8
SOAPAction: http://ireo.org/getBBProp
Content-Length: 457
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Host: 10.1.0.66:80

SOAP Message generated on both Qt 4.7.4 & Qt 5.3 (is correct for both complilers):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<getBBProp xmlns="http://ireo.org/">
<deviceid xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">user1</deviceid>
</getBBProp>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Now you can see, the issue is in the header generated. The difference in 5.3 is that the url which I set is missing which is in our case is service1.asmx
And header is not generated by the SOAP API but by the QNetworkAccessManager

Here's the code I am using for generating SOAP message and sending, which was working fine in Qt 4.7.4:
Qt Code:
  1. QtSoapHttpTransport m_soapHttpTransport;
  2. m_soapHttpTransport.setAction("http://ireo.org/getBBProp");
  3. m_soapHttpTransport.setHost("10.1.0.66",80);
  4.  
  5. QtSoapMessage request;
  6. request.setMethod(QtSoapQName("getBBProp", "http://ireo.org/"));
  7. request.addMethodArgument("deviceid", "", userid); //userid = "user1"
  8. qDebug()<<request.toXmlString();
  9.  
  10. m_soapHttpTransport.submitRequest(request, "service1.asmx");
To copy to clipboard, switch view to plain text mode 


Now, when the SOAP message is formed which I have printed as request.toXmlString() which is correct is passed to the submitRequest.



Here's the code in the SOAP API for the submitRequest, in qtsoap.h:
Qt Code:
  1. /*!
  2.   Submits the SOAP message \a request to the path \a path on the
  3.   HTTP server set using setHost().
  4. */
  5. void QtSoapHttpTransport::submitRequest(QtSoapMessage &request, const QString &path)
  6. {
  7. QNetworkRequest networkReq;
  8. networkReq.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("text/xml;charset=utf-8"));
  9. networkReq.setRawHeader("SOAPAction", soapAction.toLatin1());
  10. url.setPath(path);
  11. networkReq.setUrl(url);
  12.  
  13. soapResponse.clear();
  14. networkRep = networkMgr.post(networkReq, request.toXmlString().toUtf8().constData());
  15. }
To copy to clipboard, switch view to plain text mode 

the soap message is passed to the networkMgr and uses the .post method and then when I check the header is missing.

Is it a bug in QNetworkAccessManager of Qt 5.3 or in SOAP API or error on my part. I don't seem to know.

If anything doesn't work out, then I am thinking of writing the SOAP header myself and then generating the SOAP message from the SOAP API & sending over TCPSocket.