Connecting to WebService using Proxy Server

  • Thread starter Thread starter Sanjay Pais
  • Start date Start date
S

Sanjay Pais

We have a windows application built using .net 2.0 & c#
This application has a web reference that allows us to connect to a web
service.
This application works fine except in some cases....
We have clients who use a proxy server to connect to the internet. Our
application is unable to connect to the webservice in this case.

Thanks in advance

Sanjay

Here are the details of the error:
EXCEPTION OCCURRED

~~~~~~~~~~~~~~~~~~







System.Net.WebException: Falha na solicitação com status HTTP 407: Proxy
Authentication Required.

em
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)

em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)

em RR.Client.UploadService.UploadService.RequestUpload(String
sourceInstallationID, String sourceUrl, String workloadIDString, String
encryptionProtocolName, String userName, String password, Boolean isBinary)

em RR.Client.PLL.UploadDocumentWorker.OnDoWork(DoWorkEventArgs e)
 
I forgot to add...

The application is strong named and digitally signed. We use click once to
deploy it.

Sanjay
 
I forgot to add...

The application is strong named and digitally signed. We use click once to
deploy it.

Sanjay


We have a windows application built using .net 2.0 & c#
This application has a web reference that allows us to connect to a web
service.
This application works fine except in some cases....
We have clients who use a proxy server to connect to the internet. Our
application is unable to connect to the webservice in this case.
Thanks in advance

Here are the details of the error:
EXCEPTION OCCURRED

System.Net.WebException: Falha na solicitação com status HTTP 407: Proxy
Authentication Required.
em
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
em RR.Client.UploadService.UploadService.RequestUpload(String
sourceInstallationID, String sourceUrl, String workloadIDString, String
encryptionProtocolName, String userName, String password, Boolean
isBinary)
em RR.Client.PLL.UploadDocumentWorker.OnDoWork(DoWorkEventArgs e)

Olá :)

On the web reference, find the file named reference.vb. On VS (show
all files) it is under reference.map.
On it, find the Sub New, that is executed when you create a reference
to the WS. You can determine a Proxy by setting the Me.Proxy property.

Regards,

Thiago
 
Hi Thiago,

Thanks for the post. I have another quick question. Would this mean that the
user's credentials would be detected automatically?

I mean you can provide the name and port for the proxy server as well as a
username and password.

Would i be able to access this information without the user re-entering it?

Thanks

Sanjay

I forgot to add...

The application is strong named and digitally signed. We use click once to
deploy it.

Sanjay


We have a windows application built using .net 2.0 & c#
This application has a web reference that allows us to connect to a web
service.
This application works fine except in some cases....
We have clients who use a proxy server to connect to the internet. Our
application is unable to connect to the webservice in this case.
Thanks in advance

Here are the details of the error:
EXCEPTION OCCURRED

System.Net.WebException: Falha na solicitação com status HTTP 407: Proxy
Authentication Required.
em
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
em RR.Client.UploadService.UploadService.RequestUpload(String
sourceInstallationID, String sourceUrl, String workloadIDString, String
encryptionProtocolName, String userName, String password, Boolean
isBinary)
em RR.Client.PLL.UploadDocumentWorker.OnDoWork(DoWorkEventArgs e)

Olá :)

On the web reference, find the file named reference.vb. On VS (show
all files) it is under reference.map.
On it, find the Sub New, that is executed when you create a reference
to the WS. You can determine a Proxy by setting the Me.Proxy property.

Regards,

Thiago
 
Hi Thiago,

Thanks for the post. I have another quick question. Would this mean that the
user's credentials would be detected automatically?

I mean you can provide the name and port for the proxy server as well as a
username and password.

Would i be able to access this information without the user re-entering it?

Thanks

Sanjay


I forgot to add...
The application is strong named and digitally signed. We use click once to
deploy it.

We have a windows application built using .net 2.0 & c#
This application has a web reference that allows us to connect to a web
service.
This application works fine except in some cases....
We have clients who use a proxy server to connect to the internet. Our
application is unable to connect to the webservice in this case.
Thanks in advance
Sanjay
Here are the details of the error:
EXCEPTION OCCURRED
~~~~~~~~~~~~~~~~~~
System.Net.WebException: Falha na solicitação com status HTTP 407:Proxy
Authentication Required.
em
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
em System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
em RR.Client.UploadService.UploadService.RequestUpload(String
sourceInstallationID, String sourceUrl, String workloadIDString, String
encryptionProtocolName, String userName, String password, Boolean
isBinary)
em RR.Client.PLL.UploadDocumentWorker.OnDoWork(DoWorkEventArgs e)

Olá :)

On the web reference, find the file named reference.vb. On VS (show
all files) it is under reference.map.
On it, find the Sub New, that is executed when you create a reference
to the WS. You can determine a Proxy by setting the Me.Proxy property.

Regards,

Thiago

Sanjay,

You can use this statement to get the current user credentials:
Me.Credentials = System.Net.CredentialCache.DefaultCredentials or
DefaultNetworkCredentials

If the proxy authentication isn't the network credential or it doesn't
exists, you can use the Web Proxy Auto-Discovery to identify the user
IE proxy configuration.
(http://msdn.microsoft.com/en-us/library/fze2ytx2.aspx)
While it's by default enabled just set your proxy property to
System.Net.WebRequest.DefaultWebProxy (.Net FW 2.0 or greater) or
System.Net.WebProxy.GetDefaultProxy (.Net 1). This probaly will be
your prefered solution.

If none of this match with your scenario, I think you'll need to
prompt this info from user.

Thiago
 
Back
Top