The wsdl.exe tool with Visual Studio can be used to manually generate a code file to use with a project. If you use the nillable or minOccurs attributes in the XSD though, the wsdl.exe tool generates a boolean 'Specified' field that must be set to true in order to transmit the data through the web service. For example: WSDL File (myfile.wsdl)<xs:element name="duedate" type="xs:dateTime" nillable="1" minOccurs="0" maxOccurs="1" />
Generated CS File (wsdl.exe myfile.wsdl)// ...
private System.Nullable<System.DateTime> duedateField;
private bool duedateFieldSpecified;
// ...
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public System.Nullable<System.DateTime> duedate {
get {
return this.duedateField;
}
...