Qhttp Post method Sample Require !
-
A SOAP and REST producer/consumer, for producer I need to build an HTTP Server, and for a client I need to be able to post information to the server.
It's pretty much a lot of XML/text parsing, and using the HTTP or HTTPS protocol as a transport, for me I felt it was cleaner to use QHttp, because if I want to exchange transports, it sounds more practical to just change QHttp to QFtp to QSomeOtherProtocol, than having to exchange QNetworkAccessManager with QFtp.
As I wrote earlier, it's for better readability and to make the code more "natural". -
[quote author="syedasadalibs03" date="1288798157"]Hello All
i am new to Qt I have to sent Requet to Web Serve through Qhttp Post method
so any one can share the working sample of Qhttp Posti want to use for Symbain
Thanks in Advance[/quote]
"This":http://wiki.forum.nokia.com/index.php/CS001431_-_Creating_an_HTTP_network_request_in_Qt wiki article may help you.
-
[quote author="Raul" date="1291943896"]...for me I felt it was cleaner to use QHttp, because if I want to exchange transports, it sounds more practical to just change QHttp to QFtp to QSomeOtherProtocol, than having to exchange QNetworkAccessManager with QFtp.
As I wrote earlier, it's for better readability and to make the code more "natural".[/quote]QNetworkAccessManager does support FTP too; you would only have to change the URLs of your request and not even exchange some classes.
-
[quote author="Raul" date="1292457329"]Ok cool, and is it easy to implement my own protocols? by just implementing my own protocol class would the QNetworkAccessManager know what class to call depending on what you place on the URL?[/quote]
Simply subclass QNetworkAccessManager, override its createRequest[1] method, and in there check the protocol inside the URL: if it's your custom protocol, do whatever you have to do to serve the request and return a custom QNetworkReply subclass. Otherwise simply call the base class implementation.
Remember that QNAM / QNR design is 100% asynchronous, therefore you're not expected to block in any case.
fn1. Quite a strange name, since it actually creates a reply!
-
[quote author="peppe" date="1292491742"]Remember that QNAM / QNR design is 100% asynchronous, therefore you're not expected to block in any case.[/quote]
As far as I know, it's not forbidden to do a synchronous (blocking) network access there. The UI is only not responsive in that time. And I know that it definitely works with blocking transfers, as that's what we did in our QNetworkReply subclass (although emitting readyRead signal is tricky :-) ).
-
It depends on what you do (as almost always in our business :) ). In most cases you are right, but there are a good bunch of situations where synchronous transfer is critical to the application design, e.g. think of (writing) database access, where you must know if it went good or not. HTTP is more than web sites nowadays ;)
-
[quote author="Volker" date="1291934071"]Ok, it's deprecated, but not removed from the libs, so, you still can use it.[/quote]
According to Synaptics, I have installed the package libqt4-qt3support. Though, it seems I don't have the QHttp Class, as it is neither found by netbeans, nor by my search funcion or manually.
My aim is to use http://medieninf.de/qmapcontrol/ for embedding a (offline) map in my qt application (Only for Desktop so far.).
It's the best libary I have found, but it's outdated (using QHttp...) and I guess there are better libs. So I am hoping for your ideas.If QMapControl is really the only package that fits my needs, I will try to replace QHttp by QNetworkAccessManager. But I don't have much experience in programming, so I am afraid of changeing sources.
Hopeing for your Help!
Konstantin -
Well, I am not using QT to programm, but Netbeans which seems not to use the pro-file. Anyway,
@QT += network@ is already set in the pro file of the "Mapviewer"-example I am trying to compile.
Here are the paths netbeans analizes:
@
/home/konstantin/Desktop/qmapcontrol/QMapControl
/usr/include/qt4
/usr/include/qt4/QtCore
/usr/include/qt4/QtGui
/home/konstantin/NetBeansProjects/mapsurf/
Analyzed system include paths:
/usr/include/c++/4.4
/usr/include/c++/4.4/i686-linux-gnu
/usr/include/c++/4.4/backward
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.4.5/include
/usr/lib/gcc/i686-linux-gnu/4.4.5/include-fixed
/usr/include@For sure, I tried on QT too, but there seems to be a rather basic mistake in my Settings.When I try to compile, it says: Das "Programm konnte nicht gestartet werden. Möglicherweise stimmt der Pfad nicht oder die Berechtigungen sind sind ausreichend?"
But I think I should concentrate on the QHttp problem.
-
I just noticed Netbeans also doesn't find QNetworkAccessManager. So I added /usr/include/qt4/ and some of it's subdirectories to my include list. There also is QHttp. I will tell if I succeed compiling.
-
I did so, but it didn't help, as Netbeans couldn't find the binaries.
But I found the solution: Rightclick the project in Netbeans, choose Build->Qt and check the QtNetwork-Box. This is the analogon to writing @QT += network@ in Qt.
Now it compiles fine.Thank you for your help, it gave me the right idea.