Hello all
I am getting an error response from DSpace when trying to deposit content via it's SWORDv2 API. I am using the Python SWORD client library (https://github.com/swordapp/python-client-sword2). What I find particularly confusing is the fact that when I try to deposit using curl, everything goes smoothly: curl -i --data-binary "@strategic_plan_2016.pdf" -H "Content-Disposition:attachment; filename=strategic_plan_2016.pdf" -H "Content-Type:application/pdf" -H "Packaging:http://purl.org/net/sword/package/Binary" -u hrafn.malmqu...@ed.ac.uk:********** -X POST http://test.digitalpreservation.is.ed.ac.uk/swordv2/collection/123456789/2 the python script that generates the error is copy pasted below There is one caveat that the SSL certificate on the server is broken which might be an issue (https://github.com/swordapp/python-client-sword2/issues/9). However I get a 403 response when trying to deposit the files via the Python sword client. The edit-media file (http://test.digitalpreservation.is.ed.ac.uk/swordv2/edit-media/e9598d4d-ba1c-4710-95b9-000b8ce30772) gives this error: <sword:error xmlns:sword="http://purl.org/net/sword/terms/" href="http://purl.org/net/sword/error/ErrorContent"> <atom:title xmlns:atom="http://www.w3.org/2005/Atom">ERROR</atom:title> <atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2018-04-09T10:39:20Z</atom:updated> <atom:generator xmlns:atom="http://www.w3.org/2005/Atom" uri="http://www.dspace.org/ns/sword/2.0/" version="2.0">dspace-h...@myu.edu</atom:generator> <sword:treatment>Processing failed</sword:treatment> <atom:summary xmlns:atom="http://www.w3.org/2005/Atom">No plugin can disseminate the requested formats</atom:summary> <sword:verboseDescription> org.swordapp.server.SwordError: No plugin can disseminate the requested formats at org.dspace.sword2.SwordDisseminatorFactory.getContentInstance(SwordDisseminatorFactory.java:112) at org.dspace.sword2.MediaResourceManagerDSpace.getItemResource(MediaResourceManagerDSpace.java:114) at org.dspace.sword2.MediaResourceManagerDSpace.getMediaResourceRepresentation(MediaResourceManagerDSpace.java:229) at org.swordapp.server.MediaResourceAPI.get(MediaResourceAPI.java:82) at org.swordapp.server.MediaResourceAPI.get(MediaResourceAPI.java:33) at org.swordapp.server.servlets.MediaResourceServletDefault.doGet(MediaResourceServletDefault.java:35) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:478) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) </sword:verboseDescription> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" type="text/html" href="http://test.digitalpreservation.is.ed.ac.uk/contact"/> </sword:error> I even tried adding the verify=False argument to the request post which should disable SSL certificate checking but I get the same error. Any ideas on what might be causing this issue? Unless it is the SSL certificate I can't understand why depositing using the same user name as I've done using curl gives an authentication error using python request. Hrafn Malmquist digital library development Edinburgh University Python Script --------------------------------------- from sword2 import Connection, exceptions import requests import os import urllib c = Connection("http://test.digitalpreservation.is.ed.ac.uk/swordv2/servicedocument", user_name="hrafn.malmqu...@ed.ac.uk", user_pass="**********") destination_path = 'http://test.digitalpreservation.is.ed.ac.uk/swordv2/collection/123456789/2' entry_receipt = c.create( col_iri=destination_path, in_progress=True, metadata_entry=entry, ) headers = { 'Content-Type': 'application/pdf', #str(mimetypes.guess_type("strategic_plan_2016.pdf")), # 'Content-MD5': str(md5sum), #'Packaging': 'http://purl.org/net/sword/package/Binary', 'Content-Length': str(os.path.getsize("strategic_plan_2016.pdf")), 'Content-Disposition': "attachment; filename=%s" % urllib.quote(os.path.basename("strategic_plan_2016.pdf")), } entry = '<?xml version="1.0"?>' \ '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/">' \ ' <generator uri="http://bitbucket.org/beno/python-sword2" version="0.1"/>' \ ' <dcterms:rights.copyright xmlns:atom="http://www.w3.org/2005/Atom">This content may be under copyright. Researchers are responsible for determining the appropriate use or reuse of materials.</dcterms:rights.copyright>' \ ' <dcterms:title xmlns:atom="http://www.w3.org/2005/Atom">Strategic Plan DB</dcterms:title>' \ ' <atom:title xmlns:atom="http://www.w3.org/2005/Atom">Strategic Plan Atom</atom:title>' \ ' <dcterms:date.issued xmlns:atom="http://www.w3.org/2005/Atom">2018</dcterms:date.issued>' \ ' <atom:updated xmlns:atom="http://www.w3.org/2005/Atom">2018-04-06T04:08:41.425884</atom:updated>' \ ' <dcterms:relation.ispartofseries xmlns:atom="http://www.w3.org/2005/Atom">Central Records Registry - ESTATES</dcterms:relation.ispartofseries>' \ ' <dcterms:description.abstract xmlns:atom="http://www.w3.org/2005/Atom"/>' \ ' <dcterms:contributor.author xmlns:atom="http://www.w3.org/2005/Atom">University of Edinburgh (Scottish University)</dcterms:contributor.author>' \ '</entry>' with open("strategic_plan_2016.pdf", "rb") as data: content = data.read() receipt = requests.post(entry_receipt.edit_media, headers=headers, data=content, auth=("hrafn.malmqu...@ed.ac.uk", "**********"), verify=False) --------------------------------------- -- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscr...@googlegroups.com. To post to this group, send email to dspace-tech@googlegroups.com. Visit this group at https://groups.google.com/group/dspace-tech. For more options, visit https://groups.google.com/d/optout.
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscr...@googlegroups.com. To post to this group, send email to dspace-tech@googlegroups.com. Visit this group at https://groups.google.com/group/dspace-tech. For more options, visit https://groups.google.com/d/optout.