[OWSLib-users] error in CSW insert transaction : Document is XML, but not CSW-ish

Chiarello Ernest Ernest.Chiarello at univ-fcomte.fr
Tue May 3 00:20:24 PDT 2016


Le 03/05/2016 05:04, Tom Kralidis a écrit :
> On Mon, May 2, 2016 at 6:12 AM, Chiarello Ernest
> <Ernest.Chiarello at univ-fcomte.fr> wrote:
>> Hi all,
>>
>> I am trying to insert a metadata in GeoNetwork, according OWSlib
>> documentation but it fails with this error message :
>> RuntimeError: Document is XML, but not CSW-ish
>>
>> But above all, i think quotes are missing in the csw transaction. you should
>> write :
>>
>>>>> csw.transaction(ttype='insert', typename='gmd:MD_Metadata',
>>>>> record=open("file.xml").read())
>> instead of :
>>>>> csw.transaction(ttype='insert', typename='gmd:MD_Metadata',
>>>>> record=open(file.xml).read())
>>
>> Next i recovered a file from another GeoNetwork, in order to be sure that
>> the metadata file would be correct.
>>
>> wget
>> https://georchestra-mshe.univ-fcomte.fr/geonetwork/srv/fre/xml.metadata.get?id=17804
>> -O metadata.xml
>>
>> And then i tried to insert this metadata in my GeoNetwork Dev machine :
>>
>>>>> geonetwork =
>>>>> 'http://geonetwork-mshe.univ-fcomte.fr:8080/geonetwork/srv/fre/csw'
>>>>> from owslib.csw import CatalogueServiceWeb
>>>>> csw = CatalogueServiceWeb(geonetwork)
>>>>> csw.transaction(ttype='insert', typename='gmd:MD_Metadata',
>>>>> record=open("metadata.xml").read())
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>>    File "/usr/lib/python2.7/dist-packages/owslib/csw.py", line 446, in
>> transaction
>>      self._invoke()
>>    File "/usr/lib/python2.7/dist-packages/owslib/csw.py", line 680, in
>> _invoke
>>      raise RuntimeError('Document is XML, but not CSW-ish')
>> RuntimeError: Document is XML, but not CSW-ish
>>
>> Can anybody explain to me why my metadata.xml file is not CSW-ish ?
>>
> My guess is that some sort of authentication is required to make CSW-T
> requests against the CSW in question.  Try adding the username an
> password parameters to the constructor?
>
> ..Tom
something like that ?

 >>> csw.transaction(ttype='insert', typename='gmd:MD_Metadata', 
record=open("metadata.xml").read(), username='admin', password='admin')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: transaction() got an unexpected keyword argument 'username'

but it seems that username is not accepted... please, tell me.


Ernest.

>> Thanks in advance,
>>
>> Ernest.


-- 
Ernest CHIARELLO  -  Ernest.Chiarello at univ-fcomte.fr
UMR6049 ThéMA - Théoriser et Modéliser pour Aménager
CNRS / université de Bourgogne Franche-Comté
32 rue Mégevand 25030 BESANÇON Cedex

Tel : 03 81 66 54 80           Mob : 07 82 99 11 08




More information about the OWSLib-users mailing list