Connecting to a web service thru a proxy server
From: Wild Wind (nobody_at_blackhole.com)
Date: 08/03/04
- Next message: gautamks: "Re: Problens for to get a Store Location with capicom"
- Previous message: Nicole Calinoiu: "Re: Requested Registry access is not allowed"
- Next in thread: Nicole Calinoiu: "Re: Connecting to a web service thru a proxy server"
- Reply: Nicole Calinoiu: "Re: Connecting to a web service thru a proxy server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 3 Aug 2004 15:42:40 +0100
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.
-- Akin aknak at aksoto dot idps dot co dot uk
- Next message: gautamks: "Re: Problens for to get a Store Location with capicom"
- Previous message: Nicole Calinoiu: "Re: Requested Registry access is not allowed"
- Next in thread: Nicole Calinoiu: "Re: Connecting to a web service thru a proxy server"
- Reply: Nicole Calinoiu: "Re: Connecting to a web service thru a proxy server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|