[Geoserver-users] DescribeFeatureType not returning fields for some layers

Geoserver 2.2.4 using Jetty on Windows Server 2008.

We’re pulling several layers from SQL Server and I’m trying to get a list of field names for each layer using WFS’s DescribeFeatureType request.

All layers are published in GeoServer with the same settings (Same polygon style, same SRS, etc.) but some layers don’t list their field names in DescribeFeatureType and others do. Can anyone shed some light on why this might be?

Eg. when I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:geofence_static
I get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
<xsd:complexType name=“geofence_staticType”>
xsd:complexContent
<xsd:extension base=“gml:AbstractFeatureType”>
xsd:sequence
<xsd:element maxOccurs=“1” minOccurs=“1” name=“ogr_fid” nillable=“false” type=“xsd:int”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“ogr_geometry” nillable=“true” type=“gml:GeometryPropertyType”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“aeroway” nillable=“true” type=“xsd:string”/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name=“geofence_static” substitutionGroup=“gml:AbstractFeature” type=“MNS:geofence_staticType”/>
</xsd:schema>

If I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:GeoFence
I simply get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
</xsd:schema>

I can’t see any reason that one is returning the field names, but not the other.

Thank you,
Michael Moore

Geoserver 2.2.4 using Jetty on Windows Server 2008.

We’re pulling several layers from SQL Server and I’m trying to get a list of field names for each layer using WFS’s DescribeFeatureType request.

All layers are published in GeoServer with the same settings (Same polygon style, same SRS, etc.) but some layers don’t list their field names in DescribeFeatureType and others do. Can anyone shed some light on why this might be?

Eg. when I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:geofence_static
I get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
<xsd:complexType name=“geofence_staticType”>
xsd:complexContent
<xsd:extension base=“gml:AbstractFeatureType”>
xsd:sequence
<xsd:element maxOccurs=“1” minOccurs=“1” name=“ogr_fid” nillable=“false” type=“xsd:int”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“ogr_geometry” nillable=“true” type=“gml:GeometryPropertyType”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“aeroway” nillable=“true” type=“xsd:string”/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name=“geofence_static” substitutionGroup=“gml:AbstractFeature” type=“MNS:geofence_staticType”/>
</xsd:schema>

If I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:GeoFence
I simply get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
</xsd:schema>

I can’t see any reason that one is returning the field names, but not the other.

I think I have a lead but not a solution. I hadn’t noticed that the log file is logging a backtrace despite returning valid XML. The backtrace is:

2013-05-07 15:09:07,730 WARN [geoserver.wfs] - Could not build xml schema for type: GeoFence
java.lang.NullPointerException: Could not find a type for property: ID of type: java.util.UUID
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildComplexSchemaContent(FeatureTypeSchemaBuilder.java:743)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaContent(FeatureTypeSchemaBuilder.java:664)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaInternal(FeatureTypeSchemaBuilder.java:234)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:147)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:141)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:130)
at org.geoserver.wfs.xml.v1_1_0.XmlSchemaEncoder.doWrite(XmlSchemaEncoder.java:106)

In SQL Server we do have the ID field defined as type ‘uniqueidentifier’.

Is there a way to add support for type java.util.UUID, or do I need to rework my database tables?

Thank you,
Michael Moore

On Tue, May 7, 2013 at 8:20 PM, Michael Moore <michael.moore@anonymised.com

wrote:

Geoserver 2.2.4 using Jetty on Windows Server 2008.

We're pulling several layers from SQL Server and I'm trying to get a list
of field names for each layer using WFS's DescribeFeatureType request.

All layers are published in GeoServer with the same settings (Same polygon
style, same SRS, etc.) but some layers don't list their field names in
DescribeFeatureType and others do. Can anyone shed some light on why this
might be?

Eg. when I request

http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:geofence_static
I get:

<xsd:schema elementFormDefault="qualified" targetNamespace="
http://www.mydomain.net/tracking/MNS&quot;&gt;
<xsd:import namespace="http://www.opengis.net/gml/3.2&quot; schemaLocation="
http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd&quot;/&gt;
<xsd:complexType name="geofence_staticType">
   <xsd:complexContent>
         <xsd:extension base="gml:AbstractFeatureType">
                  <xsd:sequence>
                    <xsd:element maxOccurs="1" minOccurs="1"
name="ogr_fid" nillable="false" type="xsd:int"/>
                    <xsd:element maxOccurs="1" minOccurs="0"
name="ogr_geometry" nillable="true" type="gml:GeometryPropertyType"/>
                    <xsd:element maxOccurs="1" minOccurs="0"
name="aeroway" nillable="true" type="xsd:string"/>
                  </xsd:sequence>
         </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:element name="geofence_static"
substitutionGroup="gml:AbstractFeature" type="MNS:geofence_staticType"/>
</xsd:schema>

If I request

http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:GeoFence
I simply get:

<xsd:schema elementFormDefault="qualified" targetNamespace="
http://www.mydomain.net/tracking/MNS&quot;&gt;
<xsd:import namespace="http://www.opengis.net/gml/3.2&quot; schemaLocation="
http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd&quot;/&gt;
</xsd:schema>

I can't see any reason that one is returning the field names, but not the
other.

Impossible to say just by looking at the outputs.
A few questions:
* if you restart GeoServer and ask first about the GeoFence layer, do you
get a non empty response?
* what is the data types for the tables that won't show up (e.g., do you
have a CREATE TABLE for those?
* do they have any sort of special permission attached? (e.g., grants)

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Same response after restarting and there’s no special permissions yet.

The CREATE function is as follows:

USE [GIS_Test]
GO

/****** Object: Table [dbo].[GeoFence] Script Date: 05/07/2013 15:21:05 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[GeoFence](
[ID] [uniqueidentifier] NOT NULL,
[AssetID] nvarchar NOT NULL,
[Name] nvarchar NOT NULL,
[Created] [datetime] NOT NULL,
[Notes] nvarchar NULL,
[the_geom] [geometry] NOT NULL,
CONSTRAINT [PK_Unit] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[GeoFence] ADD DEFAULT (newsequentialid()) FOR [ID]
GO

It looks like the ID field (type: uniqueidentifier) is probably the culprit:

2013-05-07 15:25:30,644 WARN [geoserver.wfs] - Could not build xml schema for type: GeoFence
java.lang.NullPointerException: Could not find a type for property: ID of type: java.util.UUID
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildComplexSchemaContent(FeatureTypeSchemaBuilder.java:743)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaContent(FeatureTypeSchemaBuilder.java:664)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaInternal(FeatureTypeSchemaBuilder.java:234)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:147)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:141)
at org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:130)
at org.geoserver.wfs.xml.v1_1_0.XmlSchemaEncoder.doWrite(XmlSchemaEncoder.java:106)
at org.geoserver.wfs.xml.v1_1_0.XmlSchemaEncoder.write(XmlSchemaEncoder.java:95)

Thank you,
Michael Moore

···

Geoserver 2.2.4 using Jetty on Windows Server 2008.

We’re pulling several layers from SQL Server and I’m trying to get a list of field names for each layer using WFS’s DescribeFeatureType request.

All layers are published in GeoServer with the same settings (Same polygon style, same SRS, etc.) but some layers don’t list their field names in DescribeFeatureType and others do. Can anyone shed some light on why this might be?

Eg. when I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:geofence_static
I get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
<xsd:complexType name=“geofence_staticType”>
xsd:complexContent
<xsd:extension base=“gml:AbstractFeatureType”>
xsd:sequence
<xsd:element maxOccurs=“1” minOccurs=“1” name=“ogr_fid” nillable=“false” type=“xsd:int”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“ogr_geometry” nillable=“true” type=“gml:GeometryPropertyType”/>
<xsd:element maxOccurs=“1” minOccurs=“0” name=“aeroway” nillable=“true” type=“xsd:string”/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name=“geofence_static” substitutionGroup=“gml:AbstractFeature” type=“MNS:geofence_staticType”/>
</xsd:schema>

If I request
http://myserver/geoserver/wfs?request=DescribeFeatureType&typeName=MNS:GeoFence
I simply get:

<xsd:schema elementFormDefault=“qualified” targetNamespace=“http://www.mydomain.net/tracking/MNS”>
<xsd:import namespace=“http://www.opengis.net/gml/3.2” schemaLocation=“http://myserver/geoserver/schemas/gml/3.2.1/gml.xsd”/>
</xsd:schema>

I can’t see any reason that one is returning the field names, but not the other.

Impossible to say just by looking at the outputs.
A few questions:

  • if you restart GeoServer and ask first about the GeoFence layer, do you get a non empty response?
  • what is the data types for the tables that won’t show up (e.g., do you have a CREATE TABLE for those?
  • do they have any sort of special permission attached? (e.g., grants)

On Tue, May 7, 2013 at 9:17 PM, Michael Moore <michael.moore@anonymised.com

wrote

I think I have a lead but not a solution. I hadn't noticed that the log
file is logging a backtrace despite returning valid XML. The backtrace is:

2013-05-07 15:09:07,730 WARN [geoserver.wfs] - Could not build xml schema
for type: GeoFence
java.lang.NullPointerException: Could not find a type for property: ID of
type: java.util.UUID
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildComplexSchemaContent(FeatureTypeSchemaBuilder.java:743)
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaContent(FeatureTypeSchemaBuilder.java:664)
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.buildSchemaInternal(FeatureTypeSchemaBuilder.java:234)
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:147)
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:141)
    at
org.geoserver.wfs.xml.FeatureTypeSchemaBuilder.build(FeatureTypeSchemaBuilder.java:130)
    at
org.geoserver.wfs.xml.v1_1_0.XmlSchemaEncoder.doWrite(XmlSchemaEncoder.java:106)

In SQL Server we do have the ID field defined as type 'uniqueidentifier'.

Is there a way to add support for type java.util.UUID, or do I need to
rework my database tables?

Ah, I see. You have two choices:
* rework your tables
* add support for UUID in the SQLServer dialect class back in GeoTools.

The latter is not particularly hard, support for UUIDs was recently added
for PostGIS, this is
the entire patch (code change plus tests to check it works):

https://github.com/geotools/geotools/commit/233eac4368904a8319549ed30ed41b0166d99f56

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

That patch doesn’t look too daunting. I’ll see if someone here can implement it. We don’t have a Java dev environment set up at the moment so it may take a little bit.

Thank you,
Michael Moore

···

Is there a way to add support for type java.util.UUID, or do I need to rework my database tables?

Ah, I see. You have two choices:

  • rework your tables
  • add support for UUID in the SQLServer dialect class back in GeoTools.

The latter is not particularly hard, support for UUIDs was recently added for PostGIS, this is
the entire patch (code change plus tests to check it works):

https://github.com/geotools/geotools/commit/233eac4368904a8319549ed30ed41b0166d99f56