0

I´m trying to reload a geoserver directory and I´m getting the following error:

The remote server returned an error: (501) Not Implemented.

This is the code

WebRequest serverRequest  =WebRequest.Create("http://xxxx:8080/geoserver/rest/workspaces");
serverRequest.Method = "RELOAD";

            serverRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(password));

            WebResponse serverResponse;
            serverResponse = serverRequest.GetResponse();
            serverResponse.Close();
John Gilbert
  • 159
  • 1
  • 4
  • 18

1 Answers1

1

serverRequest.Method is not related to a REST Webservice(?) method you want to invoke.

WebRequest.Method is either GET or POST (or any of those defined for geoserver) unless there is a HttpModule which implements a protocol method RELOAD.


According to the geoserver REST Configuration API Reference "Configuration Reloading" your call should look something like this:

WebRequest serverRequest = WebRequest.Create("http://xxxx:8080/geoserver/rest/reload");
serverRequest.Method = "POST";
// get response ...
Filburt
  • 17,626
  • 12
  • 64
  • 115
  • It´s true there are different methods like GET, POST ,PUT, DELETE and I´m not sure that wasn´t other method like reload, then is not possibLe make a reload using C#? – John Gilbert Aug 18 '11 at 11:11
  • Give my sample a try and maybe check out the linked REST reference. – Filburt Aug 18 '11 at 13:29
  • Thanks for your answer I tried before with something similar to your code and I just tried your code, the result is that in geoserver add something similar a folder called reload – John Gilbert Aug 19 '11 at 07:23
  • The linked reference is al little sparse on how the complete url for the reload method should actually look. It seems unclear if you need to include the workspace name or not. If you didn't already try, have your WebRequest point to `http://xxxx:8080/geoserver/reload`. If this doesn't work I'm running out of ideas ... – Filburt Aug 19 '11 at 10:35
  • Thanks for the idea with the new code I´m getting a different error **"The remote server returned an error: (404) Not Found."**. – John Gilbert Aug 19 '11 at 11:16