I am trying to make a POST request to geoserver in order to Insert a new feature.
I am using the example provided by the Demo section of geoserver.
I have modified it as following:
<wfs:Transaction service="WFS" version="1.1.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:geonode="http://www.openplans.org/geonode"
xmlns:gml="http://www.opengis.net/gml">
<wfs:Insert>
<geonode:bgd_uti_transmissionline_nrel>
<geonode:the_geom>
<gml:MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:lineStringMember>
<gml:LineString>
<gml:coordinates decimal="." cs="," ts=" ">
88.247354197,21.438097723 89.247354197,18.438097723
</gml:coordinates>
</gml:LineString>
</gml:lineStringMember>
</gml:MultiLineString>
</geonode:the_geom>
<geonode:TYPE>alley</geonode:TYPE>
</geonode:bgd_uti_transmissionline_nrel>
</wfs:Insert>
</wfs:Transaction>
When trying to execute it I get a message:
Feature type 'bgd_uti_transmissionline_nrel' is not available:
Any idea why this is happening?
EDITED
I tried to make a DescribeFeature request as:
<DescribeFeatureType
version="1.0.0"
service="WFS"
xmlns="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://www.opengis.net/wfs">
<TypeName>geonode:bgd_uti_transmissionline_nrel</TypeName>
</DescribeFeatureType>
I did the request through the Demo section of geoserver. I get nothing back. Checking the Developer's tools, I see the request is pending.
EDIT II
I did the DescribeFeature request using PYTHON Requests and I get something meaningful:
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:geonode="http://www.geonode.org/" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" targetNamespace="http://www.geonode.org/">
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/2.1.2/feature.xsd"/>
<xsd:complexType name="bgd_uti_transmissionline_nrelType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:MultiLineStringPropertyType"/>
<xsd:element maxOccurs="1" minOccurs="0" name="OBJECTID" nillable="true" type="xsd:long"/>
<xsd:element maxOccurs="1" minOccurs="0" name="LENGTH" nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="POWERLIN_I" nillable="true" type="xsd:long"/>
<xsd:element maxOccurs="1" minOccurs="0" name="CODE" nillable="true" type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="0" name="LENSHPKM" nillable="true" type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="0" name="VOLTAGE" nillable="true" type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="0" name="GLOBALID" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SHAPE_LEN" nillable="true" type="xsd:double"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="bgd_uti_transmissionline_nrel" substitutionGroup="gml:_Feature" type="geonode:bgd_uti_transmissionline_nrelType"/>
</xsd:schema>
When I tried to do the InsertFeature request using PYTHON Requests, I got this error:
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>Feature type 'bgd_uti_transmissionline_nrel' is not available: </ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
Best Answer
There were two issues in my requests. The first one was related with the URL. Initially I was using this URL:
Including my_workspace name in the URL is necessary for this WFS-T Insert (according to here):
The second issue was related with the namespace I have defined: geonode In the end the xml I used looked like this:
The rest of the request command (using PYTHON Requests lib) is straightforward:
The problem to solve now is how to pass non spatial data in the request. Meaning values of the attributes.