SQL Server Developer Center > SQL Server Forums > SQL Server Spatial > How to Convert geometry xsd to .net class and consume via web service?
Ask a questionAsk a question
 

QuestionHow to Convert geometry xsd to .net class and consume via web service?

  • Tuesday, October 20, 2009 12:19 AMMHabib Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I need a way to represent the objects in http://schemas.opengis.net/gml/3.1.1/base/geometryBasic0d1d.xsd (especially the pointType) in .net and be able to return them from a webservice call.

    The problem is that, according to the xsd, the Point can be an array of doubles. XSD.exe generates code like below. Unfortunately the array of doubles (any array other than string) cannot be serialized in xml. I have tried the techniques from http://webservices20.blogspot.com/2009/04/opengis-with-net-20-and-wcf.html that uses an alternative xsd where the generated vb code becomes array of objects.

    <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.opengis.net/gml"), _

    System.Xml.Serialization.XmlRootAttribute(

    "pos", [Namespace]:="http://www.opengis.net/gml", IsNullable:=False)> _

     

    Public Class DirectPositionType

     

    Private textField() As Double

     

    <System.Xml.Serialization.XmlTextAttribute()> _

     

    Public Property Text() As Double()

     

    Get

     

    Return Me.textField

     

    End Get

     

    Set(ByVal value As Double())

     

    Me.textField = value

     

    End Set

     

    End Property

     

    End Class

     

     



    I appreciate the help.