fyi, (I thought I mentioned this earlier on list) I did update my fork of
JavaServer2.0 to handle multipart-related:
https://github.com/mediashelf/sword2-server
Since I refactored it to package up as a jar (rather than a war), it should be
close to a drop-in replacement for anything using JavaServer2.0 (e.g. the
DSpace impl).
On Oct 31, 2012, at 4:35 PM, LEWIS Stuart <[email protected]> wrote:
> Hi Ian,
>
> Thanks for your email. The first thing to note is that due to a lack of any
> Java libraries that support Atom-Multipart deposit properly, DSpace doesn’t
> currently support multipart deposits. This is the same with other Java-based
> implementations such as Fedora.
>
> Therefore there are two options:
>
> - Use the ‘deposit()’ method to deposit a package created using the
> METS / SWAP packager
>
> (See:
> https://github.com/swordapp/swordappv2-php-library/blob/master/test/test-packager-mets_swap.php
> for an example of how to build a package)
>
> - First deposit the metadata as an atom entry (depositAtomEntry)
> with in-progress set to true, followed by extra calls to add files
> (addExtraFileToMediaResource) with the final call setting the in-progress to
> false.
>
> One other thing to check: Your email says:
>
> I’ve also changed the code to call the deposit method
>
> …
>
> About to deposit multipart file (test-files/swordlogo.jpg)
> tohttp://vmerdmsdspace01.ex.ac.uk/swordv2/collection/10871/6
> As: Guest406
> sac_curl=Resource id #22
> sac_resp= 2012-10-25T13:42:[email protected]
> failedUnacceptable content type in deposit request:
> application/x-www-form-urlencoded
>
> This looks you may not have changed the method being used, as the debug text
> still mentions multipart files, and the mime type sent suggests a multipart
> file.
>
> I hope this helps,
>
>
> Stuart Lewis
> Head of Digital Library Services
> Library & Collections, Information Services
> University of Edinburgh
> [email protected]
>
>
>
> From: Wellaway, Ian [mailto:[email protected]]
> Sent: 25 October 2012 13:55
> To: '[email protected]'
> Subject: [sword-app-tech] PHP swordv2 - 500 error / Unacceptable content type
>
> Hi,
>
> I’ve been attempting to test the swordv2 php library, with a hope to creating
> a ‘record-edit’ feature in dspace so users can update their archived items (a
> feature strangely lacking from dspace).
>
> I’ve copied the libraries down from the swordapp website and have configured
> the test-swordappclient.php page but get the following error from the
> deposit-multipart method:
>
>
> About to deposit multipart file (test-files/atom_multipart_package)
> tohttp://vmerdmsdspace01.ex.ac.uk/swordv2/collection/10871/6
> As: Guest406
> sac_curl=Resource id #22
> sac_resp=
> HTTP Status 500 -
> type Exception report
> message
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
> exception
> javax.servlet.ServletException:
> org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
>
> org.swordapp.server.SwordAPIEndpoint.getPartsFromRequest(SwordAPIEndpoint.java:458)
>
> org.swordapp.server.SwordAPIEndpoint.addDepositPropertiesFromMultipart(SwordAPIEndpoint.java:208)
> org.swordapp.server.CollectionAPI.post(CollectionAPI.java:145)
>
> org.swordapp.server.servlets.CollectionServletDefault.doPost(CollectionServletDefault.java:48)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> root cause
> org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
>
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:381)
>
> org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
>
> org.swordapp.server.SwordAPIEndpoint.getPartsFromRequest(SwordAPIEndpoint.java:452)
>
> org.swordapp.server.SwordAPIEndpoint.addDepositPropertiesFromMultipart(SwordAPIEndpoint.java:208)
> org.swordapp.server.CollectionAPI.post(CollectionAPI.java:145)
>
> org.swordapp.server.servlets.CollectionServletDefault.doPost(CollectionServletDefault.java:48)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> root cause
> org.apache.commons.fileupload.MultipartStream$MalformedStreamException:
> Stream ended unexpectedly
>
> org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:983)
>
> org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:887)
> java.io.InputStream.read(InputStream.java:85)
> org.apache.commons.fileupload.util.Streams.copy(Streams.java:94)
> org.apache.commons.fileupload.util.Streams.copy(Streams.java:64)
>
> org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:593)
>
> org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:619)
>
> org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:1012)
>
> org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:942)
>
> org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
>
> org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349)
>
> org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
>
> org.swordapp.server.SwordAPIEndpoint.getPartsFromRequest(SwordAPIEndpoint.java:452)
>
> org.swordapp.server.SwordAPIEndpoint.addDepositPropertiesFromMultipart(SwordAPIEndpoint.java:208)
> org.swordapp.server.CollectionAPI.post(CollectionAPI.java:145)
>
> org.swordapp.server.servlets.CollectionServletDefault.doPost(CollectionServletDefault.java:48)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> note The full stack trace of the root cause is available in the Apache
> Tomcat/6.0.32 logs.
> Apache Tomcat/6.0.32
>
> sac_status=500
>
> Fatal error: Uncaught exception 'Exception' with message 'Error parsing
> response entry (String could not be parsed as XML)' in
> /mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/swordappclient.php:583
> Stack trace: #0
> /mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/swordappclient.php(134):
> SWORDAPPClient->depositMultipartByMethod('http://vmerdmsd...', 'Guest406',
> 'PNFQwM', NULL, 'test-files/atom...', 'POST', 'http://purl.org...') #1
> /mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/test/test-swordappclient.php(73):
> SWORDAPPClient->depositMultipart('http://vmerdmsd...', 'Guest406', 'PNFQwM',
> NULL, 'test-files/atom...', 'http://purl.org...', false) #2 {main} thrown
> in/mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/swordappclient.php
> on line 583
>
>
>
> I’ve also changed the code to call the deposit method, as suggested in the
> discussion
> fromhttp://sourceforge.net/mailarchive/forum.php?thread_name=4FA170FE.3050608%40wijiti.com&forum_name=sword-app-tech
> but then receive the following:
>
>
> About to deposit multipart file (test-files/swordlogo.jpg)
> tohttp://vmerdmsdspace01.ex.ac.uk/swordv2/collection/10871/6
> As: Guest406
> sac_curl=Resource id #22
> sac_resp= 2012-10-25T13:42:[email protected]
> failedUnacceptable content type in deposit request:
> application/x-www-form-urlencodedorg.swordapp.server.SwordError: Unacceptable
> content type in deposit request: application/x-www-form-urlencoded at
> org.dspace.sword2.DSpaceSwordAPI.isAcceptable(DSpaceSwordAPI.java:228) at
> org.dspace.sword2.CollectionDepositManagerDSpace.createNewFromBinary(CollectionDepositManagerDSpace.java:218)
> at
> org.dspace.sword2.CollectionDepositManagerDSpace.createNew(CollectionDepositManagerDSpace.java:112)
> at org.swordapp.server.CollectionAPI.post(CollectionAPI.java:158) at
> org.swordapp.server.servlets.CollectionServletDefault.doPost(CollectionServletDefault.java:48)
> 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.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at
> org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at
> org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) at
> org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
> at
> org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
> at java.lang.Thread.run(Thread.java:619)
> Received HTTP status code: 415 (Unsupported media type)
>
> About to retrieve deposit receipt from
> As: Guest406
>
> Fatal error: Uncaught exception 'Exception' with message 'Error parsing
> response entry (String could not be parsed as XML)' in
> /mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/swordappclient.php:229
> Stack trace: #0
> /mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/test/test-swordappclient.php(324):
> SWORDAPPClient->retrieveDepositReceipt(NULL, 'Guest406', 'PNFQwM', NULL,
> 'http://purl.org...') #1 {main} thrown
> in/mnt/webdata1/webs/apps.exeter.ac.uk/docs/lisa_dev/swordv2/swordappclient.php
> on line 229
>
>
> In each case there is nothing in the tomcat or dspace logs.
>
> Any ideas?
>
> For help, I’ve printed some of the curl responses to the screen.
>
> Thanks
>
> Ian
>
> ------------
>
> Ian Wellaway
>
> Senior System Support & Development Officer - Enterprise Applications
> (Wednesdays only)
> &
> Technical Developer, Open Exeter - Infrastructure Systems (Monday-Tuesday,
> Thursday-Friday)
>
> Exeter IT
> Room 54
> Laver Building
> University of Exeter
> EX4 4QE
> UK
>
> tel +44 1392 722852
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________
> sword-app-tech mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sword-app-tech
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
sword-app-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sword-app-tech