I'm using osgeo live to test the pycsw functionality. I need to harvest metadata from an existing Geoserver service (previously configure for this task).

I'm quite new with CSW and I'm not sure if my procedure is right. I've trie to follow the instrutions under: http://geopython.github.io/pycsw-workshop/docs/intro/intro-exercises.html#metadata-harvesting

My xml config file (called 'cat.xml') for the harvest is:

  <?xml version="1.0" encoding="UTF-8"?>
  <Harvest xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-publication.xsd" service="CSW" version="2.0.2">

for the source element I've used this one too (without exit):


I use the command:

$ cd /var/www/pycsw
$ python ./sbin/pycsw-admin.py -c post_xml -u http://localhost/pycsw/csw.py -x ~/cat.xml

Then I get the following error message:

Intializing static context
Executing HTTP POST request /home/user/cat.xml on server http://localhost/pycsw/csw.py
Traceback (most recent call last):
  File "./sbin/pycsw-admin.py", line 245, in <module>
    print admin.post_xml(CSW_URL, XML, TIMEOUT)
  File "/usr/lib/python2.7/dist-packages/pycsw/admin.py", line 506, in post_xml
    raise RuntimeError(err)
RuntimeError: HTTP Error 401: Unauthorized

The request GetCapabilities works:


Can you help me?


pycsw-admin.py does not currently support proxy. You can work around this with:

curl -x <[protocol://][user:password@]proxyhost[:port]> -X POST -d @cat.xml http://localhost/pycsw/csw.py

If this still gives you errors then this means that the proxy information has to pass through pycsw to be able to access the resource to be harvested.

If you open a ticket this would helpful in providing this in the next pycsw release.

| improve this answer | |
  • Thaks Tom. I've opened a ticket. – user1638045 Jun 27 '14 at 11:52

The response shows that the WMS has a login requirement. What happens when you try to invoke a GetCapabilities operation against the WMS? i.e.:


You might also want to try some of the methods at http://pycsw.org/faq/#how-can-i-make-csw-post-xml-requests to further diagnose.

| improve this answer | |
  • After invoke http://localhost:8082/geoserver/wms?service=WMS&version=1.1.1&request=GetCapabilities I get the file getcapabilities_1.1.1.xml. When I invoke http://localhost:8082/geoserver/wms?service=WMS&version=1.1.1&request=GetMap&layers=cat:cat&styles=&bbox=-180.0,-87.0,180.0,87.0&width=682¬height=330&srs=EPSG4326¬format=image7png I get the layer on the browser. – user1638045 Jun 26 '14 at 9:18
  • What happens when you try curl -X POST -d @cat.xml http://localhost/pycsw/csw.py ? – tomkralidis Jun 26 '14 at 11:05
  • The response has an Access denied (authentication_failed) – user1638045 Jun 26 '14 at 11:22
  • This authentication is for the database? Or there is in some folder insufficient permissions? – user1638045 Jun 26 '14 at 11:27
  • The authentication is for the URL. What happens when you try curl http://localhost/pycsw/csw.py ? – tomkralidis Jun 26 '14 at 11:33

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.