title: BizTalk Web Reference - generated XSD has "lost" information from WSDL
body: <p>I am using BizTalk 2006 R2 to generate a web reference from a WSDL file.</p>
  
  <p>Comparing the generated XSD to the WSDL, it is apparent that a lot of information has been lost.</p>
  
  <p>Consider the following extract from the WSDL:</p>
  
  <pre><code>&lt;s:element form="unqualified" minOccurs="0" maxOccurs="4" name="Applicant"&gt;
    &lt;s:complexType&gt;
      &lt;s:sequence&gt;
        &lt;s:element form="unqualified" minOccurs="1" maxOccurs="1" name="ApplicantIdentifier"&gt;
          &lt;s:simpleType&gt;
            &lt;s:restriction base="s:string" /&gt;
          &lt;/s:simpleType&gt;
        &lt;/s:element&gt;
        &lt;s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Name"&gt;
          &lt;s:complexType&gt;
            &lt;s:sequence&gt;
              &lt;s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Title"&gt;
                &lt;s:simpleType&gt;
                  &lt;s:restriction base="s:string"&gt;
                    &lt;s:maxLength value="10" /&gt;
                  &lt;/s:restriction&gt;
                &lt;/s:simpleType&gt;
              &lt;/s:element&gt;
              &lt;s:element form="unqualified" minOccurs="0" maxOccurs="1" name="Forename"&gt;
                &lt;s:simpleType&gt;
                  &lt;s:restriction base="s:string"&gt;
                    &lt;s:pattern value="[0-9A-Za-z \-]*" /&gt;
                    &lt;s:maxLength value="15" /&gt;
                    &lt;s:minLength value="1" /&gt;
                  &lt;/s:restriction&gt;
                &lt;/s:simpleType&gt;
              &lt;/s:element&gt;
              &lt;!-- more --&gt;
            &lt;/s:sequence&gt;
          &lt;/s:complexType&gt;
        &lt;/s:element&gt;
      &lt;/s:sequence&gt;
    &lt;/s:complexType&gt;
  &lt;/s:element&gt;
  </code></pre>
  
  <p>The equivalent XSD which BizTalk has generated is:</p>
  
  <pre><code>&lt;xs:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="Applicant"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="ApplicantIdentifier" type="xs:string" /&gt;
        &lt;xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Name"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Title" type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" maxOccurs="1" form="unqualified" name="Forename" type="xs:string" /&gt;
              &lt;!-- more --&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>So, the XSD has lost the restriction patterns and has set its own values for minOccurs and maxOccurs.</p>
  
  <p>I need to map from another source to the XSD and I wish to trap data that does not conform to the WSDL at that stage.</p>
  
  <p>Does anyone know why BizTalk has not preserved the restrictions in the XSD; or how I can generate non-lossy XSD?</p>