我试图让最简单的 WFS HTTP_POST 请求针对 GeoServer WFS 端点工作。
此 HTTP_GET 请求有效,并返回我所期望的(为清楚起见插入了换行符):
http://mygeoserver.com/geoserver/ows?
service=wfs&
version=2.0.0&
request=getfeature&
count=3&
typenames=mynamespace:myfeaturetype&
cql_filter=dccode=%27XYZ%27
我希望这个 HTTP_POST 请求:
http://mygeoserver.com/geoserver/ows
使用此请求正文:
<GetFeature
version="2.0.0"
service="WFS"
count="3"
xmlns="http://www.opengis.net/wfs/2.0"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0/wfs.xsd"
>
<Query
typeNames="mynamespace:myfeaturetype"
>
<Filter
xmlns="http://www.opengis.net/fes/2.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gsml="http://xmlns.geosciml.org/GeoSciML-Core/3.2" >
<PropertyIsEqualTo>
<ValueReference>dccode</ValueReference>
<Literal>XYZ</Literal>
</PropertyIsEqualTo>
</Filter>
</Query>
</GetFeature>
返回相同。
相反,我得到一个错误:
cvc-datatype-valid.1.2.3: 'mynamespace:myfeaturetype' is not a valid value of union type 'TypeNamesType'.
cvc-attribute.3: The value 'mynamespace:myfeaturetype' of attribute 'typeNames' on element 'Query' is not valid with respect to its type, 'TypeNamesListType'.
让我陷入循环的是,与 HTTP_GET 中的 typeNames 参数相同的值会在 HTTP_POST 中引发错误。
问题似乎是我需要在 XML 中为“mynamespace”指定一个命名空间定义。
<Query
typeNames="mynamespace:myfeaturetype"
xmlns:mynamespace="http://????"
>
我假设这是可用的,在我的 GeoServer 安装中的某个地方。但是哪里?