Hi,
I've been trying to deposit through SWORD (both with versions 1 and 2)
but it either fails or does it incorrectly. Fetching the servicedocument
and depositing a file to an item work though.
With SWORD v1:
curl -i --data-binary "@dspace-sword/example/example.zip" -H
"Content-Disposition: filename=test1.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" --user "user:pass"
http://1.2.3.4/sword/deposit/12345/2
It gives me this error:
WARN org.dspace.content.packager.METSManifest @ Got no bitstream
ADMID, file@ID=sword-mets-file-3
[...]
ERROR org.dspace.sword.SWORDMETSIngester @ caught exception:
org.dspace.content.packager.PackageValidationException: Invalid METS
Manifest: file element without ID attribute.
at
org.dspace.content.packager.AbstractMETSIngester.addBitstreams(AbstractMETSIngester.java:850)
at
org.dspace.content.packager.AbstractMETSIngester.ingestObject(AbstractMETSIngester.java:500)
at
org.dspace.content.packager.AbstractMETSIngester.ingest(AbstractMETSIngester.java:234)
at
org.dspace.sword.SWORDMETSIngester.ingest(SWORDMETSIngester.java:93)
at
org.dspace.sword.CollectionDepositor.doDeposit(CollectionDepositor.java:111)
[...]
Actually, the file element has an ID attribute, what the code is really
checking for is the ADMID attribute, which I've confirmed it is missing.
With SWORD v2:
curl -i --data-binary "@dspace-sword/example/example.zip" -H
"Content-Disposition: filename=test1.zip" -H "Content-Type:
application/zip" -H "X-Packaging:
http://purl.org/net/sword/package/METSDSpaceSIP" -H "X-No-Op: false" -H
"X-Verbose: true" --user "user:pass"
http://1.2.3.4/swordv2/collection/12345/2
The deposit doesn't fail, but the zip doesn't get unpacked either. An
item is created with no metadata from the METS file. It just contains a
bitstream with the name test1.zip, which corresponds to example.zip.
In the logs I see this warning:
WARN org.dspace.core.PluginManager @ Cannot find named plugin for
interface=org.dspace.sword2.SwordContentIngester, name="application/zip"
It seems like it is using the Content-Type header instead of
X-Packaging. So if set the value of the Content-Type header of the
previous command to "Content-Type:
http://purl.org/net/sword/package/METSDSpaceSIP", I get this error:
[...]
WARN org.dspace.content.packager.METSManifest @ Got no bitstream
ADMID, file@ID=sword-mets-file-3
INFO org.dspace.content.Bitstream @
sword:session_id=0:update_bitstream:bitstream_id=18
ERROR org.dspace.sword2.SwordMETSContentIngester @ caught exception:
org.dspace.content.packager.PackageValidationException: Invalid METS
Manifest: file element without ID attribute.
at
org.dspace.content.packager.AbstractMETSIngester.addBitstreams(AbstractMETSIngester.java:850)
at
org.dspace.content.packager.AbstractMETSIngester.replaceObject(AbstractMETSIngester.java:660)
at
org.dspace.content.packager.AbstractMETSIngester.replace(AbstractMETSIngester.java:1187)
at
org.dspace.sword2.SwordMETSContentIngester.ingestToCollection(SwordMETSContentIngester.java:108)
at
org.dspace.sword2.AbstractSwordContentIngester.ingest(AbstractSwordContentIngester.java:45)
at
org.dspace.sword2.SwordMETSContentIngester.ingest(SwordMETSContentIngester.java:44)
at
org.dspace.sword2.CollectionDepositManagerDSpace.createNewFromBinary(CollectionDepositManagerDSpace.java:229)
[...]
If I try to deposit from another repository with the SWORD client
functionality, it also fails with the ID attribute error, although in
this case the ADMID attribute is present in the file element.
I've made all these tests with DSpace 4 (master) test machine without
any customisation apart from the install directories in
build.properties. Nevertheless, I get the same results with
demo.dspace.org.
Any idea of what am I doing wrong?
Thanks,
Àlex