Geographic Information Systems Asked on April 3, 2021
I am trying to activate a GeoServer OWS (WFS) service via the REST interface for a workspace.
In the GeoServer admin interface, there are two boxes to tick for enabling a service manually.
One in the "Edit Workspace" page and one on the service page itself, as in the screenshots. Both need to be ticked to have the service enabled.
Edit Workspace page:
Service page:
I am able to enable the box on the service page via the REST call
PUT
http://localhost:8080/geoserver/rest/services/wfs/workspaces/workspace/settings
sending this as the json body:
{"wfs":{"enabled":true}}
The problem is, I have to manually enable the WFS checkbox on the "Edit Workspace" page first, otherwise the REST call will return a 500 Internal Server Error.
How can I get the first checkbox ticked as well using a REST call?
I have managed to create a WFS service using the GeoServer REST API by sending the wfs.xml document to this URL:
PUT http:localhost:8080/geoserver/rest/services/wfs/workspaces/workspace/settings.xml
The wfs.xml stub looks basically like what GeoServer creates as wfs.xml in the workspace, just the workspace tag can be omitted and will be created by GeoServer.
<wfs>
<id>wfs</id>
<enabled>false</enabled>
<name>WFS</name>
<title>My WFS</title>
...
<featureBounding>false</featureBounding>
<canonicalSchemaLocation>true</canonicalSchemaLocation>
<encodeFeatureMember>false</encodeFeatureMember>
<hitsIgnoreMaxFeatures>false</hitsIgnoreMaxFeatures>
</wfs>
I found this process in the GeoServer test LocalWFSSettingsControllerTest.
Previously, I created the wfs.xml manually in the workspace folder, which will not have the same effect and did not create the WFS service correctly.
Correct answer by ulrich on April 3, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP