Implementing wfs-t server with geotools java

I need to read a WFS transaction from a client (OpenLayers) and take the appropriate action. I want to use geoTools! Is there a way to implement a wfs server?

Suppose I have Transassion:

<wfs:Transaction service="WFS" version="1.0.0β€³
 xmlns:myns="http://www.domain.com/ns"
 xmlns:ogc="http://www.opengis.net/ogc"
 xmlns:wfs="http://www.opengis.net/wfs">
  <wfs:Update typeName="myns:LayerToUpdate">
   <wfs:Property>
       <wfs:Name>propertyToUpdate</wfs:Name>
       <wfs:Value>updatedValue</wfs:Value>
   </wfs:Property>
   <ogc:Filter>
       <ogc:PropertyIsEqualTo>
           <ogc:PropertyName>constraintProperty</ogc:PropertyName>
           <ogc:Literal>constraintValue</ogc:Literal>
       </ogc:PropertyIsEqualTo>
   </ogc:Filter>
 </wfs:Update>
</wfs:Transaction>

      

It's understandable if you suggest another way to do this!

+3


source to share


1 answer


HttpServletRequest request=...;
org.geotools.xml.parser.Parser parser = new Parser(new org.geotools.wfs.v1_1.WFSConfigration());
TransactionType tt = (TransactionType) parser.parse(request.getReader());
InsertElementType insert1 = (InsertElementType) tt.getInsert().get(0);

      



0


source







All Articles