Reputation: 10703
I have an app that uses .NET ASMX services to communicate. I have seen some developers use the wsdl
command through the command line to generate strongly typed classes that didnt depend on an endpoint being in the web.config.
Why would some use the wsdl
command line instead of using a service reference
(right-click-> add service reference)? What would you do?
Upvotes: 1
Views: 172
Reputation: 717
A reason I've done this is so I can simulate an external web service and return test data from it.
Using the wsdl
command I can create an exact version of the web service I'm expecting to call (which might not be available due to existing on another network for example) and then from the available routines have these return "dummy" responses. By merely adding the service reference you don't have any control over this.
Upvotes: 1
Reputation: 1362
I suppose that the tecnique that you explain should be useful if you need to talk with an unknow WS, at design time.
I do not see any other good reason to use it, as it provide great flexibility but that flexibility could easilly became pain (without a strict schema in you solution the risk is to introduce runtime errors, hard to find at design time)
Upvotes: 1