I am trying to make a leaflet app that send and update point data using WFS-T, geoserver, postgis. Its a new field for me so bare with me. I found this XML structure for the request below but I dont really understand the function of the different xml tags.

EDIT: Here is a working template for how the request should look like in an attempt to make it blindly obvious for other beginners with wfs-t

var postData =
        '<Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:test_wfst="namespace URI" xmlns:gml="http://www.opengis.net/gml" version="1.1.0" service="WFS" xsi:schemaLocation="namespace URI">\
            <Insert xmlns="http://www.opengis.net/wfs">\
                <layername xmlns="namespace URI">\
                    <geom xmlns="namespace URI">\
                        <gml:Point srsName="EPSG:4326">\
                            <gml:coordinates cs="," >'+geometry+'</gml:coordinates>\
                    <text xmlns="namespace URI">'+text+'</text>\

I have replaced http://www.domain.com/app to the one I am using. I just want to make sure I am on the right track and that the XML is correct?

I get a POST (403) OK error. I have not set any restrictions on authorization for the layer atm as far as I know. (WFS-T works when I use it in QGIS without authorization) Does it mean the XML is correct but somehow there is still an authorization error, or could i get the error anyway if the XML is wrong?

EDIT: Log file

2016-09-28 15:13:22,781 INFO [geoserver.wfs] - 
Request: getServiceInfo
2016-09-28 15:13:22,781 WARN [geotools.xml] - Schema location not specified as namespace/location pair. Ignoring https://www.domain.com/app (not real url)
2016-09-28 15:13:22,781 WARN [geotools.xml] - Could not find a schema

DescribeFeature request

<xsd:schema xmlns:gml="http://www.opengis.net/gml" xmlns:test_wfs_edit="test_wfst" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="test_wfst">
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://domain.com:80/geoserver/schemas/gml/2.1.2/feature.xsd"/>
<xsd:complexType name="wfs_punkt_testType">
<xsd:extension base="gml:AbstractFeatureType">
<xsd:element maxOccurs="1" minOccurs="1" name="id" nillable="false" type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="0" name="notat" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="bol" nillable="true" type="xsd:boolean"/>
<xsd:element maxOccurs="1" minOccurs="0" name="verdi" nillable="true" type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="0" name="dato" nillable="true" type="xsd:date"/>
<xsd:element maxOccurs="1" minOccurs="0" name="edited" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true" type="gml:PointPropertyType"/>
<xsd:element name="wfs_punkt_test" substitutionGroup="gml:_Feature" type="test_wfs_edit:wfs_punkt_testType"/>


var geometry = "63.00,23.00";

var postData = 
    '<Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:skiltbase="http://www.domain.com/app" xmlns:gml="http://www.opengis.net/gml" version="1.1.0" service="WFS" xsi:schemaLocation="http://www.domain.com/app">\
        <Insert xmlns="http://www.opengis.net/wfs">\
            <order xmlns="http://www.domain.com/app">\
                <geom xmlns="hhttp://www.domain.com/app">\
                    <gml:Point srsName="EPSG:4326">\
                        <gml:coordinates cs="," >'+geometry+'</gml:coordinates>\
                <date xmlns="http://www.domain.com/app">'+date+'</date>\
                <id xmlns="http://www.domain.com/app">'+id+'</id>\

    type: "POST",
    url:  rooturl,
    dataType: "xml",
    contentType: "text/xml",
    data: postData,
    success: function(xml) {

    success: function(xml) {
    error: function(xml){
  • What does the log file say? – Ian Turton Sep 28 '16 at 12:57
  • I added the log output in the question – geogrow Sep 28 '16 at 13:16
  • what is rooturl sir, i have been tried wfs-t from one week i was unable to pass url value basically i dont know which url i have to pass – user28536 Aug 2 '17 at 6:09
  • i will pass my code.. please suggest modifications sir, i have follwed wordpress-dbauszus.rhcloud.com/wfs-t-with-openlayers-3-5 example – user28536 Aug 2 '17 at 6:10

You need to use the URI you asigned to the workspace instead of https://www.domain.com/app. The easiest way to work out what GeoServer is expecting is to execute a describeFeatureType request against the layer, this will give you a response like:

<?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:extension base="gml:AbstractFeatureType">
          <xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:MultiSurfacePropertyType"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="STATE_NAME" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="STATE_FIPS" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="SUB_REGION" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="STATE_ABBR" nillable="true" type="xsd:string"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="LAND_KM" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="WATER_KM" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="PERSONS" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="FAMILIES" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="HOUSHOLD" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="MALE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="FEMALE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="WORKERS" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="DRVALONE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="CARPOOL" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="PUBTRANS" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="EMPLOYED" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="UNEMPLOY" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="SERVICE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="MANUAL" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="P_MALE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="P_FEMALE" nillable="true" type="xsd:double"/>
          <xsd:element maxOccurs="1" minOccurs="0" name="SAMP_POP" nillable="true" type="xsd:double"/>
  <xsd:element name="states" substitutionGroup="gml:_Feature" type="topp:statesType"/>


In my example you can see I'm asking about a feature type called "topp:states" and looking at the header the uri for topp is xmlns:topp="http://www.openplans.org/topp"

In your example you are looking for "test_wfs_edit:wfs_punkt_testType" and the uri is therefore xmlns:test_wfs_edit="test_wfst" - so your request needs to be something like:

 <Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:test_wfs_edit="test_wfs" xmlns:gml="http://www.opengis.net/gml" version="1.1.0" service="WFS" xsi:schemaLocation="http://www.domain.com/app">\
    <Insert xmlns="http://www.opengis.net/wfs">\
        <test_wfs_edit:wfs_punkt_test >\
            <test_wfs_edit:geom >\
                <gml:Point srsName="EPSG:4326">\
                    <gml:coordinates cs="," >'+geometry+'</gml:coordinates>\
            <wfs_edit_test:date >'+date+'</wfs_edit_test:date>\
  • Thanks! That's really useful. Will try it out and see what I get – geogrow Sep 28 '16 at 13:42
  • Sorry could I ask you again which of the parameter that would be my workspace in this case? My layer I want to edit sit in my workspace "test_wfs_edit" but that is quite different to what the Schema location is in the response (as added in question) – geogrow Sep 28 '16 at 14:17
  • Thank you for your help! I finally got it to work, very pleased. My kml is slightly off from the one you wrote I added a template in my question to make it blindly obvious for other amateurs – geogrow Sep 29 '16 at 12:25

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.