gh9
gh9

Reputation: 10703

web service, service reference, command line wsdl creation

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

Answers (2)

Davie Brown
Davie Brown

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

Skary
Skary

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

Related Questions