Also I should probably tell them what version of geoserver is installed-
the about geoserver page seems to suggest it is 2.0.0- is that correct?
*************************************
do you see anything in the server logs? Can you enable
GEOSERVER_DEVELOPER_LOGGING and see what (if anything) pops up?
-Justin
On 3/28/10 10:59 PM, Tara Athan wrote:
> I've tried text/xml as well as application/xml and a few other things,
> doesn't seem to make any difference. However, that command may be the
> nexus of the problem- when I get with php-curl I have these scripts
> <?php
> $ch =
> curl_init('.../geoserver/rest/workspaces/california/datastores/californiaFloodplain/featuretypes/californiafloodplain.xml');
> $fp = fopen("current_featuretype.xml", "w");
> curl_setopt($ch, CURLOPT_FILE, $fp);
> curl_exec($ch);
> curl_close($ch);
> fclose($fp);
> ?>
> which works, returning the correct xml file,
> and this one
>
> <?php
> $ch =
> curl_init('.../geoserver/rest/workspaces/california/datastores/californiaFloodplain/featuretypes/californiafloodplain');
> $fp = fopen("current_featuretype.xml", "w");
> curl_setopt($ch, CURLOPT_FILE, $fp);
> curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml;
> charset=UTF-8")); curl_exec($ch);
> curl_close($ch);
> fclose($fp);
> ?>
> which does not work, returns html instead of xml.
>
>
> Andrea Aime wrote:
>> Tara Athan ha scritto:
>>> I was able to use the curl command line to update a featuretype. Now
>>> I am trying to get the same effect with a php script using the php
>>> curl commands, so I can do a batch update. I try the following
>>>
>>>
>>> <?php
>>> $fp = fopen("update_featuretype.xml", "r");
>>> $ch =
>>> curl_init('.../geoserver/rest/workspaces/california/datastores/californiaFloodplain/featuretypes/californiafloodplain');
>>>
>>> curl_setopt($ch, CURLOPT_INFILE, $fp);
>>> curl_setopt($ch, CURLOPT_INFILESIZE, 10000);
>>> curl_setopt($ch, CURLOPT_USERPWD, "...");
>>> curl_setopt($ch, CURLOPT_PUT, True);
>>> curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:' .
>>> 'application/xml'));
>>> curl_exec($ch);
>>> fclose($fp);
>>
>> Seems to me you're using the wrong content type, shouldn't
>> it be 'text/xml'?
>>
>> However the error message does not seem to be related to that...
>>
>> Cheers
>> Andrea
>>
>>
>
>
> --
> Tara Athan
> Owner, Athan Ecological Reconciliation Services
> tara_athan at alt2is.com
> 707-272-2115 (cell, preferred)
> 707-485-1198 (office)
> 249 W. Gobbi St. #A
> Ukiah, CA 95482
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
>
>
>
> _______________________________________________
> Geoserver-users mailing list
> Geoserv...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geoserver-users mailing list
Geoserv...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
I think it would have been quicker for me to make all the changes
manually :(, but I guess this will still be useful for keeping the
keywords synchronized (PUT), or as a way to retrieve all the information
for building the common.xml file (GET).
Tara
The fixes were:
in the GET scripts, use "Accepts: text/xml" instead of
"Content-type:text/xml", (...should have been obvious had I read the
documentation more carefully)
in the php PUT script, remove the
curl_setopt($ch, CURLOPT_INFILESIZE, 10000);
(... I don't understand why this causes problems, but I verified that it
works without, and doesn't work with it)
The correct scripts are
cURL versions:
curl -XGET -H "Accept: text/xml"
http://localhost:8080/geoserver/rest/workspaces/wsname/datastores/dsname/featuretypes/ftname>current_featuretype.xml
curl -u "admin:geoserver" -v -XPUT -H "Content-type: text/xml" -d
"@update_featuretype.xml"
http://localhost:8080/geoserver/rest/workspaces/wsname/datastores/dsname/featuretypes/ftname
php versions:
<?php
$ch =
curl_init('http://localhost:8080/geoserver/rest/workspaces/wsname/datastores/dsname/featuretypes/ftname');
$fp = fopen("current_featuretype.xml", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept:
text/xml"));
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
<?php
$fp = fopen("update_featuretype.xml", "r");
$ch =
curl_init('http://localhost:8080/geoserver/rest/workspaces/wsname/datastores/dsname/featuretypes/ftname');
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_USERPWD, "admin:geoserver");
curl_setopt($ch, CURLOPT_PUT, True);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type:
text/xml"));
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>