Flat Database example
Here is an example showing how to implement WFS Simple with a flat database in 3 easy steps.
Precondition: your database
Let's say you have a database table that looks like this:
| database schema | data table | |||||||||||||||||||||||
|
|
Step 1: code the GetFeature response
then your GetFeature response should look like this (transforming lat/lon into a GeoRSS GML Point):
<?xml version="1.0" encoding="ISO-8859-1"?>
<FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfss http://www.ogcnetwork.net/schemas/wfssimple/0.5/wfss.xsd"
xmlns="http://www.opengis.net/wfss" xmlns:gml="http://www.opengis.net/gml"
version="0.5" name="mydatabasetable" srsName="urn:x-ogc:def:crs:EPSG:6.3:4326" featurecount="2">
<gml:Envelope>
<gml:lowerCorner>43.2 -79.3</gml:lowerCorner>
<gml:upperCorner>43.6 -79.4</gml:upperCorner>
</gml:Envelope>
<Properties>
<Property name="name" type="string" />
<Property name="income" type="integer" />
<Property name="location" type="gml:Point" />
</Properties>
<Feature fid="mydatabasetable_1">
<Val>Homer Simpson</Val>
<Val>6000</Val>
<Val>
<gml:Point>
<gml:pos>43.6 -79.3</gml:pos>
</gml:Point>
</Val>
</Feature>
<Feature fid="mydatabasetable_2">
<Val>Mr. Burns</Val>
<Val>250000000</Val>
<Val>
<gml:Point>
<gml:pos>43.2 -79.4</gml:pos>
</gml:Point>
</Val>
</Feature>
</FeatureCollection>
Step 2: code the DescribeFeatureType response
that means you should produce a DescribeFeatureType response that looks a lot like the GetFeature response, but doesn't have any data values, and should probably have more metadata:
<FeatureDescription xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfss http://www.ogcnetwork.net/schemas/wfssimple/0.5/wfss.xsd"
xmlns="http://www.opengis.net/wfss" xmlns:gml="http://www.opengis.net/gml"
name="mydatabasetable" version="0.5">
<Description>
<Title>My data service</Title>
<Abstract>Income for Springfield residents</Abstract>
<MetadataURL url="http://example.com/simpsons/secretdatabase/about.html" />
</Description>
<gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.3:4326">
<gml:lowerCorner>43.2 -79.3</gml:lowerCorner>
<gml:upperCorner>43.6 -79.4</gml:upperCorner>
</gml:Envelope>
<Properties>
<Property name="name" title="Full Name" type="string" queryable="true" />
<Property name="income" title="Income, 2006" type="integer" queryable="true" />
<Property name="location" title="Location of primary residence" type="gml:Point" />
</Properties>
</FeatureDescription>
Step 3: code the GetCapabilities response
which all means your capabilities looks like this.

