<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic WFS  Field Type Mismatch in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1559186#M13119</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;I'm facing an issue with ArcGIS Runtime (tested in both version 100.15 and 200.5) while working with a WFS Layer hosted on a MapServer.&lt;/P&gt;&lt;P&gt;When attempting to use the WFS layer, I encounter this exception:&lt;/P&gt;&lt;P&gt;ArcGISRuntimeException: Geodatabase data type mismatch: my_field&lt;/P&gt;&lt;P&gt;Upon investigation, I found that the problematic field (my_field) has the following characteristics:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Locally the FeatureTable-Field has &lt;EM&gt;FieldType=Int32&lt;/EM&gt;.&lt;/LI&gt;&lt;LI&gt;From the server's &lt;EM&gt;DescribeFeatureType&lt;/EM&gt;&amp;nbsp;response:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;complexType name="my_type"&amp;gt;
  &amp;lt;complexContent&amp;gt;
    &amp;lt;extension base="gml:AbstractFeatureType"&amp;gt;
      &amp;lt;sequence&amp;gt;
        {other Fields}
        &amp;lt;element name="my_field" minOccurs="0" type="string"/&amp;gt;
        {other Fields}
      &amp;lt;/sequence&amp;gt;
    &amp;lt;/extension&amp;gt;
  &amp;lt;/complexContent&amp;gt;
&amp;lt;/complexType&amp;gt;
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The challenge is that the values in this field are mixed: sometimes just numeric, sometimes strings. The field should always be treated as a string to accommodate the varying data types.&lt;/P&gt;&lt;P&gt;Is there a way to configure or force the field to always be interpreted as a string in the Runtime SDK?&lt;/P&gt;&lt;P&gt;Any help or insights would be greatly appreciated. Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 15:09:00 GMT</pubDate>
    <dc:creator>TimScheiber</dc:creator>
    <dc:date>2024-11-15T15:09:00Z</dc:date>
    <item>
      <title>WFS  Field Type Mismatch</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1559186#M13119</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;I'm facing an issue with ArcGIS Runtime (tested in both version 100.15 and 200.5) while working with a WFS Layer hosted on a MapServer.&lt;/P&gt;&lt;P&gt;When attempting to use the WFS layer, I encounter this exception:&lt;/P&gt;&lt;P&gt;ArcGISRuntimeException: Geodatabase data type mismatch: my_field&lt;/P&gt;&lt;P&gt;Upon investigation, I found that the problematic field (my_field) has the following characteristics:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Locally the FeatureTable-Field has &lt;EM&gt;FieldType=Int32&lt;/EM&gt;.&lt;/LI&gt;&lt;LI&gt;From the server's &lt;EM&gt;DescribeFeatureType&lt;/EM&gt;&amp;nbsp;response:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;complexType name="my_type"&amp;gt;
  &amp;lt;complexContent&amp;gt;
    &amp;lt;extension base="gml:AbstractFeatureType"&amp;gt;
      &amp;lt;sequence&amp;gt;
        {other Fields}
        &amp;lt;element name="my_field" minOccurs="0" type="string"/&amp;gt;
        {other Fields}
      &amp;lt;/sequence&amp;gt;
    &amp;lt;/extension&amp;gt;
  &amp;lt;/complexContent&amp;gt;
&amp;lt;/complexType&amp;gt;
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The challenge is that the values in this field are mixed: sometimes just numeric, sometimes strings. The field should always be treated as a string to accommodate the varying data types.&lt;/P&gt;&lt;P&gt;Is there a way to configure or force the field to always be interpreted as a string in the Runtime SDK?&lt;/P&gt;&lt;P&gt;Any help or insights would be greatly appreciated. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 15:09:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1559186#M13119</guid>
      <dc:creator>TimScheiber</dc:creator>
      <dc:date>2024-11-15T15:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: WFS  Field Type Mismatch</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1600689#M13428</link>
      <description>&lt;P&gt;Hello Tim!&amp;nbsp; Normally WFSFeatureTable is able to derive the table schema correctly by examining the XSD returned by DescribeFeatureType response.&amp;nbsp; However, I have sometimes seen edge-cases where it cannot load or parse the XSD and has to guess based on values in the first GetFeature response.&lt;/P&gt;&lt;P&gt;I think that's what might have happened here, but I do not have enough information to diagnose the problem.&amp;nbsp; Would you be able to share the URL of this service, or a full example of the&amp;nbsp; GetCapabilities/DescribeFeatureType/GetFeature responses?&amp;nbsp; You can also email me at &lt;A href="mailto:mstefarov@esri.com" target="_blank"&gt;mstefarov@esri.com&lt;/A&gt;. I would be glad to look deeper into this.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Mar 2025 08:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1600689#M13428</guid>
      <dc:creator>MatveiStefarov</dc:creator>
      <dc:date>2025-03-30T08:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: WFS  Field Type Mismatch</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1604261#M13460</link>
      <description>&lt;P&gt;We were able to resolve the problem via email, but I wanted to share a summary here in case someone else has a similar problem in the future.&lt;/P&gt;&lt;P&gt;It turned out that this FeatureType has fields of type “gml:TimeInstantType”, but WFSFeatureTable's XSD parser does not support GML temporal schemas and gives up parsing the &lt;SPAN&gt;DescribeFeatureType response&lt;/SPAN&gt;. Without understanding the original schema, the table falls back to guessing the field type based on the first feature. In this case, the first feature had a numeric-looking value for the field ("111"), so WFSFeatureTable guessed that it should be an integer column.&amp;nbsp; When later GetFeature responses contained rows with non-numeric strings for this field, they could not be inserted into the table.&lt;/P&gt;&lt;P&gt;Luckily, there was a workaround.&amp;nbsp; In Maps SDK 200.5+ you can implement an &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Http.IHttpMessageInterceptor.html" target="_blank" rel="noopener"&gt;IHttpMessageInterceptor&lt;/A&gt; that listens for DescribeFeatureType responses and replaces the unsupported “gml:TimeInstantType” type with something more compatible. Here is what that implementation would look like:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;class DescribeFeatureTypeRewriter : IHttpMessageInterceptor
{
    public async Task&amp;lt;HttpResponseMessage&amp;gt; SendAsync(HttpMessageInvoker invoker, HttpRequestMessage message, CancellationToken cancellationToken)
    {
        var response = await invoker.SendAsync(message, cancellationToken);
        if (message.RequestUri.Query.Contains("=DescribeFeatureType") &amp;amp;&amp;amp; response.IsSuccessStatusCode)
        {
            // This is an XML schema returned by WFS DescribeFeatureType response.
            // Edit it to replace the unsupported "gml:TimeInstantType" with "dateTime" before passing it to Runtime.
            // Most of the time both are represented by ISO 8601 strings, so this is a broadly compatible change.
            var xsdString = await response.Content.ReadAsStringAsync();
            xsdString = xsdString.Replace("gml:TimeInstantType", "dateTime");
            response.Content = new StringContent(xsdString);
        }
        return response;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is how you would hook up the interceptor on startup:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ArcGISRuntimeEnvironment.Initialize(
    config =&amp;gt; config.ConfigureHttp(
        httpConfig =&amp;gt; httpConfig.UseHttpMessageInterceptor(new DescribeFeatureTypeRewriter())
    )
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 08:08:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/wfs-field-type-mismatch/m-p/1604261#M13460</guid>
      <dc:creator>MatveiStefarov</dc:creator>
      <dc:date>2025-05-16T08:08:02Z</dc:date>
    </item>
  </channel>
</rss>

