WFS XSD Serialization

Nov 14, 2013 at 6:38 PM

I am trying to use XSD2Code to generate code representing the [WFS 1.1.0 schema] (

When trying to serialize GetFeatureType object with a QueryType object,
Dim getFeat As New GetFeatureType()
        getFeat.service = "WFS"
        getFeat.version = "1.1.0"
        getFeat.outputFormat = "GML2"
        getFeat.Query = New QueryType() {New QueryType()}
        getFeat.Query(0).typeName = New System.Xml.XmlQualifiedName() {New System.Xml.XmlQualifiedName("XXX", "XXXXXX")}

I get errors on trying to reflect GetFeatureType --> TransactionType. (Why is it trying to serialize TransactionType if I am serializing a GetFeatureType????) Figured out that it is because of the includes in BaseRequestType (which GetFeatureType inherits from):
<System.Xml.Serialization.XmlIncludeAttribute(GetType(TransactionType)),  _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(LockFeatureType)),  _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(GetFeatureWithLockType)),  _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(GetGmlObjectType)),  _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(GetFeatureType)),  _
     System.Xml.Serialization.XmlIncludeAttribute(GetType(DescribeFeatureTypeType)),  _
     System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927"),  _
     System.SerializableAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:=""),  _
     System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=true)>  _
    Partial Public MustInherit Class BaseRequestType
If I comment those includes but the one for GetFeatureType, the error pops out on serializing FilterType --> Items --> BinarySpatialOpType.
I wonder, why is this? Because I have not set any "Filter" value for filter field on my QueryType object.

All generation options but CollectionObjectType(set to array) are set as default.

Clearly I must be missing something about the serialization process. Any help would be appreciated.