0

I was able to successfully create a Wfs_T app using the tutorial from https://medium.com/@goldrydigital/wfs-t-with-openlayers-3-16-6fb6a820ac58. I then decided to use this code to edit a file I'd made by creating a shapefile in QGIS, uploading into PostGIS, and then bringing it into GeoServer. To do this, all I did was change the code from

$.ajax('http://localhost:8080/geoserver/his_workspace/ows?', {
            type: 'GET',
            data: {
                service: 'WFS',
                version: '1.1.0',
                request: 'GetFeature',
                typename: 'his_layer_name',
                srsname: 'EPSG:3857',
                bbox: extent.join(',') + ',EPSG:3857'
            }
            })
var formatGML = new ol.format.GML({
            featureNS: 'his_workspace',
            featureType: 'his_layer_name',
            srsName: 'EPSG:3857'
            });

to

$.ajax('http://localhost:8080/geoserver/my_workspace/ows?', {
            type: 'GET',
            data: {
                service: 'WFS',
                version: '1.1.0',
                request: 'GetFeature',
                typename: 'my_layer_name',
                srsname: 'EPSG:3857',
                bbox: extent.join(',') + ',EPSG:3857'
            }
            })
var formatGML = new ol.format.GML({
            featureNS: 'my_workspace',
            featureType: 'my_layer_name',
            srsName: 'EPSG:3857'
            });

And I also changed

 $.ajax('http://localhost:8080/geoserver/his_workspace/ows', {
    type: 'POST',
    dataType: 'xml',
    processData: false,
    contentType: 'text/xml',
    data: payload
}).done(function() {
    sourceWFS.clear();
});

to

 $.ajax('http://localhost:8080/geoserver/my_workspace/ows', {
    type: 'POST',
    dataType: 'xml',
    processData: false,
    contentType: 'text/xml',
    data: payload
}).done(function() {
    sourceWFS.clear();
});

And Geoserver sends me the message:

org.geoserver.wfs.WFSException: No such feature type my_workspace:my_layer_name.

My describe feature type result is this:

<xsd:schema xmlns:my_workspace="my_workspace" xmlns:gml="http://www.opengis.net/gml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="www.my_workspace.com">
  <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/3.1.1/base/gml.xsd"/>
  <xsd:complexType name="my_layer_nameType">
    <xsd: complexContent>
      <xsd: extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element maxOccurs="1" minOccurs="1" name="id" nillable="false" type="xsd:long"/>
          <xsd:element maxOccurs="1" minOccurs="1" name="geom" nillable="true" type="gml:PointPropertyType"/>
        </xsd:sequence>
      </xsd: extension>
    </xsd: complexContent>
  </xsd:complexType>
  <xsd:element name="my_layer_name" substitutionGroup="gml:_Feature" type="my_workspace:my_layer_nameType"/>
</xsd:schema>

My workspace, data store, and namespace all have the same name. The constraints and other settings that the tutorial mentions seem to be the same for my file. I tried changing the namespace to a URI and I still get the error message. I do wonder if it's because the geometry is in a point(geometry) type while in the tutorial it's simply in a geometry type.

Edit: here is the XML: Raw XML request: <Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><Insert><my_layer_name xmlns="my_workspace"><geometry><Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857"><pos srsDimension="2">-724011.5319171895 7284143.047464156</pos></Point></geometry></my_layer_name></Insert></Transaction>

Does anyone know why this isn't going through?

  • please show use the exact code and xml sent to the server with obfuscation - turn the GeoServer logging up to geoserver-dev and include the relevant part of the log file – Ian Turton Apr 3 '18 at 8:01
  • Okay, so just to be sure I understand you, I went to Global Settings in GeoServer and I changed the logging profile to "Geoserver_Developer_Logging.properties. I've added the XML as well. – Ryan Norton Apr 6 '18 at 3:50
3

(Did you allow WFS-t on the geoserver side at first?)

Can you try set type name parameter with workspace of wfs feature.

$.ajax('http://localhost:8080/geoserver/my_workspace/ows?', {
            type: 'GET',
            data: {
                service: 'WFS',
                version: '1.1.0',
                request: 'GetFeature',
                typename: 'workspace_name:layer_name',
                srsname: 'EPSG:3857',
                bbox: extent.join(',') + ',EPSG:3857'
            }
})
  • 1
    Unfortunately, that didn't work either. – Ryan Norton Apr 6 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.