3

I am attempting to create a few WCF web services from existing WSDLs. There are a few awesome questions on SO for this, (1, 2, definitely more) but many of these are from 3 years ago, and I end up wondering if the advice is still valid. If it is, how do I finish integrating it into a WCF project in Visual Studio 2010? The questions and linked blog posts are considerably mum about how one configures a .svc to use the converted WSDL after it's been run through svchost.exe (see linked question 1 for details on that), and a blog post linked in the thread suggests there is a way to make Visual Studio create a .svc around a converted WSDL, but I cannot find this anywhere in either the program's interface or the documentation.

So, the question, I suppose, would be: What is the generally recommended way to approach contract-first web service design in Visual Studio 2010/.NET 4.0?

Community
  • 1
  • 1
tmesser
  • 7,558
  • 2
  • 26
  • 38
  • 1
    If you're using **SOAP** services - yes, absolutely! Nothing has changed. If you happen to have to talk to e.g. a third-party which doesn't make their WSDL available online (via `url?wsdl`), then there's really hardly any other way to build your service client ... – marc_s Oct 29 '12 at 19:29

1 Answers1

1

It hasn't changed. You can still generate a service interface and its data contracts using svcutil and a WSDL. Even a client will be generated, though you won't need that.

You can then create a .svc-file, which merely instructs a ServiceHost which class to host, as explained here:

<% @ServiceHost Service="MyNamespace.MyServiceImplementationTypeName" %>

Your implementation of course has to implement the generated service interface.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272