none
Data Member in WCF RRS feed

  • Question

  • Hi,

    i am in process of developing a webapplication which involves use of Json, the output format is Json and my webservice is working correctly.

    However i am facing problem over spatial values.

    When i specify Datamember to GeoAPI.IGeometry, my webservice does not get identified.

    But if i remove this it works.

    [DataMember]

    public string Id { get; set;}

    [DataMember]

    public IGeometry wkb_geometry { get; set; }

    The above shown is my data contract. My Service is not producing results of IGeometry Json.

    Kindly share some idea on how to do this.

    Regards,

    Amit

    Friday, February 17, 2017 11:21 AM

Answers

  • Hi Amit,

    Are you there? I accidental find a solution might be helpful to you.

    For GeoAPI.IGeometry which is not serializable, I think you could try Serialization Surrogates. It is used when the type A isn’t serializable at all, or because it doesn’t have a serialization format which we want, so we use a surrogate to change it.

    I suggest you refer the link below for more information.

    # WCF Extensibility – Serialization Surrogates

    https://blogs.msdn.microsoft.com/carlosfigueira/2011/09/13/wcf-extensibility-serialization-surrogates/

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by vaayuputra Friday, February 24, 2017 3:45 AM
    Wednesday, February 22, 2017 3:17 AM

All replies

  • Hi Amit,

    What do you mean by “spatial values”? Do you use Spatial Library? Do you develop WCF Rest Service or WCF DATA Service?

    Where did you specify Datamember to GeoAPI.IGeometry? It would be helpful if you could share us your detailed steps and related code to reproduce your issue.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 20, 2017 2:44 AM
  • Hi Edward,

    Thanks for reply. I am using GeoAPI Spatial Library, in that IGeometry i am working on. However i am able to retrieve geometry values from Spatial Data IGeometry from database, but when i try applying DataMember to it, it doesn't display data.

    I was able to generate Json from the WCF for other non-spatial data. But if geometry is concerned, it returns empty even though there is data in it.

    Regards,

    Amit


    Monday, February 20, 2017 3:21 AM
  • Hi Amit,

    As your current result, I think that GeoAPI is not supported in WCF serialization, and I think it is more related with depth implementation of GeoApi.

    For a workaround for this issue, I would suggest you create your own Class object which defines DataContract and DataMember, then set the value from retrieving value from IGeometry.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 20, 2017 5:08 AM
  • Hi Amit,

    Are you there? I accidental find a solution might be helpful to you.

    For GeoAPI.IGeometry which is not serializable, I think you could try Serialization Surrogates. It is used when the type A isn’t serializable at all, or because it doesn’t have a serialization format which we want, so we use a surrogate to change it.

    I suggest you refer the link below for more information.

    # WCF Extensibility – Serialization Surrogates

    https://blogs.msdn.microsoft.com/carlosfigueira/2011/09/13/wcf-extensibility-serialization-surrogates/

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by vaayuputra Friday, February 24, 2017 3:45 AM
    Wednesday, February 22, 2017 3:17 AM
  • Hi Edward,

    Thanks for providing details. Will look into it.

    Regards,

    Amit

     

    Friday, February 24, 2017 3:45 AM