报错信息
Feature type 'gis_tour' is not available
<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
<ServiceException code="InvalidParameterValue">
Feature type 'gis_tour' is not available
</ServiceException>
</ServiceExceptionReport>
官方示例
<wfs:Transaction service="WFS" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:tasmania_roads">
<wfs:Insert>
<topp:tasmania_roads>
<topp:the_geom>
<gml:MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:lineStringMember>
<gml:LineString>
<gml:coordinates decimal="." cs="," ts=" ">
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618
</gml:coordinates>
</gml:LineString>
</gml:lineStringMember>
</gml:MultiLineString>
</topp:the_geom>
<topp:TYPE>alley</topp:TYPE>
</topp:tasmania_roads>
</wfs:Insert>
</wfs:Transaction>
问题解决
解决方法很简单,标签<chatgis:gis_tour>改为<gis_tour>即可,也就是说这个地方只需要图层名,而不是官方示例的工作空间名称:图层名的格式。
当然,官方示例运行是没有报错的,但是如果完全按照他的示例测试自己发布的图层就会存在这个问题。另外,GeoServer相关问题的解决内容太少了,这个小问题卡了一个小时,记录下来,单独发一篇文章方便其他人能检索到,希望能帮助到你。