What you need to generate WCF service or client code using svcutil is a wsdl file. The wsdl describes the name of the service, witch methods will be available and references the xsd files witch contain the description of your data.
How to generate code for WCF with svcutil and xsd files?
-
17-06-2023 - |
Question
I have a set of xsd files that define an XML message protocol for communications between devices. I'm planning to use WCF at one end. I'm hoping that there is a way to automate generation of classes based on the xsd files that I could use with WCF. Am I on the right track?
I'm aware of svcutil.exe and xsd.exe but a quick try gave me somewhat disappointing results. For example, "svcutil /dconly" command generated C# classes that contained only code related to xml serialization (e.g. WriteXml(), ReadXml(), etc.). There were no other properties generated.
This is not the only problem that I'm facing. Even if I succeed with generation of code from xsd I will still not be sure how to plug it into WCF.
Could someone please give some general idea how to deal with it? A simple example or a pointer to one would be greatly appreciated.
Thanks.
Solution