How to consume web service in my application
While consuming a web service in my application I have two choices(ref. msdn)
- 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开发者_StackOverflow中文版 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.
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.
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.
精彩评论