SWORD v2 zip submission fails to parse mets.xml

75 views
Skip to first unread message

al...@vt.edu

unread,
Sep 24, 2021, 3:30:16 PM9/24/21
to DSpace Technical Support
I can use SWORD (v1) to deposit the attached zip file containing a PDF and mets.xml file with

curl -i --data-binary "@art_4959256494595851995.zip" -H "Content-Disposition: filename=art_4959256494595851995.zip" -H "Content-Type: application/zip" -H "X-Packaging: http://purl.org/net/sword-types/METSDSpaceSIP" -H "X-No-Op: false" -H "X-Verbose: true" -u em...@vt.edu:password -X POST https://vtechworks.lib.vt.edu/sword/deposit/10919/105038

An item with complete parsed metadata is created. The reply is,

HTTP/2 202
content-type: application/atom+xml;charset=UTF-8
date: Fri, 24 Sep 2021 14:18:26 GMT
location: https://vtechworks.lib.vt.edu/sword/media-link
server: nginx/1.14.0 (Ubuntu)
strict-transport-security: max-age=31536000; includeSubDomains; preload

However the similar action in SWORD v2 fails,

curl -i --data-binary "@SV.2021.21548575.zip" -H "Content-Disposition: filename=SV.2021.2154857.zip" -H "Content-Type: application/zip" -H "X-Packaging: http://purl.org/net/sword-types/METSDSpaceSIP" -H "X-No-Op: false" -H "X-Verbose: true" -u em...@vt.edu:password -X POST https://vtechworks.lib.vt.edu/swordv2/collection/10919/105038

It creates an item but fails to parse the metadata in mets.xml. It returns:

Warning: Couldn't read data from file "SV.2021.21548575.zip", this makes an
Warning: empty POST.
HTTP/2 201
content-md5: 340de27eba01e49135f4d564802550c5
content-type: application/atom+xml; type=entry;charset=UTF-8
date: Fri, 24 Sep 2021 14:14:43 GMT
last-modified: Fri, 24 Sep 2021 10:14:43 -0400
location: http://vtechworks.lib.vt.edu/swordv2/edit/dd50a6b3-d43b-4de3-b85e-7a021f480259
server: nginx/1.14.0 (Ubuntu)
strict-transport-security: max-age=31536000; includeSubDomains; preload

<entry xmlns="http://www.w3.org/2005/Atom"><content type="application/zip" src="http://vtechworks.lib.vt.edu/swordv2/edit-media/dd50a6b3-d43b-4de3-b85e-7a021f480259"/><link href="http://vtechworks.lib.vt.edu/swordv2/edit-media/dd50a6b3-d43b-4de3-b85e-7a021f480259" rel="edit-media" type="application/zip"/><provenance xmlns="http://purl.org/dc/terms/">Submitted by xx (x...@vt.edu) on 2021-09-24T14:14:43Z
No. of bitstreams: 2
SV.2021.2154857.zip: 0 bytes, checksum: d41d8cd98f00b204e9800998ecf8427e (MD5)
SV.2021.2154857.zip: 0 bytes, checksum: d41d8cd98f00b204e9800998ecf8427e (MD5)</provenance><description xmlns="http://purl.org/dc/terms/">Zip file deposted by SWORD without accompanying metadata</description><title xmlns="http://purl.org/dc/terms/">Untitled: SV.2021.2154857.zip</title><title type="text">Untitled: SV.2021.2154857.zip</title><rights type="text"></rights><updated>2021-09-24T04:00:00.000Z</updated><generator uri="http://www.dspace.org/ns/sword/2.0/" version="2.0">x...@vt.edu</generator><id>http://vtechworks.lib.vt.edu/swordv2/edit/dd50a6b3-d43b-4de3-b85e-7a021f480259</id><link href="http://vtechworks.lib.vt.edu/swordv2/edit/dd50a6b3-d43b-4de3-b85e-7a021f480259" rel="edit"/><link href="http://vtechworks.lib.vt.edu/swordv2/edit/dd50a6b3-d43b-4de3-b85e-7a021f480259" rel="http://purl.org/net/sword/terms/add"/><link href="http://vtechworks.lib.vt.edu/swordv2/edit-media/dd50a6b3-d43b-4de3-b85e-7a021f480259.atom" rel="edit-media" type="application/atom+xml; type=feed"/><packaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</packaging><link href="http://vtechworks.lib.vt.edu/swordv2/statement/dd50a6b3-d43b-4de3-b85e-7a021f480259.rdf" rel="http://purl.org/net/sword/terms/statement" type="application/rdf+xml"/><link href="http://vtechworks.lib.vt.edu/swordv2/statement/dd50a6b3-d43b-4de3-b85e-7a021f480259.atom" rel="http://purl.org/net/sword/terms/statement" type="application/atom+xml; type=feed"/><treatment xmlns="http://purl.org/net/sword/terms/">The package has been ingested and unpacked into the item.  Template metadata for the collection has been used, and a default title with the name of the file has been set</treatment><link href="http://vtechworks.lib.vt.edu/swordv2/edit-media/bitstream/92222d9d-ad48-4dcd-8f75-bd28bd826718/SV.2021.2154857.zip" rel="http://purl.org/net/sword/terms/originalDeposit" type="application/x-zip-compressed"/></entry>

Is METSDSpaceSIP enabled for SWORD v2?

Is there any difference between the mets.xml needed for SWORD and SWORDv2?

I tried testing this on DSpace Demo (6.3 XMLUI),


"HTTP Status 400 - Unable to recognise URL as a valid service document"


<sword:error href="http://www.dspace.org/ns/sword/2.0/errors/BadUrl">
<atom:title>ERROR</atom:title>
<atom:updated>2021-09-24T19:19:00Z</atom:updated>
<atom:generator uri="http://www.dspace.org/ns/sword/2.0/" version="2.0">dspac...@gmail.com</atom:generator>
<sword:treatment>Processing failed</sword:treatment>
<atom:summary>
Unable to recognise URL as a valid service document: https://demo.dspace.org/swordv2/servicedocument
</atom:summary>

Is SWORD or SWORDv2 enabled on DSpace Demo?
art_4959256494595851995.zip

Carl Jones

unread,
Sep 24, 2021, 9:32:38 PM9/24/21
to DSpace Technical Support

I haven't found any difference in the METS between SWORD v1 or v2. You might try changing the packaging header directive to 'Packaging' instead of 'X-Packaging'. 
 Apparently  -H "Packaging:...." was required for v2. On 6.3 we've had success with:

/usr/bin/curl --basic --user myn...@mit.edu:$mypass -i -T "./PhysRevB.99.075430-mets.zip" -H "Content-Disposition:attachment; filename=PhysRevB.99.075430-mets.zip" -H "Content-Type:application/zip" -H "Packaging:http://purl.org/net/sword/package/METSDSpaceSIP" -H "X-No-Op:false" -vvv -X POST https://dspace.mit.edu/swordv2/collection/1721.1/121131

I also tested v2 on beta dspace 7.* a while back and that worked as well.

Hopefully that helps.

Carl

al...@vt.edu

unread,
Sep 27, 2021, 8:46:41 AM9/27/21
to DSpace Technical Support
Carl,

Thank you very much for your help which resolved my issue. Indeed,  -H "Packaging:http://purl.org/net/sword/package/METSDSpaceSIP" seems to be required for SWORDv2 and -H "X-Packaging: http://purl.org/net/sword-types/METSDSpaceSIP" required for SWORD. X-Packaging and the URLs are different. 

Anne
Reply all
Reply to author
Forward
0 new messages