[Dspace-tech] Problems trying to deposit through SWORD

193 views
Skip to first unread message

Àlex Magaz Graça

unread,
Aug 26, 2015, 12:03:01 PM8/26/15
to Dspace Tech
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

Andrea Schweer

unread,
Aug 26, 2015, 12:06:11 PM8/26/15
to dspac...@lists.sourceforge.net
Hi,

On 05/12/13 05:48, Àlex Magaz Graça wrote:
> 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.
> [...]
> 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.

I just ran into the exact same issue with a pretty much standard DSpace
4 install (I only tried Sword v1). I used easydeposit, which previously
worked fine with DSpace 3.2.

Reverting
dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java
to the state before this commit
https://github.com/DSpace/DSpace/commit/5d8a420f6d47e2387e169798c4f3f1007118f1ab
makes the deposit go through but presumably introduces new problems
given that this commit was part of the fix for
https://jira.duraspace.org/browse/DS-1514.

Has anyone successfully used SWORD to submit a new item to DSpace 4?

cheers,
Andrea

--
Dr Andrea Schweer
IRR Technical Specialist, ITS Information Systems
The University of Waikato, Hamilton, New Zealand


Reply all
Reply to author
Forward
0 new messages