Results 1 to 8 of 8

Thread: SOAP API on Qt 5.3 - POST Request Wrong

  1. #1
    Join Date
    Jun 2014
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default SOAP API on Qt 5.3 - POST Request Wrong

    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.

  2. #2
    Join Date
    Jun 2014
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    It's URGENT guys. My project's work is completely blocked. Any help would be great.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    Can you check the value of "url"? Does it contain the path?
    Have you tried "/service1.asmx"?

    Btw, if you want a more comfortable way of working with SOAP in Qt, check out https://github.com/KDAB/KDSoap
    It has a code generator that can make Qt classes for interfaces specified in WSDL files.

    Cheers,
    _

  4. #4
    Join Date
    Jun 2014
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    Thanks anda_skoa for the reply.

    Ya, I did check in the debugger both in the url (which is a object of QUrl) & networkMgr ( object of QNetworkAccessManager) both have url set.

    Ya, I even tried changing to /service1.asmx but to no avail. In the header, where the URL should be, remains blank. I thinking of it as a bug on the Qt side.

    And I did check KDSOAP, I downloaded the code in ZIP from their site. But, the project doesn't compile in 4.7.4.
    It's giving me error like this:
    WARNING: d:\Projects\KDSoap-master\KDSoap-master\kdsoap.pro:43: Unescaped backslashes are deprecated.
    Project MESSAGE: No install prefix given, using default of C:\KDAB\KDSoap- (use configure -prefix DIR to specify)
    Project MESSAGE: Install prefix is C:\KDAB\KDSoap-
    Project MESSAGE: This is KD Soap version
    The process "c:\qtsdk\desktop\qt\4.7.3\mingw\bin\qmake.exe " exited with code 3.
    Error while building project kdsoap (target: Desktop)
    When executing build step 'qmake'

    I think there is error in .pro file. But, the pro file seems too complex for me to understand.

    And, I have a situation here, I need to compile SOAP in Qt 5.3 Android Platform and it not even running for 4.7.4.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    According to INSTALL.txt it should be buildable with Qt5

    Since that is your target anyway, why try with Qt4?

    Cheers,
    _

  6. #6
    Join Date
    Jun 2014
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows Android

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    Project MESSAGE: No install prefix given, using default of C:\KDAB\KDSoap- (use configure -prefix DIR to specify)
    Project MESSAGE: Install prefix is C:\KDAB\KDSoap-
    Project MESSAGE: This is KD Soap version
    Cannot read D:/Projects/KDSoap-master/KDSoap-master/include: No such file or directory
    MAKEFILE_GENERATOR variable not set as a result of parsing : include. Possibly qmake was not able to find files included using "include(..)" - enable qmake debugging to investigate more.
    Reading D:/Projects/KDSoap-master/KDSoap-master/examples/holidays_wsdl/holidays_wsdl.pro [D:/Projects/KDSoap-master/build-kdsoap-Desktop_Qt_5_3_0_MinGW_32bit-Debug/examples/holidays_wsdl]
    14:47:56: The process "D:\Qt_5_3\5.3\mingw482_32\bin\qmake.exe" exited with code 3.
    Error while building/deploying project kdsoap (kit: Desktop Qt 5.3.0 MinGW 32bit)
    When executing step 'qmake'


    getting same kind of message in qt 5.3 as well

  7. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    Strange.

    You could file a report in their issue tracker.

    Cheers,
    _

  8. #8
    Join Date
    Feb 2016
    Posts
    21
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: SOAP API on Qt 5.3 - POST Request Wrong

    run ./autogen.py and than make (not qmake)

Similar Threads

  1. POST request - getting cookie
    By Trok in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2012, 00:32
  2. ASP .NET - POST request method
    By Trok in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2011, 23:52
  3. Request ID of QNetworkaccessmanager get and post request
    By dineshkumar in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2011, 22:56
  4. sending soap request using QNetworkAccessManager question
    By babymonsta in forum Qt Programming
    Replies: 10
    Last Post: 21st April 2010, 08:55
  5. POST request to a web service
    By QPlace in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2008, 09:05

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.