I have been trying to publish a zipped up shapefile to GeoServer.
For background, I am using DotSpatial to create a Line shapefile based on uploaded points. Once I have created the shapefile, I compress all files generated (shp, prj, dbf, shx). Then I want to publish it to GeoServer
I am able to create a Workspace and DataStore using a web request. When I tried adding the zipped up shapefile, all shapefiles are placed in the data\ folder.
No featuretype.xml or or layer.xml file is created under the workspace folder. The datastore.xml does get created.
The error I get back is:
500 Server Error
It worked at some point but is now not working and I haven't changed the code.
Dim localShapeFile() As Byte = readLocalShapeFile(zipUri) ' read file bytes
Dim sUrl As String = "http://localhost:8080/geoserver/rest/workspaces/" & workspace & "/datastores/" & dsname & "/file.shp"
Dim request As WebRequest = WebRequest.Create(sUrl)
request.ContentType = "application/zip"
request.Method = "PUT"
request.Credentials = New NetworkCredential("admin", "geoserver")
Dim requestStream As Stream = request.GetRequestStream
requestStream.Write(localShapeFile, 0, localShapeFile.Length)
requestStream.Close()
Dim response As WebResponse = request.GetResponse ' error is produced here