Hello all,
I apologise in advance for the long windedness of
this post, but I feel that if I am going to get any
solution to this problem, it is important that I present
as much information that will be useful in diagnosing
the problem.
I have an application which calls a method of a web service
that we host remotely. I have deployed the application to a
client site on which access to the Internet is done through
a proxy server. However, the application on this site is
unable to call the web service method.
It appears that the proxy server requires authentication -
when the users of machines on the site wish to access the web
and start up a web browser, they are presented with a dialog
box in which they type in a UserName and PassWord.
I have tried various different means to call the web service
method, but I have had no success.
I have written code snippets below describing the attempts
I have made to connect to the Internet via this proxy.
Before I describe the various means I have tried, here
are variables that I have used in calling the web service
method:
Dim cred As ICredentials
Dim nwCred as NetworkCredential
Dim cCache As CredentialCache
'this will hold the address of the proxy server thru which
'connections are made to the Internet
Dim proxyURI As String = "http://proxyserveraddress"
Dim uname As String
Dim pwd As String
'this is the proxy generated for my web service
Dim wsObj As MyWebServiceProxy
Now for the code snippets:
Attempt 1 - using default credentials
cred = CredentialCache.DefaultCredentials
'ws obj creation block
wsObj = New MyWebServiceProxy()
wsObj.Proxy = new WebProxy(proxyURI, True, Nothing)
wsObj.Proxy.Credentials = cred
wsObj.Credentials = cred
wsObj.MyWebServiceMethod()
Error Message: The request failed with HTTP status 407:
Proxy authentication required.
Attempt 2 - using supplied credentials
'this is the same UserName/PassWord combination
'supplied before users can browse the web
uname = "UserName"
pwd = "PassWord"
nwCred = New NetworkCredential(uname, pwd)
cred = nwCred
'ws obj creation block as with attempt 1, i.e.
wsObj = New MyWebServiceProxy()
...
wsObj.MyWebServiceMethod()
Error Message: The underlying connection was closed:
An unexpected error occurred on a receive.
Attempt 3 - using NTLM authentication
'this is the same UserName/PassWord combination
'supplied before users can browse the web
uname = "UserName"
pwd = "PassWord"
nwCred = New NetworkCredential(uname, pwd)
cCache = new CredentialCache()
cCache.Add(new uri(ProxyURI), "NTLM", nwCred)
cred = cCache
'ws obj creation block as with attempt 1, i.e.
wsObj = New MyWebServiceProxy()
...
wsObj.MyWebServiceMethod()
Error Message: The request failed with HTTP status 407:
Proxy authentication required.
Attempt 4 - using negotiate authentication
This is identical to attempt 3, except that
in place of
cCache.Add(new uri(ProxyURI), "NTLM", nwCred)
I have
cCache.Add(new uri(ProxyURI), "Negotiate", nwCred)
Error Message: The request failed with HTTP status 407:
Proxy authentication required.
Attempt 5 - using basic authentication
This is identical to attempt 3, except that
in place of
cCache.Add(new uri(ProxyURI), "NTLM", nwCred)
I have
cCache.Add(new uri(ProxyURI), "Basic", nwCred)
Error Message: The underlying connection was closed:
An unexpected error occurred on a receive.
Attempt 6 - using digest authentication
This is identical to attempt 3, except that
in place of
cCache.Add(new uri(ProxyURI), "NTLM", nwCred)
I have
cCache.Add(new uri(ProxyURI), "Digest", nwCred)
Error Message: The request failed with HTTP status 407:
Proxy authentication required.
If you've made it this far, thanks for at least
reading through the post. Any answer(s) will be
gratefully received.

Signature
Akin
aknak at aksoto dot idps dot co dot uk
Nicole Calinoiu - 04 Aug 2004 16:11 GMT
Akin,
Different proxy servers have different authentication requirements, and
deriving these from user behaviour is a bit of stretch. Have you considered
discussing the problem with a network administrator at this client site?
Nicole
> Hello all,
>
[quoted text clipped - 136 lines]
> reading through the post. Any answer(s) will be
> gratefully received.
Wild Wind - 05 Aug 2004 01:46 GMT
Hello Nicole,
Thanks for the response.
I could certainly speak to the network administrator
to find out what authentication requirements their proxy
server have - it's just that I'm not too sure that they
fully understand how it's been set up, so I would need to
know what specific questions to ask to resolve this problem.
So could you tell me what I should specifically ask for,
and how, based on this information, I could go about
resolving the connectivity problem?
TIA,
Akin
> Akin,
>
[quoted text clipped - 11 lines]
> > as much information that will be useful in diagnosing
> > the problem.
<snip>
> > Akin
> >
> > aknak at aksoto dot idps dot co dot uk
Nicole Calinoiu - 05 Aug 2004 20:27 GMT
Akin,
Well, someone knows, and it won't be either the users or someone with no
access to the systems involved. <g> Your best bet is to find the IT person
with responsibility for the proxy. If he doesn't know enough details, he
can probably at least provide you with the product documentation and/or
locate an appropriate vendor contact. As for questions to ask, you could
start with the value of every property you'll need to set for the WebProxy
class, including the user name, password, domain, and authentication type
for the credentials.
HTH,
Nicole
> Hello Nicole,
>
[quoted text clipped - 36 lines]
>> >
>> > aknak at aksoto dot idps dot co dot uk