views:

40

answers:

2

Hi All, While consuming a web service in my application I have two choices(ref. msdn)

  1. Adding the Proxy Using the WSDL Tool

2.Adding the Proxy Using a Web Reference in Visual Studio

Now what should I choose, 2nd option is very simple and I generally follow that. I want to know what are the pros and cons of both the options(if any) and ideally what should I choose? Thanks.

+2  A: 

They essentially achieve the same thing. The second gets the WSDL from the web service and generates the proxy, which requires the service to be online at the time.

David M
Is it mean in 2nd case the service has to be up all the time, and in case of first the client application will work even if the service is down(as I am generating the class), am I getting u?Correct me if I am wrong
Wondering
No, in the second case the service has to be up when you add the reference. That's the only difference. In all cases the service clearly has to be up when you are accessing it.
David M
ok, got ur point. is there any preference or it depends on persons choice, like I prefer 2 nd option.
Wondering
Second option is easier where it is possible.
David M
Thanks for all the info.
Wondering
+1  A: 

Add the reference automaticly when possible, Visual Studio will do everything for you. Under certain scenarios this is not possible. so you will have to do some manual work, like running the command to generate the proxy class and copying some configuration lines into the web.config manually.

Benjamin Ortuzar
thanks for ur suggestion
Wondering