title: How to make a dotnet webservice set minOccurs="1" on a string value
body: <p>I have an XSD:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns="http://a.com/a.xsd"
       targetNamespace="http://a.com/a.xsd"
       elementFormDefault="qualified"
       attributeFormDefault="unqualified"&gt;
      &lt;xs:element name="A"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="Item"  minOccurs="1" maxOccurs="1"&gt;
                      &lt;xs:simpleType&gt;
                          &lt;xs:restriction base="xs:string"&gt;
                              &lt;xs:minLength value="1"/&gt;                                       
                              &lt;xs:whiteSpace value="collapse"/&gt;
                          &lt;/xs:restriction&gt;
                      &lt;/xs:simpleType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Which I have converted into a C# class using XSD.exe v2.0.50727.3615 which generates code as follows</p>
  
  <pre><code>namespace A {
      using System.Xml.Serialization;
      /// &lt;remarks/&gt;
      [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
      [System.SerializableAttribute()]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://a.com/a.xsd")]
      [System.Xml.Serialization.XmlRootAttribute(Namespace="http://a.com/a.xsd", IsNullable=false)]
      public partial class A {
          private string itemField;
          /// &lt;remarks/&gt;
          public string Item {
              get {
                  return this.itemField;
              }
              set {
                  this.itemField = value;
              }
          }
      }
  }
  </code></pre>
  
  <p>I am returning an A.A object in my webservice, which produces this snippet in the service description</p>
  
  <pre><code>&lt;s:schema elementFormDefault="qualified" targetNamespace="http://a.com/a.xsd"&gt; 
    &lt;s:element name="Test2Result"&gt; 
      &lt;s:complexType&gt; 
        &lt;s:sequence&gt; 
          &lt;s:element minOccurs="0" maxOccurs="1" name="Item" type="s:string" /&gt; 
        &lt;/s:sequence&gt; 
      &lt;/s:complexType&gt; 
    &lt;/s:element&gt; 
  &lt;/s:schema&gt; 
  </code></pre>
  
  <p>The change from minOccrus="1" in the XSD to minOccurs="0" on the auto-generated WSDL is causing grief to the machine on the other end of the system.</p>
  
  <p>I could of course provide a hand edited WSDL for them to use, but I would like the auto-generated one to suit their needs.</p>
  
  <p>Any suggestions on how to convince dotnet to output minOccurs="1" for a string type in its autogenerated WSDLs without also adding nillable="true"?</p>