I\'ve discovered that if a serializable Field/Property has a corresponding field of type Boolean having as a name the Field/Property name with \"S
Code sample as an extension to the provided answer;
WSDL:
Generated .net SOAP client class
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="your namespace")]
public partial class advancedSearchRequest : object, System.ComponentModel.INotifyPropertyChanged {
private vehicleType vehicleTypeField;
private bool vehicleTypeFieldSpecified;
private string searchField;
///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public vehicleType vehicleType {
get {
return this.vehicleTypeField;
}
set {
this.vehicleTypeField = value;
this.RaisePropertyChanged("vehicleType");
}
}
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool vehicleTypeSpecified {
get {
return this.vehicleTypeFieldSpecified;
}
set {
this.vehicleTypeFieldSpecified = value;
this.RaisePropertyChanged("vehicleTypeSpecified");
}
}
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
public string search {
get {
return this.searchField;
}
set {
this.searchField = value;
this.RaisePropertyChanged("search");
}
}
}
You can set "vehicleTypeFieldSpecified" = {true/false} to {serialize/omit} it;
advancedSearchRequest.vehicleTypeField = vehicleType.BIKE;
advancedSearchRequest.vehicleTypeFieldSpecified = true;
Resulting SOAP message;
BIKE
abc