Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2006

Tip: Looking for answers? Try searching our database.

Webservices called from behind proxy server fails

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sameer - 10 Feb 2006 19:43 GMT
.NET Framework 1.1
VS2003
Application is making webservice calls from behind a proxy server and then
freezes and dies.

Questoin is can i use webservice over proxy server( i guess another name of
them is ISA ... if i a not wrong), if yes how?

Sameer
Tony - 11 Feb 2006 07:37 GMT
Yes, you can but you have provide your proxy server credentials to your web
service on the client side as in the following example.

The example assumes you have created your web service object (names
.WebService in this example):

WebProxy oProxy = new WebProxy(string.Format("{0}:{1}", sProxyServer,
nProxyPort), true);

oProxy.Credentials = new NetworkCredential(sProxyUsername, sProxyPassword);

oWebService.Proxy = oProxy;
oWebService.Discover();

Hope this helps,
Tony

> .NET Framework 1.1
> VS2003
[quoted text clipped - 6 lines]
>
> Sameer
sameer - 12 Feb 2006 18:00 GMT
Tony,

since some of the clients of this application does not use proxy server, how
can i and where exactly in the code should i make changes so that depending
on a setting in the configuration file, it should set up a proxy object. When
i say "where can i", i mean to ask is there any call in the reference.vb file
where i can override a method which is called every time this webserivce
object is initialized so that once I feed the settings to the webservice,
code in no other places needs to be changed.

Also can you point me to a resource on any website which describes this in
detail.
thanks

> Yes, you can but you have provide your proxy server credentials to your web
> service on the client side as in the following example.
[quoted text clipped - 23 lines]
> >
> > Sameer
Tony - 13 Feb 2006 05:11 GMT
I provide a configuration UI in my application where the user is allowed to
specify if they need to use a proxy server, and if so, they can provide the
proxy server, port, username and password (sometimes username and password
are options) and I write this info to a config file to remember them for the
next time.

I have a method that I use to get a the webservice instance and that method
attaches the proxy server stuff as indicated in my prev message.

Tony

> Tony,
>
[quoted text clipped - 45 lines]
>> >
>> > Sameer
sameer - 13 Feb 2006 15:36 GMT
tony thanks for you reply, i now know that i can use the code that you
mentioend to involke webservices from behing a proxy server. Another question
which was part of the previous one is:
my application has a lot of places where it makes the webservice calls, and
the application is pretty huge. also if at all there is a proxy server then
my clients would let me know in advance and i could specify this value in the
application before they start using. So my question is , is there place in
the reference.VB file of the webservice where if i override a function and
specify the proxy Ip and port just ONES per webserivce then evertime this
webserice is initialized , it gets the proxy IP and port and i dont have to
make this change 100s of times all over the application.

thanks

> I provide a configuration UI in my application where the user is allowed to
> specify if they need to use a proxy server, and if so, they can provide the
[quoted text clipped - 56 lines]
> >> >
> >> > Sameer
Tony - 14 Feb 2006 03:03 GMT
I wouldn't think you would want to hard code it into your application.
What I would do is create a factory class  - a static class with a static
method that would setup the web service object with the needed proxy info
and return it. You would then change the 100 or so places to call the static
method instead of creating the object directly. This would enable you from
this point on to make changes in one place without having to change it
everywhere.

Another option is to add the info to a configuration file. I'm sure that it
probably supports specification of the proxy information, but I don't use
config files so I can't tell you how to do this.

Tony

> tony thanks for you reply, i now know that i can use the code that you
> mentioend to involke webservices from behing a proxy server. Another
[quoted text clipped - 88 lines]
>> >> >
>> >> > Sameer
sameer - 14 Feb 2006 14:13 GMT
Tony thanks for your suggestions,
talking about configuration file, i am trying to add it to the config file
so that it picks up the default values from the configuration file but it
does not seem to work. Here is the code that i added to the config file, let
me know if you have any suggestions.

<system.net>
  <defaultProxy>
     <proxy
        proxyaddress = "http://proxyserver:80"
     />
  </defaultProxy>
</system.net>

thanks

> I wouldn't think you would want to hard code it into your application.
> What I would do is create a factory class  - a static class with a static
[quoted text clipped - 102 lines]
> >> >> >
> >> >> > Sameer

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.