"Reverse" WCF service (creating a server from a client definition)

.Net provides some wonderful mechanisms for determining a remote service, and then "automatically" creates a client to connect to it, hiding most of the unpleasant wiring and fuss. But is there a similar way to go the other way?

My last task at work is to create a series of services that will communicate with each other for things such as authentication and search queries. One of the requirements is the ability of our core service to access other “service nodes” that may or may not be created in the home, but everyone needs to implement a common interface. I can create a reference implementation of this service, create a WSDL and automatically generate the client part without any problems. It seems that the only way to define a service is to basically point someone to the WSDL that I create and say, “Implement what looks like this.” Seeing how WSDLs are rarely designed for people to read, this route seems less attractive.

So, is there a way that I don't know to create a service interface from WSDL or a similar descriptor? First of all, consider .NET 3.5 here, using C # and WCF. Thank!

+1
source share
2 answers

If you have a WSDL that describes the methods that your client wants to call, plus an XSD (XML Schema) that describes what data elements he will expect to send and receive, you have everything you need to create a service from it. This approach is called the “contract first” for creating WCF services and is quite popular, especially in environments with compatibility requirements (for example, Java client and .NET services or vice versa).

svcutil.exe, - . , .

svcutil yourMethods.wsdl yourDataSchema.xsd /language:C# /out:YourServiceInterface.cs
(or /language:VB, if you prefer VB.NET)

YourServiceInterface.cs ( YourServiceInterface.vb), .

- , .

, : , - IIS , NT, - .

+2

, WCF () WSDL: svcutil.exe.

+2

All Articles