WebService Client not authenticating through Proxy Server

J

JD

Hello,

We have a windows form application that consumes a web service using the
standard service-proxy class created by "Add Web Reference..." (wsdl.exe). On
some end-user machines, the app needs to get out through an authenticating
proxy server to get to the internet.

In the MSDN docs for the HttpWebClientProtocol.Proxy member, it indicates
that the default behavior is to use the operating system's settings (Control
Panel->InternetSettings). We're either misunderstanding what that means or
finding it not to be the case. When the users in question just open IE and
browse to the web service end-point, they see it fine. When the app makes the
request using the web reference, it can't get past the proxy server
(Unauthorized/401). We've duplicated this on internal test machines as well
(clients are running XP Pro SP1), with a fairly simple test harness.

We then looked at using System.Net.CredentialCache.DefaultCredentials, which
the documentation says will be the current user's username/password/domain
details. Unfortunately, that didn't seem to work either and all the members
on DefaultCredentials are blank.

On the other hand, if we hardcode a login/password/domain in the test
harness, it connects OK. We would definitely prefer NOT to make our app's
"Options" dialog include an area for the user's proxy details -- especially
since we know they've already been specified in the system's "Internet
Settings" control panel applet.

Any insight into what the missing piece is for us here?

Thanks,

JD
 
L

Lalitha

Hi JD,
When you browse the Web service in IE it will be making Http Get and Http
Post calls so this will work even you have proxy server setting. When you
call the web service from client then it will be making Soap calls. You
need to make changes in machine.config. Check the following articles:
318140 PRB: Error on .NET client that consumes a Web service through an HTTP
http://support.microsoft.com/?id=318140
307220 HOW TO: Configure an XML Web Service Client by Using the .NET
Framework
http://support.microsoft.com/?id=307220
Hope this will resolve your issue.
Thank you, Lalitha
Microsoft, Distributed services

This posting is provided "AS IS", with no warranties, and confers no rights.
 
J

JD

Hi Lalitha,

Thanks for pointing me to those articles. Our Winforms/desktop app doesn't
ship with a machine.config, as suggested in KB 318140. I suppose it's
conceivable we could put one on the user's machine, but that may mess up any
existing one they already have where the framework is installed.

That same KB article offers a code snippet that it says is supposed to do
the same thing as the machine.config approach. The problem is that the code
snippet requires that the URL of the proxy server be specified.

If we can possibly help it, we'd like to avoid needing the user to specify
their proxy server address/port. Do you know if there's an equivalent in code
to the machine.config approach (below), which essentially says "use the
system settings, period"?

<system.net>
<defaultProxy>
<proxy
usesystemdefault = "true"
/>
</defaultProxy>
</system.net>

We've been unable to find something that does essentially this via code as
most examples suggest the specify-an-address approach:

IWebProxy proxyObject = new WebProxy("http://myproxyserver:80", true);

Thanks for any assistance you can provide,

Jeff
 
L

Lalitha

Hi JD,
I want to get some clarification regarding the original question.
-Do you see the error when trying to add webreference in the ASP.NET web
app or you are seeing the error when accessing the WebService inside
ASP.NET Webapp? Can you send the error message?
-Have you tried using Windows/console app for calling this Web Service? Do
you see any problems there?
-Which proxy server is configured in your IE-InternetOptions---Proxy Server
setting. Is that your Default Proxy server which you want to use now?
Thank you, Lalitha
Microsoft, Distributed services

This posting is provided "AS IS", with no warranties, and confers no rights.
 
J

JD

Hi Lalitha,
-Do you see the error when trying to add webreference in the ASP.NET web
app or you are seeing the error when accessing the WebService inside
ASP.NET Webapp? Can you send the error message?

The error occurs when our Winforms app, running on a machine that's behind
the proxy server, calls the web service. The error is the basic HTTP
Unauthorized message (403, I believe it is).
-Have you tried using Windows/console app for calling this Web Service? Do
you see any problems there?

As I mentioned in the original post, this is with a Winforms app. The only
time it has problems is when trying to reach the web service through an
authenticating proxy server.
-Which proxy server is configured in your IE-InternetOptions---Proxy Server
setting. Is that your Default Proxy server which you want to use now?

Mine has no proxy server. This is on a client machine whose IE options
contain an IP address and port for their proxy server. We'd like to use those
settings from our app instead of having to have a separate set of proxy
options for just our application. Please check the original post for those
details.

Thanks,

JD
 
L

Lalitha

Hello JD,
In the client machine if the IE options contains an IP address and port for
their proxy server then it should have updated in the registry
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings

Can you verify the Proxy server in registry and see that got updated?

Can you send the full error message? Full error message is really important
to identify the issue
Thank you,
Lalitha
Microsoft, Distributed services

This posting is provided "AS IS", with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,736
Latest member
zacharyharris

Latest Threads

Top