It is well-known how to create a "contract first" WCF service where the first step is to define the ServiceContract
s and DataContract
s.
How should one approach WCF development if one has the "schema first". In other words, an XSD schema has been independently developed. The service may not deviate from the schema that is already defined. As a complication, the schema might use features that don't translate into DataContract
(the DataContract
capabilities, after all, are quite minimal).
Using XDocument
on the server or client side for the entire document would be fine and good. (Use of XDocument
would be greatly preferred over anything involving the XmlSerializer
which unfortunately seems to have fallen out of favor without replacement). It is a requirement that the metadata/WSDL properly report the actual schema per the standards. It may not report a "generic" schema such as xsd:any. (Figuring out how to deal with these WSDL requirements is the part that is giving me the most trouble.)
(Similar questions/answers here do not address XDocument
or WSDL requirements.)
If you already have the XSD, the only missing link between those and a WCF interface is the WSDL. Once you have a WSDL, you can use svcutil.exe to generate WCF interfaces and classes properly annotated with the required attributes.
You can do it the hard way and write the WSDL by hand, but you also migth want to consider the WSCF tool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With