473,396 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 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
Nov 21 '05 #1
3 7745
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****@blackhole.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 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

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*****@somewhere.net> wrote in message
news:eh**************@tk2msftngp13.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****@blackhole.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****@blackhole.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*****@somewhere.net> wrote in message
news:eh**************@tk2msftngp13.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****@blackhole.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
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...
4
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...
3
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...
13
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...
5
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...
0
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...
0
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...
2
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.