PDA

View Full Version : QtSoapHttpTransport and Proxy authentication



rmagro
15th December 2008, 13:30
Hi all,

I developed a client program able to send Soap request and to get a response from a Web Server, using the QtSoap module.

"QtSoapHttpTransport" Class anyway seem not ho handle proxy authentication..
(I mean, there is a method ..like setHost wich take as parameters proxy name, proxy port, username and pwd)

is it like this? If so, how can we manage to get throught proxy ?

Did Any of you experience something related to this problem ?

thank you for your help..

Roby

rmagro
16th December 2008, 09:00
Hi all,

I developed a client program able to send Soap request and to get a response from a Web Server, using the QtSoap module.

"QtSoapHttpTransport" Class anyway seem not ho handle proxy authentication..
(I mean, there is a method ..like setHost wich take as parameters proxy name, proxy port, username and pwd)

is it like this? If so, how can we manage to get throught proxy ?

Did Any of you experience something related to this problem ?

thank you for your help..

Roby




Any Idea ??

patrik08
16th December 2008, 09:22
Any Idea ??

try to get IE proxy settings from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsCurre ntVersion\Internet Settings
parameters:
ProxyEnable
ProxyOverride
ProxyServer


I suppose on a dialog you must take params and fill QAuthenticator...



void HttpSoapConnection::slotAuthenticationRequired( QNetworkReply *reply, QAuthenticator *authenticator )
{
Q_UNUSED( reply );

kWarning() << "Got http authentication request for" << authenticator->realm() <<
"while connecting to" << endpoint_;
}

rmagro
16th December 2008, 12:07
Thank you Patrick for your help.

I have already abtained the information about Proxy configuration on the windows Registry..
but I do not understand than the solution proposed..

What I mean is..
I was expecting using the QtSoapHttpTransport class some method like
setProxy (ot setUser) like it is in QHTTP class..

but those similar methods are not there..right?

Can you then give a simple how to use the solution proposed..

I have something similar to the example proposed in the QT DOC

void WeatherFetcher::findTemperature(const QString &city)
{
QtSoapMessage message;
message.setMethod("getTemperature", "http://weather.example.com/temperature");
message.setMethodArgument("city", "", city);

// transport is a private member of WeatherFetcher, of type QtSoapHttpTransport
transport.setHost("www.example.com");
connect(&transport, SIGNAL(responseReady()), SLOT(readResponse()));

transport.submitRequest(message, "/weatherfetcher/fetch.asp");
}
This is an example implementation of the readResponse() slot in the WeatherFetcher class:
void WeatherFetcher::readResponse()
{
const QtSoapMessage &response = transport.getResponse();
if (response.isFault()) {
cout << response.faultString().toString().toLatin1().const Data() << endl;
return;
}

const QtSoapType &returnValue = response.returnValue();
if (returnValue["temperature"].isValid()) {
cout << "The current temperature is "
<< returnValue["temperature"].toString().toLatin1().constData()
<< " degrees Celcius." << endl;
}

Many thanks