Hi Stuart,
> I *think* (Richard Jones cc’d can confirm this) that the problem is because
> you are POSTing the file to the Edit-IRI rather than the EditMedia-IRI. The
> Edit-IRI is the object as a whole, but since you are adding a file, this
> needs to go to the Edit Media IRI (the container of files) instead.
from the DSpace server I get two Edit Media IRI:
Link rel:'edit-media' -- [
{'href': 'http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/edit-media/171',
'type': 'application/zip'},
{'href':
'http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/edit-media/171.atom', 'type':
'application/atom+xml; type=feed'}]
Do you know what is the difference? Which one should I use?
Cheers
Marco
>
> Hello Stuart,
>
> Are you able to turn on some sort of debugging so we can see the HTTP request
> + headers that are being sent?
>
> here is the history of HTTP requests, and the replies from the server (I am
> in debug mode in the Python httplib2):
>
> * First I create a metadata entry only:
>
> send:
> 'POST /smdmrd-test/swordv2/collection/123456789/108 HTTP/1.1\r\n
> Host: c4dm.eecs.qmul.ac.uk\r\n
> in-progress: true\r\n
> content-length: 621\r\n
> content-type: application/atom+xml;type=entry\r\n
> accept-encoding: gzip, deflate\r\n
> user-agent: Python-httplib2/0.7.2 (gzip)\r\n
> authorization: Basic
> bWFyY28uZmFiaWFuaUBlZWNzLnFtdWwuYWMudWs6aG91c2Vjb3VjaDI5\r\n
> \r\n
> <?xml version="1.0"?><ns0:entry xmlns:ns0="http://www.w3.org/2005/Atom"
> xmlns:ns1="http://purl.org/dc/terms/">\n <ns0:generator
> uri="http://bitbucket.org/beno/python-sword2" version="0.1"
> />\n<ns1:title>Test SWORD deposit</ns1:title><ns1:abstract>My
> Thesis</ns1:abstract><ns1:isReferencedBy>Myself (2009). Another test
> deposit.</ns1:isReferencedBy><ns0:updated>2012-03-22T14:27:30.211672</ns0:updated><ns1:creator>Fabiani,
>
> Marco</ns1:creator><ns1:type>Dataset</ns1:type><ns1:subject>test</ns1:subject><ns1:publisher>C4DM</ns1:publisher><ns1:created>2009</ns1:created><ns1:creator>Pallino,
> Pinco</ns1:creator></ns0:entry>'
>
> * and the server does its job:
>
> reply: 'HTTP/1.1 201 Created\r\n'
> header: Date: Thu, 22 Mar 2012 14:27:03 GMT
> header: Server: Apache-Coyote/1.1
> header: Location: http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/edit/158
> header: Last-Modified: Thu, 22 Mar 2012 14:27:04 GMT
> header: Content-MD5: 977eda8ee9b6bc8ca4ee7a8ea6f667ee
> header: Content-Type: application/atom+xml;type=entry
> header: Transfer-Encoding: chunked
>
> * Then I try to add a file to this entry:
>
> send:
> 'POST /smdmrd-test/swordv2/edit/158 HTTP/1.1\r\n
> Host: c4dm.eecs.qmul.ac.uk\r\n
> content-length: 11083\r\n
> accept-encoding: gzip, deflate\r\n
> content-disposition: attachment; filename=foo.pdf\r\n
> in-progress: false\r\n
> content-md5: 348fb9ceae472a41df626a1610d764c5\r\n
> packaging: http://purl.org/net/sword/package/Binary\r\n
> user-agent: Python-httplib2/0.7.2 (gzip)\r\n
> content-type: application/pdf\r\n
> authorization: Basic
> bWFyY28uZmFiaWFuaUBlZWNzLnFtdWwuYWMudWs6aG91c2Vjb3VjaDI5\r\n
> \r\n
> %PDF-1.4\n
> %\xc3\xa4\xc3\xbc\xc3\xb6\xc3\x9f\n2 0 obj\n<</Length 3 0
> R/Filter/FlateDecode>>\nstream\nx\x9c%\xc9;\n\x800\x10\x05\xc0~O\xf1j\x8b\xf5E\x93\x98\x80X\x08\xda\x0b\x0b^\xc0\x0fX\x08\xdax}\x05\x99r\x88G.\x10T\x87\x90\x83\xd6H\xdei\xc6\xbdb.p\xfe\xf7\xb9w\xe9MB\xd4\x84\xc6g\x8d\xb0\x05\xe5\xe8\xe0\t\xdb\xd0\xd2\xb1bM\xcf\xd0\xc1\x0e\x19L&\x99\xf0\x02\x97r\x13\x93\nendstream\nendobj\n\n3
> 0 obj\n92\nendobj\n\n5 0 obj\n<</Length 6 0 R/Filter/FlateDecode/Length1
> 20360>>\nstream\nx\x9c\xed|{|T\xd5\xb9\xe8\xb7\xf6\xde\xf3\xc8c\x92I
> \xef\x84\xd9\x93\x9d\xc9\x83\xc9;`H\x18\xcd\x84<0\x04H\x84\x00\t\x95\x92\x9d\x99\x9ddd\x92\x19\xe6\x91\x18\xeai\xb0\xd6W\xd0\xc2\xa9\xd6G\x8f\x05Z\x0fj\x0b\xd6IP\x1b\xd0#\xe8\xbd\xb5\xa7O|\xd5jk+\xbd\xd5\xb6\xb6\xa5\x87Z\xb5\xed\x112\xe7[k\xef\xc9\x03\xd0\xdas\xcf\x1f\xf7\xf7\xbb\xcc\xceZ\xeb[k}\xeb[\xdf{\xed=;I(\x10V
>
> …
> …
> …
> 20070829203726+01\'00\')>>\nendobj\n\nxref\n0 14\n0000000000 65535 f
> \n0000010169 00000 n \n0000000019 00000 n \n0000000182 00000 n \n0000010312
> 00000 n \n0000000201 00000 n \n0000009370 00000 n \n0000009391 00000 n
> \n0000009587 00000 n \n0000009901 00000 n \n0000010082 00000 n \n0000010115
> 00000 n \n0000010411 00000 n \n0000010459 00000 n \ntrailer\n<</Size 14/Root
> 12 0 R\n/Info 13 0 R\n/ID [
> <5F3776DDFB6D4A2230F9DA4444B836BE>\n<5F3776DDFB6D4A2230F9DA4444B836BE>
> ]\n>>\nstartxref\n10646\n%%EOF\n'
>
> * and the server replies:
>
> reply: 'HTTP/1.1 400 Bad Request\r\n'
> header: Date: Thu, 22 Mar 2012 14:27:03 GMT
> header: Server: Apache-Coyote/1.1
> header: Content-Type: text/xml
> header: Connection: close
> header: Transfer-Encoding: chunked
>
> * The content of the reply is:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <sword:error href="http://purl.org/net/sword/error/ErrorBadRequest"
> xmlns:sword="http://purl.org/net/sword/terms/"><atom:title
> xmlns:atom="http://www.w3.org/2005/Atom"/><atom:updated
> xmlns:atom="http://www.w3.org/2005/Atom">2012-03-22T14:27:04Z</atom:updated><atom:generator
> uri="http://www.dspace.org/ns/sword/2.0/" version="2.0"
> xmlns:atom="http://www.w3.org/2005/Atom">rdm.c...@gmail.com</atom:generator><sword:treatment>Processing
> failed</sword:treatment><atom:summary
> xmlns:atom="http://www.w3.org/2005/Atom">http://purl.org/net/sword/error/ErrorBadRequest</atom:summary><sword:verboseDescription>org.swordapp.server.SwordError:
> http://purl.org/net/sword/error/ErrorBadRequest
> at org.swordapp.server.ContainerAPI.post(ContainerAPI.java:342)
> at
> org.swordapp.server.servlets.ContainerServletDefault.doPost(ContainerServletDefault.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:156)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> at java.lang.Thread.run(Thread.java:662)
> </sword:verboseDescription></sword:error>
>
> Any idea? At least I would like to understand if it is a problem with the
> python module or with the SWORDv2 server in DSpace…
>
> Cheers,
>
> Marco
>
>
> Thanks,
>
>
> Stuart
>
>
>
> Hello,
>
> I have been trying for sometime now to ingest data into our DSpace test
> repository using SWORD 2, but with little success.
> Specifically, I have been using the python-sword2 module, and followed the
> examples there. I can successfully create an item submitting only metadata
> ("Creating a Resource with an Atom Entry"), but when I try to send a file
> (binary), I keep getting errors from the server.
>
> If I try the multipart submission way, I get a 500 error with this cause:
> "Attempting to store and check deposit which has no input stream"
>
> If I try to append the file to an item I previously created with the Atom
> Entry, I get a 400 errorhttp://purl.org/net/sword/error/ErrorBadRequest, that
> goes down to here:
>
> at org.swordapp.server.ContainerAPI.post(ContainerAPI.java:342)
> at
> org.swordapp.server.servlets.ContainerServletDefault.doPost(ContainerServletDefault.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:156)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
> at java.lang.Thread.run(Thread.java:662)
>
> I know this is very little information to get some help, but I just started
> using DSpace and SWORD, so I don't really know if it is a problem with DSpace
> (maybe in the configuration), with my python-sword2 requests or something
> else, so I would appreciate if you could point me to the right direction.
>
> Thank you in advance for any help,
> best regards
>
> Marco
>
> --------------------------------------------------
> Marco Fabiani
> Postdoctoral Research Assistant
> Centre for Digital Music
> School of Electronic Engineering and Computer Science
> Queen Mary, University of London
> Mile End Road, London E1 4NS, UK
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> sword-app-tech mailing list
> sword-app-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
sword-app-tech mailing list
sword-app-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sword-app-tech