-1

I'm trying to get even the simplest WFS HTTP_POST request to work, against a GeoServer WFS endpoint.

This HTTP_GET request works, and returns what I expect (newlines inserted for clarity):

http://mygeoserver.com/geoserver/ows?
    service=wfs&
    version=2.0.0&
    request=getfeature&
    count=3&
    typenames=mynamespace:myfeaturetype&
    cql_filter=dccode=%27XYZ%27

I'd expect this HTTP_POST request:

http://mygeoserver.com/geoserver/ows

with this request body:

<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>

to return the same.

Instead I get an error:

    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'.

What's throwing me for a loop is that the very same value that works for the typeNames parameter in the HTTP_GET throws an error in the HTTP_POST.

The problem seems to be that I need to specify a namespace definition in the XML for "mynamespace".

<Query
    typeNames="mynamespace:myfeaturetype"
    xmlns:mynamespace="http://????"
    >

I'm assuming that this is available, somewhere within my GeoServer installation. But where?

Jeff Dege
  • 11,190
  • 22
  • 96
  • 165

1 Answers1

1

It will be whatever you set as the URI of the workspace mynamespace. You can look it using a describeFeature request. So for example:

curl http://localhost:8080/geoserver/wfs\?service=wfs\&version=1.1.0\&request=DescribeFeatureType\&typeName=topp:states

gives:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:gml="http://www.opengis.net/gml" 
   xmlns:topp="http://www.openplans.org/topp" 
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
   elementFormDefault="qualified" 
   targetNamespace="http://www.openplans.org/topp">
  <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
  <xsd:complexType name="statesType">
    <xsd:complexContent>
     [....]
Ian Turton
  • 10,018
  • 1
  • 28
  • 47