PDA

View Full Version : "Host not found" using QtSoap



TorAn
18th August 2010, 21:26
I have an empty website(asp.net v3.5) on local machine.
http://localhost:54254/web/

There is a webservice which I am trying to use from Qt-based app.
http://localhost:54254/Web/submitDataStats.asmx

When I am using .net client everything works as expected. I can reach both of these addresses through the browser and my .net client consumes this service without any problem.

For usage of this webservice from Qt4.6.3 client I downloaded and compiled qtsoap-2.7_1-opensource

I am using "Easter" example project, just slightly modifying it:


MyEaster::MyEaster(QObject *parent) : QObject(parent), http(this)
{
connect(&http, SIGNAL(responseReady(const QtSoapMessage &)),
this, SLOT(getResponse(const QtSoapMessage &)));

QtSoapMessage request;
request.setMethod("tdstats", "http://localhost:54254/Web/");
request.addMethodArgument("value", "", "csp");
request.addMethodArgument("stats", "", "stats");

http.setHost("http://localhost/", false, 54254);
http.setAction("http://localhost:54254/web/submitDataStats/tdstats");
http.submitRequest(request, "web/submitDataStats.asmx");
}
void MyEaster::getResponse(const QtSoapMessage &message)
{
if (message.isFault()) {
qDebug("Error: %s", qPrintable(message.faultString().toString()));
...
}
Problem:

message argument in getResponse returns "Host not found". No matter how I change the parameters the error is the same - "host not found".

Any help or advise with this issue will be greatly appreciated.

alexisdm
19th August 2010, 01:36
You should try:

http.setHost("localhost", false, 54254);

TorAn
19th August 2010, 03:46
Thank you, it did work. After you pointed this out it is pretty clear that one should not specify http protocol in QtSoapHttpTransport method call :o