GeoServer Complex-Feature WFS Configuration: Data Connections in the Mapping File


When you configure a complex feature service, you have to manually map your data connection parameters into an XML document called a mapping file. I found that the easiest way to make this connection is as follows:

  1. Through GeoServer's admin interface, create a datastore that connects to your datasource in some workspace other than your GeoSciML workspace.
  2. Locate the datastore.xml file that was created for this temporary datastore. It should be at \geoserver\data\workspaces\<your workspace name>\<your datastore name>\datastore.xml.
  3. In that file, find the connectionParameters node. This will have a number of entry elements that you'll have to re-create in your mapping file. In datastore.xml, the parameters might look like this (if you're connection to PostgreSQL):

Depending on the type of datasource you're using the parameters will be different, however the syntax will remain the same.

When you are dealing with complex features, instead of having these connection parameters here, your datastore.xml will simply point to another document, the so-called "mapping file", which says the same things, but with different syntax. Here's part of the above example once I've migrated it to a mapping file:

Simply put the "key" from the datastore.xml into the name element, and the value into the value element. Using the interface to generate a "dummy" datastore.xml will just help you make sure you get the connection set up right.