Expose a static XSD in a dynamic WSDL

When you use xsd.exe to generate classes from an XML Schema Definition, then you will probably lose details regarding that schema (eg. minOccurs & maxOccurs constraints). If you then expose the generated classes through a service, the XSD used will differ from the one you originally used.

If the XSD you use is part of some standard, this will impose a problem. We resolved this by using an IEndpointBehavior and IWsdlExportExtension, which will dynamically inject our static XSD into the WSDL. The main benefit of this approach is that the dynamic part of the WSDL (operations etc.) will still be intact, as opposed to exposing an external metadata file.

Leave a Reply

Your email address will not be published. Required fields are marked *