Show Derived Type's Members On ASMX WSDL Help

This is a post from the archives. Probably don't do this.

See more archived posts in the archives.

To change the default ASMX WSDL help to show derived types, open %WINDIR%\Microsoft.NET\Framework\v4.0.30319\Config or %WINDIR%\Microsoft.NET\Framework\v2.0.50727\CONFIG depending on your runtime. On line 1075 change/add:

if (type.ContentModel != null) {
  // Get the base's qualified name
  XmlQualifiedName name = ((XmlSchemaComplexContentExtension)type.ContentModel.Content).BaseTypeName;

  // Find the definition for the base
  XmlSchemaComplexType baseCT = (XmlSchemaComplexType)schemas.Find(name, typeof(XmlSchemaComplexType));

  // If we found the definition for the base...
  if (baseCT != null) {
    // ...write out the base type
    WriteComplexType(baseCT, ns, encoded, depth, writeXsiType, soap12);
  }
}