Groups | Blog | Home
all groups > dotnet web services > november 2006 >

dotnet web services : consuming webservice trough proxy


Boni
11/20/2006 4:43:01 AM
I want consuming a webserivce trough a proxy. I use this code.
myService s = new myService ();

System.Net.WebProxy proxyObject = new
System.Net.WebProxy("http://proxyhost:8080");
s.Proxy = proxyObject;

It doesn't works, it returns a error
HTTP 407: Proxy Authentication Required ( Access is denied. ).
But my proxy don't need a user Authentication.

The same code used with another object ( WebClient ) works good!

System.Net.WebClient wc = new System.Net.WebClient();
System.Net.WebProxy proxyObject = new
System.Net.WebProxy("http://proxyhost:8080");
wc.Proxy = proxyObject;
string test = wc.DownloadString("http://www.mysite.com");

Someone can help me?
thank you very mutch.
Claus Konrad [MCSD]
11/20/2006 1:21:02 PM
It is the server who decides what is required to use it's services.
Hence, your proxy should obey to what the server states.

If using IIS as host, set allow anonymous access and verify that everything
works.

If so - introduce security by using WSE and sign the SOAP message itself.
This is preferred over point-to-point authentication.
--
rgds.
/Claus Konrad
MCSD.NET (C#)


[quoted text, click to view]
Boni
11/21/2006 12:27:01 AM
Thank you for your answer, but I don't understand.
I have to pass trough a proxy to have a internet connection. The webservice
I want cosume it's outside my net.
So if I use my app to consume the same webservice on a PC with direct access
to internet I don't have problem, but I can't set the proxy on my client app
to have the same result on a PC behind a proxy.

You would say that the webservice webserver (IIS) recongnize that the call
came from a app behind a proxy instead with a direct connection so its answer
is different? And I have to change the permissions on my webserver?

best regards
Boni

[quoted text, click to view]
Greg Shaw
11/30/2006 12:00:00 AM
Boni,
What Claus is saying is that if you can change your webservice host
so that it allows anonymous access you can check that everything
is working. If you get the same error (407) with the webservice host
set to anonymous then it is not your webservice host that has the
problem. This is just for verification.

Cheers, Greg.

[quoted text, click to view]
AddThis Social Bookmark Button