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