473,548 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting to a web service thru a proxy server

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 NetworkCredenti al
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://proxyserveraddr ess"

Dim uname As String
Dim pwd As String

'this is the proxy generated for my web service
Dim wsObj As MyWebServicePro xy

Now for the code snippets:

Attempt 1 - using default credentials
cred = CredentialCache .DefaultCredent ials

'ws obj creation block
wsObj = New MyWebServicePro xy()
wsObj.Proxy = new WebProxy(proxyU RI, True, Nothing)
wsObj.Proxy.Cre dentials = cred
wsObj.Credentia ls = cred
wsObj.MyWebServ iceMethod()

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 NetworkCredenti al(uname, pwd)
cred = nwCred

'ws obj creation block as with attempt 1, i.e.
wsObj = New MyWebServicePro xy()
....
wsObj.MyWebServ iceMethod()

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 NetworkCredenti al(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 MyWebServicePro xy()
....
wsObj.MyWebServ iceMethod()

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
Nov 21 '05 #1
3 7758
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
"Wild Wind" <no****@blackho le.com> wrote in message
news:2n******** ****@uni-berlin.de...
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 NetworkCredenti al
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://proxyserveraddr ess"

Dim uname As String
Dim pwd As String

'this is the proxy generated for my web service
Dim wsObj As MyWebServicePro xy

Now for the code snippets:

Attempt 1 - using default credentials
cred = CredentialCache .DefaultCredent ials

'ws obj creation block
wsObj = New MyWebServicePro xy()
wsObj.Proxy = new WebProxy(proxyU RI, True, Nothing)
wsObj.Proxy.Cre dentials = cred
wsObj.Credentia ls = cred
wsObj.MyWebServ iceMethod()

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 NetworkCredenti al(uname, pwd)
cred = nwCred

'ws obj creation block as with attempt 1, i.e.
wsObj = New MyWebServicePro xy()
...
wsObj.MyWebServ iceMethod()

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 NetworkCredenti al(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 MyWebServicePro xy()
...
wsObj.MyWebServ iceMethod()

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

Nov 21 '05 #2
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

"Nicole Calinoiu" <ni*****@somewh ere.net> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
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
"Wild Wind" <no****@blackho le.com> wrote in message
news:2n******** ****@uni-berlin.de...
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.
<snip>
Akin

aknak at aksoto dot idps dot co dot uk

Nov 21 '05 #3
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
"Wild Wind" <no****@blackho le.com> wrote in message
news:2n******** ****@uni-berlin.de...
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

"Nicole Calinoiu" <ni*****@somewh ere.net> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
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
"Wild Wind" <no****@blackho le.com> wrote in message
news:2n******** ****@uni-berlin.de...
> 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.
<snip>
> Akin
>
> aknak at aksoto dot idps dot co dot uk


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
980
by: Bill Hauver | last post by:
I am attempting to use a web service from my work pc which is behind a firewall. I have used wsdl.exe to create the web service reference class and added it to my project. (this seems to work without a hitch). Before I use this class, I make the necessary calls to instantiate a WebProxy class and then pass in my credentials to set the...
4
2922
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading 'http://mydomain.com:port/webservice.asmx' The operation has timed-out (I've tried with and without using a separate port for the service) The weird thing is...
3
1721
by: Hans Merkl | last post by:
Hi, I am helping to build a web app that's pretty much a wrapper around a web service. The question now is how to store the handle of the web service object between requests. My client is using SQL server for session state so I don't think I can store the web service handle there since it's not serializable. Opening up a connection to...
13
2772
by: ShadowOfTheBeast | last post by:
Hi All, i have just written my first Webservice and client(windows form) but when i try to get a web references to the client to generate the proxy class on the client, i get an error this specifically : The proxy settings on this computer are not configured correctly for web discovery. Click the Help button for more information. in the...
5
12484
by: Nate | last post by:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error (that appears in plain text), and causes the client to crash. This C# code has been deployed both as an ASP.NET application and a WinForms app, each of...
0
8261
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= | last post by:
I have written a simple WCF service hosted in a Windows console application and a simple WCF client console application that connects successfully to that service and retrieves data. I then ported the console application to WinForms and also got that to work properly. My next move was to host the WCF service in a Windows service application....
0
1695
by: =?Utf-8?B?VFRL?= | last post by:
I have a vb.net web service. I am trying to call another webservice that is secured through certificate. I have received the certificate file and I am trying to call the service using the file. I am having some challenges such as: 1. I can not add a web reference to the secure service. Error: The request failed with HTTP status 400: Bad...
2
1331
by: alag20 | last post by:
Hi Guys, I am writing a new application which will download files from http web server using MTOM & WSE 3. I have written a test client for this which works fine on normal networks. I run into problem when the network where client is running is Proxy. Can someone please advise how can I connect using proxy to the web service for clients...
2
2917
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop server that I have built. The code that tries to connect to the web service breaks if the laptop is not within our network. Further debugging has...
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.