Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a WSDL file to create a WCF service (not make a call)

Tags:

wsdl

wcf

I have an old WSDL file and I want to create a server based on this WSDL file.

The WSDL is generated from a ASMX (I suppose but I am not sure).

How can I achieve this ?


original question where the OP thought he needed to create a client based on the WSDL.

like image 783
Raha Avatar asked Jun 04 '09 12:06

Raha


People also ask

What is WSDL file in WCF?

WSDL stands for Web Service Description Language. The WCF service exposes the WSDL document for the clients, to generate proxies and the configuration file. The WSDL file provides the following information for the consumers of the WCF service.

What is Svcutil?

Svcutil.exe can be used to download metadata from running services, and save the metadata to local files. To download metadata, you must specify the /t:metadata option. Otherwise, client code is generated. For HTTP and HTTPS URL schemes, Svcutil.exe attempts to retrieve metadata using WS-Metadata Exchange and DISCO.


1 Answers

Using svcutil, you can create interfaces and classes (data contracts) from the WSDL.

svcutil your.wsdl (or svcutil your.wsdl /l:vb if you want Visual Basic) 

This will create a file called "your.cs" in C# (or "your.vb" in VB.NET) which contains all the necessary items.

Now, you need to create a class "MyService" which will implement the service interface (IServiceInterface) - or the several service interfaces - and this is your server instance.

Now a class by itself doesn't really help yet - you'll need to host the service somewhere. You need to either create your own ServiceHost instance which hosts the service, configure endpoints and so forth - or you can host your service inside IIS.

like image 59
marc_s Avatar answered Sep 24 '22 15:09

marc_s