I have a geoserver which I want to edit using c-sharp, I managed to retrieve information from it, but I haven't found a way to make any changes - I know that there is WFS-T but I haven't found a way to initialize it, I made the xml file (with my insert/delete/update), but I'm not sure how to send it to my geoserver, how can I send it using csharp?

URL = "http://localhost:8080/geoserver/topp"

XML file:

<?xml version="1.0" ?>
   <wfs:Update typeName="topp:states">

request code

 WebRequest request = WebRequest.Create(url); //the geoserver url

    request.ContentType = "text/xml";
    request.Method = "POST";
    request.Credentials = new NetworkCredential("admin", "geoserver");

    byte[] buffer = File.ReadAllBytes(xmlrequest); //Makes a change to the state's name
    Stream reqstr = request.GetRequestStream();
    reqstr.Write(buffer, 0, buffer.Length);

    WebResponse response = request.GetResponse();

The geoserver is not changing the state's name

Update: now it connects to the server but I'm getting a "OperationParsingFailed" exception, altough I find that there is noting wrong with my xml file

  • please add the code you have so far, and a description of what is not working. – Ian Turton Apr 4 at 7:24
  • The post has been updated with my request attempt – Ido H Levi Apr 4 at 7:28
  • We'd also need to see the contents of UpdateXML and url – Ian Turton Apr 4 at 7:49
  • I've just updated them both – Ido H Levi Apr 4 at 8:07

Problem was that I didn't used all of my namespaces which has made a conflict, removed the unnecessary ones and it works like magic

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.