How to create a web service in Visual Studio .NET using a WSDL file?

I am trying to use the WSDL Top Down approach to create a web service in Visual Studio 2010.

I used the Eclipse WSDL GUI editor to create a WSDL file (CalculatorWSDL.wsdl) that uses the SOAP method for communication.

I also used wsdl.exe to create a C # file (Calculator.cs).

Now I'm not sure what to do next. How do I really use Calculator.cs on the server and / or client?

+4
source share
1 answer

Actually, you should not use wsdl.exe for WCF - use svcutil.exe .

When you use svcutil.exe in WSDL, you should get a myservice.cs file that contains an interface (service contract) and possibly some data structures (data transfer contracts).

Use these functions to create your service - the service code must implement this interface and provide an implementation for these methods. It is basically a meat service application.

For details, see Accessing Services Using the WCF Proxy Server - Yes, I know the header about creating WCF clients, but it works for services too - you just convert WSDL (and possibly XSD) to a C # file and implement this interface defined there.

You should also read Schema-Based Development with WCF , which discusses this topic - to generate services and client from / WSDL schemes created in advance of time.

The same guy (Christian Weyer) is also the original author of the Visual Studio plugin to make contract development in WCF much easier - go to Codeplex - it’s absolutely free, completely with the source code - go nuts!

+8
source

Source: https://habr.com/ru/post/1312775/


All Articles