Dear Friends:
What I want to do is publish a shapefile that already exists on the server. The shapefile on geoserver locates at data/ChinaMap/newLine/newLine.shp. My request is below:
url = "http://localhost:8080/geoserver/rest/workspaces/ChinaMap/datastores/newLine/external.shp";
data = “file:///data/ChinaMap/newLine/newLine.shp”;
curl_easy_setopt(_curl_handle, CURLOPT_USERPWD, userPassword.c_str());
curl_easy_setopt(_curl_handle, CURLOPT_URL, url.c_str());
curl_easy_setopt(_curl_handle, CURLOP_CUSTOMREQUEST, “PUT”);
curl_easy_setopt(_curl_handle, CURLOPT_HEADER, 1);
headers = curl_slist_append(NULL, “Content-Type: text/plain”);
curl_easy_setopt(_curl_handle, CURLOPT_POSTFIELDS, data.c_str());
curl_easy_setopt(_curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data.c_str()));
curl_easy_setopt(_curl_handle, CURLOPT_HTTPHEADER, headers);
curl_easy_perform(_curl_handle);
But I get the response is http 400 bad request, failed to locate the input file file:/data/ChinaMap/newLine/newLine.shp.
Who can help me??? Thank you!!!
The GeoServer documentation can help you! 
See:
http://docs.geoserver.org/stable/en/user/rest/index.html
http://docs.geoserver.org/stable/en/user/rest/api/index.html#rest-api
http://docs.geoserver.org/stable/en/user/rest/examples/curl.html
Regards,
Simone Giannecchini
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
Ing. Simone Giannecchini
@simogeo
Founder/Director
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
On Fri, Aug 29, 2014 at 10:21 AM, fanxing926 <fanxing926@anonymised.com> wrote:
Dear Friends:
What I want to do is publish a shapefile that already exists on the
server. The shapefile on geoserver locates at
data/ChinaMap/newLine/newLine.shp. My request is below:
url =
"http://localhost:8080/geoserver/rest/workspaces/ChinaMap/datastores/newLine/external.shp";
data = "file:///data/ChinaMap/newLine/newLine.shp";
curl_easy_setopt(_curl_handle, CURLOPT_USERPWD, userPassword.c_str());
curl_easy_setopt(_curl_handle, CURLOPT_URL, url.c_str());
curl_easy_setopt(_curl_handle, CURLOP_CUSTOMREQUEST, "PUT");
curl_easy_setopt(_curl_handle, CURLOPT_HEADER, 1);
headers = curl_slist_append(NULL, "Content-Type: text/plain");
curl_easy_setopt(_curl_handle, CURLOPT_POSTFIELDS, data.c_str());
curl_easy_setopt(_curl_handle, CURLOPT_POSTFIELDSIZE,
strlen(data.c_str()));
curl_easy_setopt(_curl_handle, CURLOPT_HTTPHEADER, headers);
curl_easy_perform(_curl_handle);
But I get the response is http 400 bad request, failed to locate the
input file file:/data/ChinaMap/newLine/newLine.shp.
Who can help me??? Thank you!!!
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users