title: WCF WSDL + Nillable Attributes
body: <p>I have a WCF service with a <a href="https://stackoverflow.com/questions/5801128/flat-wsdl-for-wcf-4-service/8057456#8057456">Flattened WSDL</a>, and the consumer at the other end is telling me the nillable="true" attributes are hosing them up. I tried setting EmitDefaultValue = false in my service contract, but I didn't notice any change in behavior.</p>
  
  <p>Admittedly, I have never had to dig into WSDL generation at this level before so I'm a little lost. Perhaps there a tweak to be made in the bit of code posted below that may solve my problem? If I'm at least in the correct place, I'll keep investigating.</p>
  
  <p>Is there a simple way to remove the nillable="true" attributes from my WSDL, and is that going to have unintended consequences? Thanks!</p>
  
  <pre><code>public class FlatWsdl : IWsdlExportExtension, IEndpointBehavior
  {
      public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context)
      {
          XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas;
  
          foreach (ServiceDescription wsdl in exporter.GeneratedWsdlDocuments)
          {
              List&lt;XmlSchema&gt; importsList = new List&lt;XmlSchema&gt;();
  
              foreach (XmlSchema schema in wsdl.Types.Schemas)
              {
                  AddImportedSchemas(schema, schemaSet, importsList);
              }
  
              wsdl.Types.Schemas.Clear();
  
              foreach (XmlSchema schema in importsList)
              {
                  RemoveXsdImports(schema);
                  wsdl.Types.Schemas.Add(schema);
              }
          }
      }
  
      ...omitted the rest of FlatWsdl.cs for brevity...
  }
  </code></pre>