I've been playing with XmlSerializable and came up with this to make it show up in the wsdl:
This is in NullableInt32:
Code:
#region IXmlSerializable Members
public void WriteXml(System.Xml.XmlWriter writer)
{
writer.WriteElementString("HasValue", hasValue.ToString());
if (hasValue)
writer.WriteElementString("Value", _value.ToString());
}
public System.Xml.Schema.XmlSchema GetSchema()
{
XmlSchema s = new XmlSchema();
s.Id = "nullables-int32"; //i don't know what this does, but an Id is required.
XmlSchemaElement hasValueElement = new XmlSchemaElement();
hasValueElement.Name = "HasValue";
hasValueElement.SchemaTypeName = new XmlQualifiedName("boolean", "http://www.w3.org/2001/XMLSchema");
hasValueElement.MinOccurs = 1;
hasValueElement.MaxOccurs = 1;
s.Items.Add(hasValueElement);
XmlSchemaElement valueElement = new XmlSchemaElement();
valueElement.Name = "Value";
valueElement.SchemaTypeName = new XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
valueElement.MinOccurs = 0;
valueElement.MaxOccurs = 1;
s.Items.Add(valueElement);
return s;
}
public void ReadXml(System.Xml.XmlReader reader)
{
// TODO: Add NullableInt32.ReadXml implementation
}
#endregion
Unfortunately this will still create some new dummy NullableInt32 on the client side. I'm working on causing it to deserialize to the existing NullableInt32.